Skip to content

Commit de371a6

Browse files
authored
Refactor AppDatabaseUpdater for per-server updates (#4224)
1 parent f7780f6 commit de371a6

File tree

4 files changed

+249
-59
lines changed

4 files changed

+249
-59
lines changed

Sources/App/Scenes/WebViewSceneDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ final class WebViewSceneDelegate: NSObject, UIWindowSceneDelegate {
178178
Current.modelManager.subscribe(isAppInForeground: {
179179
UIApplication.shared.applicationState == .active
180180
})
181-
182-
await Current.appDatabaseUpdater.update()
183-
Current.panelsUpdater.update()
184181
}
185182

186183
/// Force update location when user opens the app

Sources/App/Settings/Settings/SettingsView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ struct SettingsView: View {
2222
.onAppear {
2323
appDatabaseUpdaterTask?.cancel()
2424
appDatabaseUpdaterTask = Task {
25-
await Current.appDatabaseUpdater.update()
25+
for server in Current.servers.all {
26+
await Current.appDatabaseUpdater.update(server: server)
27+
}
2628
}
2729
}
2830
}

Sources/App/WebView/WebViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ final class WebViewController: UIViewController, WKNavigationDelegate, WKUIDeleg
740740
DispatchQueue.main.async { [self] in
741741
loadActiveURLIfNeeded()
742742
}
743+
744+
Task {
745+
await Current.appDatabaseUpdater.update(server: server)
746+
Current.panelsUpdater.update()
747+
}
743748
}
744749

745750
private func showNoActiveURLError() {

0 commit comments

Comments
 (0)