Wait until statuses have finished syncing before allowing the application to quit. Fixes #2718

This commit is contained in:
Maurice Parker 2021-01-09 17:58:51 -06:00
parent fa3d76d034
commit 7264ea996b
1 changed files with 8 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
}
}
var isShutDownSyncDone = false
@IBOutlet var debugMenuItem: NSMenuItem!
@IBOutlet var sortByOldestArticleOnTopMenuItem: NSMenuItem!
@IBOutlet var sortByNewestArticleOnTopMenuItem: NSMenuItem!
@ -310,6 +312,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
func applicationWillTerminate(_ notification: Notification) {
shuttingDown = true
saveState()
AccountManager.shared.syncArticleStatusAll() {
self.isShutDownSyncDone = true
}
while !isShutDownSyncDone && RunLoop.current.run(mode: .default, before: .distantFuture) { }
}
// MARK: Notifications