Move error handling to SceneNavigationView

This commit is contained in:
Maurice Parker
2020-07-15 20:06:29 -05:00
parent cf233f4825
commit e34dbd48ee
3 changed files with 18 additions and 8 deletions

View File

@@ -14,12 +14,10 @@ struct SidebarView: View {
// I had to comment out SceneStorage because it blows up if used on macOS
// @SceneStorage("expandedContainers") private var expandedContainerData = Data()
@StateObject private var expandedContainers = SidebarExpandedContainers()
@EnvironmentObject private var sceneModel: SceneModel
@EnvironmentObject private var sidebarModel: SidebarModel
@State var navigate = false
@State var refreshErrorMessage = ""
@State var showRefreshError: Bool = false
private let threshold: CGFloat = 80
@State private var previousScrollOffset: CGFloat = 0
@State private var scrollOffset: CGFloat = 0
@@ -71,9 +69,6 @@ struct SidebarView: View {
ProgressView().offset(y: -40)
}
}
.alert(isPresented: $showRefreshError) {
Alert(title: Text("Account Error"), message: Text(verbatim: refreshErrorMessage), dismissButton: .default(Text("OK")))
}
#endif
// .onAppear {
// expandedContainers.data = expandedContainerData
@@ -106,8 +101,7 @@ struct SidebarView: View {
}
func handleRefreshError(_ error: Error) {
refreshErrorMessage = error.localizedDescription
showRefreshError = true
sceneModel.accountErrorMessage = error.localizedDescription
}
struct RefreshFixedView: View {