diff --git a/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift b/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift index 70a8635dcb..a9621934d3 100644 --- a/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift +++ b/DuckDuckGo/SyncSettingsViewController+SyncDelegate.swift @@ -190,6 +190,9 @@ extension SyncSettingsViewController: SyncManagementViewModelDelegate { preferredStyle: .alert) alertController.addAction(title: UserText.syncAlertSwitchAccountButton, style: .default) { [weak self] in self?.switchAccounts(recoveryKey: recoveryKey) + Task { + await self?.switchAccounts(recoveryKey: recoveryKey) + } } alertController.addAction(title: UserText.actionCancel, style: .cancel) // Gives time to the is syncing view to appear @@ -200,7 +203,7 @@ extension SyncSettingsViewController: SyncManagementViewModelDelegate { } } - func switchAccounts(recoveryKey: SyncCode.RecoveryKey) { + func switchAccounts(recoveryKey: SyncCode.RecoveryKey) async { Task { [weak self] in do { try await self?.syncService.disconnect() diff --git a/DuckDuckGo/SyncSettingsViewController.swift b/DuckDuckGo/SyncSettingsViewController.swift index 09104e42c7..d34e57c182 100644 --- a/DuckDuckGo/SyncSettingsViewController.swift +++ b/DuckDuckGo/SyncSettingsViewController.swift @@ -364,7 +364,7 @@ extension SyncSettingsViewController: ScanOrPasteCodeViewModelDelegate { if rootView.model.devices.count > 1 { promptToSwitchAccounts(recoveryKey: recoveryKey) } else { - switchAccounts(recoveryKey: recoveryKey) + await switchAccounts(recoveryKey: recoveryKey) } } else { handleError(.unableToSyncToServer, error: error, event: .syncLoginError)