From def48546a30282c5a39bffdd660c3b1890b36db7 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 1 Apr 2020 16:45:29 -0500 Subject: [PATCH] Change how initial refresh is triggered. --- Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift | 5 +++++ .../Accounts/AccountsAddCloudKitWindowController.swift | 3 +-- iOS/Account/CloudKitAccountViewController.swift | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift b/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift index 8dce7e1ed..c6bd7d04d 100644 --- a/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift +++ b/Frameworks/Account/CloudKit/CloudKitAccountDelegate.swift @@ -421,6 +421,11 @@ final class CloudKitAccountDelegate: AccountDelegate { switch result { case .success(let externalID): account.externalID = externalID + self.refreshAll(for: account) { result in + if case .failure(let error) = result { + os_log(.error, log: self.log, "Error while doing intial refresh: %@", error.localizedDescription) + } + } case .failure(let error): os_log(.error, log: self.log, "Error adding account container: %@", error.localizedDescription) } diff --git a/Mac/Preferences/Accounts/AccountsAddCloudKitWindowController.swift b/Mac/Preferences/Accounts/AccountsAddCloudKitWindowController.swift index 3ce698537..5d0e3202f 100644 --- a/Mac/Preferences/Accounts/AccountsAddCloudKitWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsAddCloudKitWindowController.swift @@ -35,8 +35,7 @@ class AccountsAddCloudKitWindowController: NSWindowController { } @IBAction func create(_ sender: Any) { - let account = AccountManager.shared.createAccount(type: .cloudKit) - account.refreshAll(completion: { _ in }) + let _ = AccountManager.shared.createAccount(type: .cloudKit) hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK) } diff --git a/iOS/Account/CloudKitAccountViewController.swift b/iOS/Account/CloudKitAccountViewController.swift index 9c026143a..a72f8203f 100644 --- a/iOS/Account/CloudKitAccountViewController.swift +++ b/iOS/Account/CloudKitAccountViewController.swift @@ -25,8 +25,7 @@ class CloudKitAccountViewController: UITableViewController { } @IBAction func add(_ sender: Any) { - let account = AccountManager.shared.createAccount(type: .cloudKit) - account.refreshAll(completion: { _ in }) + let _ = AccountManager.shared.createAccount(type: .cloudKit) dismiss(animated: true, completion: nil) delegate?.dismiss() }