mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 08:09:41 +01:00
Update to accurately report if data was received during background fetch or not.
This commit is contained in:
parent
284e713a9d
commit
7392d6111a
@ -141,6 +141,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
|
||||
os_log("Woken to perform account refresh.", log: log, type: .info)
|
||||
|
||||
let startingUnreadCount = unreadCount
|
||||
let updateCompletionHandler = { [unowned self] in
|
||||
if startingUnreadCount != self.unreadCount {
|
||||
completionHandler(.newData)
|
||||
} else {
|
||||
completionHandler(.noData)
|
||||
}
|
||||
}
|
||||
|
||||
AccountManager.shared.refreshAll()
|
||||
|
||||
os_log("Accounts requested to begin refresh.", log: self.log, type: .debug)
|
||||
@ -150,7 +159,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
self.backgroundUpdateTask = UIApplication.shared.beginBackgroundTask {
|
||||
UIApplication.shared.endBackgroundTask(self.backgroundUpdateTask)
|
||||
self.backgroundUpdateTask = UIBackgroundTaskIdentifier.invalid
|
||||
completionHandler(.newData)
|
||||
updateCompletionHandler()
|
||||
}
|
||||
|
||||
sleep(1)
|
||||
@ -163,12 +172,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||
|
||||
UIApplication.shared.endBackgroundTask(self.backgroundUpdateTask)
|
||||
self.backgroundUpdateTask = UIBackgroundTaskIdentifier.invalid
|
||||
completionHandler(.newData)
|
||||
updateCompletionHandler()
|
||||
|
||||
}
|
||||
|
||||
completionHandler(.newData)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Split view
|
||||
|
Loading…
Reference in New Issue
Block a user