mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
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:
parent
8a288ffe5f
commit
4689b5325f
2 changed files with 12 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ struct InnerRootView: View {
|
|||
@ObservedObject var viewModel: RootViewModel
|
||||
|
||||
@ViewBuilder private var innerBody: some View {
|
||||
if authenticator.isLoggedIn {
|
||||
if authenticator.isLoggedIn, dataService.appEnvironment.environmentConfigured {
|
||||
PrimaryContentView()
|
||||
.task {
|
||||
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 {
|
||||
"\(serverBaseURL.absoluteString)/api/graphql"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue