diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/ApplicationPasswordsExperimentState.swift b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/ApplicationPasswordsExperimentState.swift index f4b36b04fe3..a1670485039 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/ApplicationPasswordsExperimentState.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/Settings/Beta features/ApplicationPasswordsExperimentState.swift @@ -10,6 +10,14 @@ final class ApplicationPasswordsExperimentState { private var experimentalFlagSubscription: AnyCancellable? + private static let isSupportSession: Bool = { + #if DEBUG + return ProcessInfo.processInfo.arguments.contains("-support-session") + #else + return false + #endif + }() + init( stores: StoresManager = ServiceLocator.stores, availabilityChecker: ApplicationPasswordsExperimentAvailabilityCheckerProtocol = ApplicationPasswordsExperimentAvailabilityChecker(), @@ -26,6 +34,9 @@ final class ApplicationPasswordsExperimentState { @MainActor private var isEnabled: Bool { get async { + guard !Self.isSupportSession else { + return false + } return await withCheckedContinuation { continuation in stores.dispatch( AppSettingsAction.getAppPasswordsExperimentSettingState { isOn in diff --git a/WooCommerce/WooCommerce.xcodeproj/xcshareddata/xcschemes/WooCommerce.xcscheme b/WooCommerce/WooCommerce.xcodeproj/xcshareddata/xcschemes/WooCommerce.xcscheme index 6701467249d..7a31919c6f2 100644 --- a/WooCommerce/WooCommerce.xcodeproj/xcshareddata/xcschemes/WooCommerce.xcscheme +++ b/WooCommerce/WooCommerce.xcodeproj/xcshareddata/xcschemes/WooCommerce.xcscheme @@ -138,6 +138,10 @@ argument = "-enforce-core-data-write-in-background" isEnabled = "YES"> + + diff --git a/WooCommerce/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift b/WooCommerce/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift index bdee916c36c..0dd289032c8 100644 --- a/WooCommerce/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift +++ b/WooCommerce/WordPressAuthenticator/Unified Auth/View Related/Get Started/GetStartedViewController.swift @@ -136,6 +136,14 @@ class GetStartedViewController: LoginViewController, NUXKeyboardResponder { } } + private static let isSupportSession: Bool = { + #if DEBUG + return ProcessInfo.processInfo.arguments.contains("-support-session") + #else + return false + #endif + }() + // MARK: - View override func viewDidLoad() { @@ -517,22 +525,29 @@ private extension GetStartedViewController { configureViewLoading(true) let service = WordPressComAccountService() - service.isPasswordlessAccount(username: loginFields.username, - success: { [weak self] passwordless in - self?.configureViewLoading(false) - self?.loginFields.meta.passwordless = passwordless - passwordless ? self?.requestAuthenticationLink() : self?.showPasswordOrMagicLinkView() + service.isPasswordlessAccount( + username: loginFields.username, + success: { [weak self] passwordless in + guard let self else { return } + configureViewLoading(false) + loginFields.meta.passwordless = passwordless + if Self.isSupportSession { + /// Always show password view when running in support session + showPasswordView() + } else { + passwordless ? requestAuthenticationLink() : showPasswordOrMagicLinkView() + } }, - failure: { [weak self] error in - WordPressAuthenticator.track(.loginFailed, error: error) - WPAuthenticatorLogError(error.localizedDescription) - guard let self = self else { - return - } - self.configureViewLoading(false) - - self.handleLoginError(error) - }) + failure: { [weak self] error in + WordPressAuthenticator.track(.loginFailed, error: error) + WPAuthenticatorLogError(error.localizedDescription) + guard let self = self else { + return + } + self.configureViewLoading(false) + self.handleLoginError(error) + } + ) } /// Show the Password entry view. @@ -583,7 +598,11 @@ private extension GetStartedViewController { // email address is flagged as suspicious. // Take the user to the magic link request screen to verify their email. self.tracker.track(failure: error.localizedDescription) - self.showMagicLinkRequestScreen() + if Self.isSupportSession { + showPasswordView() + } else { + showMagicLinkRequestScreen() + } } else { let signInError = SignInError(error: error, source: source) ?? error guard let authenticationDelegate = WordPressAuthenticator.shared.delegate,