diff --git a/Sources/App/Resources/en.lproj/Localizable.strings b/Sources/App/Resources/en.lproj/Localizable.strings index 7230a18a3..670da2677 100644 --- a/Sources/App/Resources/en.lproj/Localizable.strings +++ b/Sources/App/Resources/en.lproj/Localizable.strings @@ -1174,4 +1174,7 @@ Home Assistant is free and open source home automation software with a focus on "widgets.sensors.not_configured" = "No Sensors Configured"; "widgets.sensors.title" = "Sensors"; "connection_error.advanced_section.title" = "Advanced"; +"widgets.custom.show_last_update_time.param.title" = "Show last update time"; +"widgets.custom.show_states.param.title" = "Show states (BETA)"; +"connection_error.open_settings.title" = "Open settings"; "yes_label" = "Yes"; diff --git a/Sources/App/WebView/ConnectionErrorDetailsView.swift b/Sources/App/WebView/ConnectionErrorDetailsView.swift index 5a0406a72..dfb045ac1 100644 --- a/Sources/App/WebView/ConnectionErrorDetailsView.swift +++ b/Sources/App/WebView/ConnectionErrorDetailsView.swift @@ -48,6 +48,7 @@ struct ConnectionErrorDetailsView: View { } } } + openSettingsButton CollapsibleView { Text(L10n.ConnectionError.AdvancedSection.title) .font(.body.bold()) @@ -73,8 +74,18 @@ struct ConnectionErrorDetailsView: View { .padding() } } - .ignoresSafeArea() + .ignoresSafeArea(edges: .top) .toolbar { + ToolbarItem(placement: .topBarLeading) { + Button(action: { + openSettings() + }, label: { + Image(uiImage: MaterialDesignIcons.cogIcon.image( + ofSize: .init(width: 28, height: 28), + color: .white + )) + }) + } ToolbarItem(placement: .topBarTrailing) { CloseButton(tint: .white) { dismiss() @@ -84,6 +95,12 @@ struct ConnectionErrorDetailsView: View { } } + private func openSettings() { + Current.sceneManager.webViewWindowControllerPromise.then(\.webViewControllerPromise).done { controller in + controller.showSettingsViewController() + } + } + private var headerView: some View { VStack { ZStack(alignment: .topTrailing) { @@ -151,6 +168,20 @@ struct ConnectionErrorDetailsView: View { } } + private var openSettingsButton: some View { + ActionLinkButton( + icon: Image(uiImage: MaterialDesignIcons.cogIcon.image( + ofSize: .init(width: 28, height: 28), + color: .label + )), + title: L10n.ConnectionError.OpenSettings.title, + tint: .init(uiColor: Asset.Colors.haPrimary.color) + ) { + openSettings() + } + .padding(.top) + } + private var documentationLink: some View { ExternalLinkButton( icon: Image(systemSymbol: .docTextFill), diff --git a/Sources/Extensions/Widgets/Custom/WidgetCustomTimelineProvider.swift b/Sources/Extensions/Widgets/Custom/WidgetCustomTimelineProvider.swift index cdbbfb1cc..372aadcb9 100644 --- a/Sources/Extensions/Widgets/Custom/WidgetCustomTimelineProvider.swift +++ b/Sources/Extensions/Widgets/Custom/WidgetCustomTimelineProvider.swift @@ -220,14 +220,14 @@ struct WidgetCustomAppIntent: AppIntent, WidgetConfigurationIntent { var widget: CustomWidgetEntity? @Parameter( - title: "Show last update time", + title: .init("widgets.custom.show_last_update_time.param.title", defaultValue: "Show last update time"), default: true ) var showLastUpdateTime: Bool @Parameter( - title: "Show states (BETA)", - default: false + title: .init("widgets.custom.show_states.param.title", defaultValue: "Show states (BETA)"), + default: true ) var showStates: Bool diff --git a/Sources/Shared/Resources/Swiftgen/Strings.swift b/Sources/Shared/Resources/Swiftgen/Strings.swift index 1b1daaa71..f7c13f346 100644 --- a/Sources/Shared/Resources/Swiftgen/Strings.swift +++ b/Sources/Shared/Resources/Swiftgen/Strings.swift @@ -865,6 +865,9 @@ public enum L10n { public enum AdvancedSection { /// Advanced public static var title: String { return L10n.tr("Localizable", "connection_error.advanced_section.title") } + public enum OpenSettings { + /// Open settings + public static var title: String { return L10n.tr("Localizable", "connection_error.open_settings.title") } } }