Revert "Add error handling to Mac app"

This reverts commit b1a8b8b29c.
This commit is contained in:
Angelo Stavrow 2022-05-31 07:36:43 -04:00
parent b1a8b8b29c
commit fd37a163b9
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
5 changed files with 2 additions and 51 deletions

View File

@ -115,7 +115,6 @@ struct WriteFreely_MultiPlatformApp: App {
}
.tag(2)
}
.withErrorHandling()
.frame(minWidth: 500, maxWidth: 500, minHeight: 200)
.padding()
// .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info.

View File

@ -2,7 +2,6 @@ import SwiftUI
struct PostEditorView: View {
@EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
@ObservedObject var post: WFAPost
@State private var isHovering: Bool = false
@ -39,16 +38,6 @@ struct PostEditorView: View {
LocalStorageManager.standard.saveContext()
}
})
.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
}
}
.onDisappear(perform: {
DispatchQueue.main.async {
model.editor.clearLastDraft()

View File

@ -2,22 +2,11 @@ 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
}
}
}
}

View File

@ -1,9 +1,6 @@
import SwiftUI
struct MacPreferencesView: View {
@EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
@ObservedObject var preferences: PreferencesModel
var body: some View {
@ -11,16 +8,6 @@ struct MacPreferencesView: View {
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
}
}
}
}

View File

@ -2,9 +2,6 @@ import SwiftUI
import Sparkle
struct MacUpdatesView: View {
@EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
@ObservedObject var updaterViewModel: MacUpdatesViewModel
@AppStorage(WFDefaults.automaticallyChecksForUpdates, store: UserDefaults.shared)
@ -84,16 +81,6 @@ that can cause crashes and data loss.
.onChange(of: subscribeToBetaUpdates) { _ in
updaterViewModel.toggleAllowedChannels()
}
.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
}
}
}
}