From d870c4ffb3c9f028f39c28bc258c77c9a1400413 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Sat, 14 Dec 2019 15:44:57 -0700 Subject: [PATCH] Suspend system activity in extensions. Issue #1427 --- iOS/Intents/AddWebFeedIntentHandler.swift | 2 ++ iOS/ShareExtension/ShareViewController.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/iOS/Intents/AddWebFeedIntentHandler.swift b/iOS/Intents/AddWebFeedIntentHandler.swift index 196e6735c..350e80156 100644 --- a/iOS/Intents/AddWebFeedIntentHandler.swift +++ b/iOS/Intents/AddWebFeedIntentHandler.swift @@ -116,6 +116,8 @@ public class AddWebFeedIntentHandler: NSObject, AddWebFeedIntentHandling { validAccount.createWebFeed(url: url.absoluteString, name: nil, container: validContainer) { result in switch result { case .success: + AccountManager.shared.suspendNetworkAll() + AccountManager.shared.suspendDatabaseAll() completion(AddWebFeedIntentResponse(code: .success, userActivity: nil)) case .failure(let error): switch error { diff --git a/iOS/ShareExtension/ShareViewController.swift b/iOS/ShareExtension/ShareViewController.swift index 8f2abcb2e..684b8cacb 100644 --- a/iOS/ShareExtension/ShareViewController.swift +++ b/iOS/ShareExtension/ShareViewController.swift @@ -114,6 +114,8 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont switch result { case .success: account!.save() + AccountManager.shared.suspendNetworkAll() + AccountManager.shared.suspendDatabaseAll() self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) case .failure(let error): self.presentError(error) {