swiftui-multiplatform/macOS/Settings/MacPreferencesView.swift
Angelo Stavrow 93c016268a
Add error handling to iOS post editor (#210) (#214)
* Add error handling to post editor

* Cleanup

* Add error handling to macOS (#211)

* Add error handling to Mac app

* Log fatal errors and present alert on next launch (#212)

* Log fatal crashes and present alert on next launch

* Update crash alert copy and navigate to help forum

* Refactor logging into reuseable methods

* Refactor class to use protocol

* Clean up todo comment

* Revert "Log fatal errors and present alert on next launch (#212)"

This reverts commit 7475b57772.
2022-07-28 07:38:19 -04:00

32 lines
877 B
Swift

import SwiftUI
struct MacPreferencesView: View {
@EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
@ObservedObject var preferences: PreferencesModel
var body: some View {
VStack {
PreferencesView(preferences: preferences)
Spacer()
}
.onChange(of: model.hasError) { value in
if value {
if let error = model.currentError {
self.errorHandling.handle(error: error)
} else {
self.errorHandling.handle(error: AppError.genericError())
}
model.hasError = false
}
}
}
}
struct MacPreferencesView_Previews: PreviewProvider {
static var previews: some View {
MacPreferencesView(preferences: PreferencesModel())
}
}