diff --git a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift index ef5c78cff9e7..5f002b720a91 100644 --- a/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift +++ b/firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift @@ -2777,22 +2777,21 @@ class BrowserViewController: UIViewController, ) // Credit card sync telemetry - self.profile.hasSyncAccount { [unowned self] hasSync in - logger.log("User has sync account setup \(hasSync)", - level: .debug, - category: .setup) + let hasSync = self.profile.hasAccount() + logger.log("User has sync account setup \(hasSync)", + level: .debug, + category: .setup) - guard hasSync else { return } - let syncStatus = self.profile.syncManager.checkCreditCardEngineEnablement() - TelemetryWrapper.recordEvent( - category: .information, - method: .settings, - object: .creditCardSyncEnabled, - extras: [ - TelemetryWrapper.ExtraKey.isCreditCardSyncEnabled.rawValue: syncStatus - ] - ) - } + guard hasSync else { return } + let syncStatus = self.profile.syncManager.checkCreditCardEngineEnablement() + TelemetryWrapper.recordEvent( + category: .information, + method: .settings, + object: .creditCardSyncEnabled, + extras: [ + TelemetryWrapper.ExtraKey.isCreditCardSyncEnabled.rawValue: syncStatus + ] + ) } private func autofillCreditCardNimbusFeatureFlag() -> Bool { diff --git a/firefox-ios/Client/Frontend/Home/JumpBackIn/Data/JumpBackInDataAdaptor.swift b/firefox-ios/Client/Frontend/Home/JumpBackIn/Data/JumpBackInDataAdaptor.swift index 5321b6acd066..ebb473f45c26 100644 --- a/firefox-ios/Client/Frontend/Home/JumpBackIn/Data/JumpBackInDataAdaptor.swift +++ b/firefox-ios/Client/Frontend/Home/JumpBackIn/Data/JumpBackInDataAdaptor.swift @@ -89,7 +89,7 @@ actor JumpBackInDataAdaptorImplementation: JumpBackInDataAdaptor, FeatureFlaggab // MARK: Jump back in data private func updateTabsAndAccountData() async { - hasSyncAccount = await getHasSyncAccount() + hasSyncAccount = getHasSyncAccount() await updateTabsData() } @@ -124,12 +124,8 @@ actor JumpBackInDataAdaptorImplementation: JumpBackInDataAdaptor, FeatureFlaggab // MARK: Synced tab data - private func getHasSyncAccount() async -> Bool { - return await withCheckedContinuation { continuation in - profile.hasSyncAccount { hasSync in - continuation.resume(returning: hasSync) - } - } + private func getHasSyncAccount() -> Bool { + return profile.hasAccount() } private func updateRemoteTabs() async -> [ClientAndTabs]? { diff --git a/firefox-ios/Client/Frontend/Onboarding/Models/UpdateViewModel.swift b/firefox-ios/Client/Frontend/Onboarding/Models/UpdateViewModel.swift index 8553aa40eae6..5a44259f4056 100644 --- a/firefox-ios/Client/Frontend/Onboarding/Models/UpdateViewModel.swift +++ b/firefox-ios/Client/Frontend/Onboarding/Models/UpdateViewModel.swift @@ -74,21 +74,16 @@ class UpdateViewModel: OnboardingViewModelProtocol, // Function added to wait for AccountManager initialization to get // if the user is Sign in with Sync Account to decide which cards to show func hasSyncableAccount(completion: @escaping () -> Void) { - profile.hasSyncAccount { result in - self.hasSyncableAccount = result - ensureMainThread { - completion() - } + hasSyncableAccount = profile.hasAccount() + ensureMainThread { + completion() } } func hasSyncableAccount() async -> Bool { - return await withCheckedContinuation { continuation in - profile.hasSyncAccount { hasSync in - self.hasSyncableAccount = hasSync - continuation.resume(returning: hasSync) - } - } + let hasSync = profile.hasAccount() + hasSyncableAccount = hasSync + return hasSync } func setupViewControllerDelegates(with delegate: OnboardingCardDelegate, for window: WindowUUID) { diff --git a/firefox-ios/Providers/Profile.swift b/firefox-ios/Providers/Profile.swift index 52e665c9bd2d..6a3193cbf81e 100644 --- a/firefox-ios/Providers/Profile.swift +++ b/firefox-ios/Providers/Profile.swift @@ -116,9 +116,6 @@ protocol Profile: AnyObject { // func localName() -> String - // Async call to wait for result - func hasSyncAccount(completion: @escaping (Bool) -> Void) - // Do we have an account at all? func hasAccount() -> Bool @@ -696,12 +693,6 @@ open class BrowserProfile: Profile { } }() - func hasSyncAccount(completion: @escaping (Bool) -> Void) { - rustFxA.hasAccount { hasAccount in - completion(hasAccount) - } - } - func hasAccount() -> Bool { return rustFxA.hasAccount() } diff --git a/firefox-ios/RustFxA/RustFirefoxAccounts.swift b/firefox-ios/RustFxA/RustFirefoxAccounts.swift index b46def778817..a90e263e5029 100644 --- a/firefox-ios/RustFxA/RustFirefoxAccounts.swift +++ b/firefox-ios/RustFxA/RustFirefoxAccounts.swift @@ -259,12 +259,6 @@ open class RustFirefoxAccounts { cachedUserProfile = nil } - public func hasAccount(completion: @escaping (Bool) -> Void) { - if let manager = RustFirefoxAccounts.shared.accountManager { - completion(manager.hasAccount()) - } - } - public func hasAccount() -> Bool { guard let accountManager = RustFirefoxAccounts.shared.accountManager else { return false } return accountManager.hasAccount()