mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Cancel network activity when told to shutdown by the OS. Issue #1232
This commit is contained in:
@@ -109,6 +109,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
shuttingDown = true
|
||||
AccountManager.shared.suspendAll()
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
@@ -243,7 +244,7 @@ private extension AppDelegate {
|
||||
|
||||
func waitForProgressToFinish() {
|
||||
let completeProcessing = { [unowned self] in
|
||||
AccountManager.shared.saveAll()
|
||||
AccountManager.shared.suspendAll()
|
||||
UIApplication.shared.endBackgroundTask(self.waitBackgroundUpdateTask)
|
||||
self.waitBackgroundUpdateTask = UIBackgroundTaskIdentifier.invalid
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ struct ErrorHandler {
|
||||
|
||||
public static func present(_ viewController: UIViewController) -> (Error) -> () {
|
||||
return { [weak viewController] error in
|
||||
viewController?.presentError(error)
|
||||
if UIApplication.shared.applicationState == .active {
|
||||
viewController?.presentError(error)
|
||||
} else {
|
||||
ErrorHandler.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user