From a0e6508f498e5c43993aab793384e6d7abc99ff9 Mon Sep 17 00:00:00 2001 From: Nishant Bhasin Date: Thu, 14 Dec 2023 11:38:52 -0500 Subject: [PATCH] Refactor FXIOS-7324 [v121.1] Add missing credit card option for FxA syncing in the choose what to sync list (#17678) * Refactor FXIOS-7324 [v121] Add missing credit card option for FxA syncing in the choose what to sync list * Added credit card feature flag as part of it as well (cherry picked from commit 813fa6323b33c68b236525656a504c185a33a5fc) --- RustFxA/FxAWebViewModel.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RustFxA/FxAWebViewModel.swift b/RustFxA/FxAWebViewModel.swift index 62fa202efba3..50fb41ca4af5 100644 --- a/RustFxA/FxAWebViewModel.swift +++ b/RustFxA/FxAWebViewModel.swift @@ -28,7 +28,7 @@ private enum RemoteCommand: String { case profileChanged = "profile:change" } -class FxAWebViewModel { +class FxAWebViewModel: FeatureFlaggable { fileprivate let pageType: FxAPageType fileprivate let profile: Profile fileprivate var deepLinkParams: FxALaunchParams @@ -205,6 +205,8 @@ extension FxAWebViewModel { /// user info (for settings), or by passing CWTS setup info (in case the user is /// signing up for an account). This latter case is also used for the sign-in state. private func onSessionStatus(id: Int, webView: WKWebView) { + let autofillCreditCardStatus = featureFlags.isFeatureEnabled(.creditCardAutofillStatus, checking: .buildOnly) + let creditCardCapability = autofillCreditCardStatus ? ", \"creditcards\"" : "" guard let fxa = profile.rustFxA.accountManager else { return } let cmd = "fxaccounts:fxa_status" let typeId = "account_updates" @@ -229,7 +231,7 @@ extension FxAWebViewModel { case .emailLoginFlow, .qrCode: data = """ { capabilities: - { choose_what_to_sync: true, engines: ["bookmarks", "history", "tabs", "passwords"] }, + { choose_what_to_sync: true, engines: ["bookmarks", "history", "tabs", "passwords"\(creditCardCapability)] }, } """ }