Ensure app environment is configured
This can happen if a user sets a custom self hosting environment, then deletes and re-installs the app.
This commit is contained in:
@ -49,7 +49,7 @@ struct InnerRootView: View {
|
|||||||
@ObservedObject var viewModel: RootViewModel
|
@ObservedObject var viewModel: RootViewModel
|
||||||
|
|
||||||
@ViewBuilder private var innerBody: some View {
|
@ViewBuilder private var innerBody: some View {
|
||||||
if authenticator.isLoggedIn {
|
if authenticator.isLoggedIn, dataService.appEnvironment.environmentConfigured {
|
||||||
PrimaryContentView()
|
PrimaryContentView()
|
||||||
.task {
|
.task {
|
||||||
try? await dataService.syncOfflineItemsWithServerIfNeeded()
|
try? await dataService.syncOfflineItemsWithServerIfNeeded()
|
||||||
|
|||||||
@ -54,6 +54,17 @@ public extension AppEnvironment {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var environmentConfigured: Bool {
|
||||||
|
if self == .custom {
|
||||||
|
if let str = UserDefaults.standard.string(forKey: AppEnvironmentUserDefaultKey.webAppBaseURL.rawValue), let url = URL(string: str) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
var graphqlPath: String {
|
var graphqlPath: String {
|
||||||
"\(serverBaseURL.absoluteString)/api/graphql"
|
"\(serverBaseURL.absoluteString)/api/graphql"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user