Skip to content

Commit

Permalink
Suppressed boring error message popup on Apple Watch (#723)
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Bert <[email protected]>
Co-authored-by: Tim Bert <[email protected]>
  • Loading branch information
dhermanns and timbms authored Nov 22, 2023
1 parent a0e0cbc commit 8a072c3
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions openHABWatch Extension/Views/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,41 @@ struct ContentView: View {
@State var title = "openHAB"

var body: some View {
ScrollView {
ForEach(viewModel.widgets) { widget in
rowWidget(widget: widget)
.environmentObject(settings)
}
}
.navigationBarTitle(Text(title))
.alert(isPresented: $viewModel.showAlert) {
Alert(
title: Text(NSLocalizedString("error", comment: "")),
message: Text(viewModel.errorDescription),
dismissButton: .default(Text(NSLocalizedString("retry", comment: ""))) {
DispatchQueue.main.async {
viewModel.refreshUrl()
os_log("reload after alert", log: .default, type: .info)
}
ZStack {
ScrollView {
ForEach(viewModel.widgets) { widget in
self.rowWidget(widget: widget)
.environmentObject(self.settings)
}
)
}
.actionSheet(isPresented: $viewModel.showCertificateAlert) {
ActionSheet(
title: Text(NSLocalizedString("warning", comment: "")),
message: Text(viewModel.certificateErrorDescription),
buttons: [
.default(Text(NSLocalizedString("abort", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .deny
},
.default(Text(NSLocalizedString("once", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .permitOnce
},
.default(Text(NSLocalizedString("always", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .permitAlways
}
.navigationBarTitle(Text(title))
.actionSheet(isPresented: $viewModel.showCertificateAlert) {
ActionSheet(
title: Text(NSLocalizedString("warning", comment: "")),
message: Text(viewModel.certificateErrorDescription),
buttons: [
.default(Text(NSLocalizedString("abort", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .deny
},
.default(Text(NSLocalizedString("once", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .permitOnce
},
.default(Text(NSLocalizedString("always", comment: ""))) {
NetworkConnection.shared.serverCertificateManager.evaluateResult = .permitAlways
}
]
)
}
if viewModel.showAlert {
Text("Refreshing...")
.onAppear {
DispatchQueue.main.async {
self.viewModel.refreshUrl()
os_log("reload after alert", log: .default, type: .info)
}
viewModel.showAlert = false
}
]
)
}
}
}

Expand Down

0 comments on commit 8a072c3

Please sign in to comment.