swiftui-multiplatform/macOS/Settings/MacAccountView.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

30 lines
779 B
Swift

import SwiftUI
struct MacAccountView: View {
@EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
var body: some View {
Form {
AccountView()
}
.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 MacAccountView_Previews: PreviewProvider {
static var previews: some View {
MacAccountView()
.environmentObject(WriteFreelyModel())
}
}