Change the share extension to do the web feed add in the background after the dialog dismisses. Issue #1561

This commit is contained in:
Maurice Parker 2020-01-08 17:46:22 -07:00
parent 49549066ac
commit a5cc892464
1 changed files with 10 additions and 12 deletions

View File

@ -112,21 +112,19 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
let feedName = contentText.isEmpty ? nil : contentText
account!.createWebFeed(url: url!.absoluteString, name: feedName, container: container!) { result in
ProcessInfo.processInfo.performExpiringActivity(withReason: "Adding web feed to account.") { expired in
guard !expired else { return }
switch result {
case .success:
DispatchQueue.main.async {
account!.createWebFeed(url: self.url!.absoluteString, name: feedName, container: self.container!) { result in
account!.save()
AccountManager.shared.suspendNetworkAll()
AccountManager.shared.suspendDatabaseAll()
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
case .failure(let error):
self.presentError(error) {
self.extensionContext!.cancelRequest(withError: error)
}
}
}
}
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
}
func shareFolderPickerDidSelect(_ container: Container) {