mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
93c016268a
* 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
.
32 lines
877 B
Swift
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())
|
|
}
|
|
}
|