diff --git a/Sources/App/Resources/en.lproj/Localizable.strings b/Sources/App/Resources/en.lproj/Localizable.strings index a9cfed193..33939509d 100644 --- a/Sources/App/Resources/en.lproj/Localizable.strings +++ b/Sources/App/Resources/en.lproj/Localizable.strings @@ -1170,4 +1170,5 @@ Home Assistant is free and open source home automation software with a focus on "widgets.sensors.description" = "Display state of sensors"; "widgets.sensors.not_configured" = "No Sensors Configured"; "widgets.sensors.title" = "Sensors"; -"yes_label" = "Yes"; \ No newline at end of file +"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 a6f6294b4..8b3623298 100644 --- a/Sources/App/WebView/ConnectionErrorDetailsView.swift +++ b/Sources/App/WebView/ConnectionErrorDetailsView.swift @@ -48,6 +48,7 @@ struct ConnectionErrorDetailsView: View { } } } + openSettingsButton CollapsibleView { Text("Advanced") .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/Shared/Resources/Swiftgen/Strings.swift b/Sources/Shared/Resources/Swiftgen/Strings.swift index 357584621..c0dbbd4e9 100644 --- a/Sources/Shared/Resources/Swiftgen/Strings.swift +++ b/Sources/Shared/Resources/Swiftgen/Strings.swift @@ -847,6 +847,13 @@ public enum L10n { } } + public enum ConnectionError { + public enum OpenSettings { + /// Open settings + public static var title: String { return L10n.tr("Localizable", "connection_error.open_settings.title") } + } + } + public enum Database { public enum Problem { /// Delete Database & Quit App