feat(globalSSO): Resurrect ExternalSSO feature flag.

Refs: https://gitlab.protontech.ch/apple/shared/protoncore/-/merge_requests/1951
This commit is contained in:
Erik Ackermann 2024-10-24 12:13:01 +00:00
commit 89b81f9700
4 changed files with 17 additions and 9 deletions

View file

@ -24,10 +24,10 @@ public enum CoreFeatureFlagType: String, FeatureFlagTypeProtocol {
case accountRecovery = "SignedInAccountRecovery"
case changePassword = "IOSChangePassword"
case dynamicPlan = "DynamicPlan"
case externalSSO = "ExternalSSO"
case fidoKeys = "FIDO2Mobile"
case pushNotifications = "PushNotifications"
case reportInvalidUnauthRequests = "ReportInvalidUnauthRequests"
case splitStorage = "SplitStorage"
case telemetrySignUpMetrics = "IOSTelemetrySignUpMetrics"
case globalSSODisabled = "GlobalSSODisabled"
}

View file

@ -98,8 +98,8 @@ final class LoginViewController: UIViewController, AccessibleView, Focusable, Pr
var focusNoMore: Bool = false
private let navigationBarAdjuster = NavigationBarAdjustingScrollViewDelegate()
private var webView: SSOViewController?
private var isVPN: Bool {
viewModel.clientApp == .vpn
private var isSSOEnabled: Bool {
FeatureFlagsRepository.shared.isEnabled(CoreFeatureFlagType.externalSSO, reloadValue: true)
}
override var preferredStatusBarStyle: UIStatusBarStyle { darkModeAwarePreferredStatusBarStyle() }
@ -182,7 +182,7 @@ final class LoginViewController: UIViewController, AccessibleView, Focusable, Pr
loginTextField.value = initialUsername ?? ""
signInWithSSOButton.isHidden = !isVPN
signInWithSSOButton.isHidden = !isSSOEnabled
signInWithSSOButton.setTitle(viewModel.signInWithSSOButtonTitle, for: .normal)
signInWithSSOButton.setMode(mode: .text)
signInWithSSOButton.addTarget(self, action: #selector(signInWithSSO), for: .touchUpInside)
@ -344,7 +344,7 @@ final class LoginViewController: UIViewController, AccessibleView, Focusable, Pr
return
}
guard (passwordTextField.isHidden == false && passwordValid) || isVPN else {
guard (passwordTextField.isHidden == false && passwordValid) || isSSOEnabled else {
return
}

View file

@ -49,13 +49,17 @@ class LoginUISnapshotTests: SnapshotTestCase {
}
func testSignInScreenWithSSO_withNav_iPhone12() {
let controller = loginViewController(for: .username, clientApp: .vpn)
checkSnapshots(controller: controller, device: .iPhone12, perceptualPrecision: defaultPrecision)
withFeatureFlags([.externalSSO]) {
let controller = loginViewController(for: .username, clientApp: .vpn)
checkSnapshots(controller: controller, device: .iPhone12, perceptualPrecision: defaultPrecision)
}
}
func testSignInScreenWithSSO_withNav_iPadMiniLandscape() {
let controller = loginViewController(for: .username, clientApp: .vpn)
checkSnapshots(controller: controller, device: .iPadMini(.landscape), perceptualPrecision: defaultPrecision)
withFeatureFlags([.externalSSO]) {
let controller = loginViewController(for: .username, clientApp: .vpn)
checkSnapshots(controller: controller, device: .iPadMini(.landscape), perceptualPrecision: defaultPrecision)
}
}
private func createHelpViewController(inAppTheme: InAppTheme = .default) -> UIViewController {

View file

@ -86,6 +86,10 @@ public extension ProtonCoreFeatureFlags.FeatureFlag {
.init(name: "DynamicPlan", enabled: true, variant: nil)
}
static var externalSSO: Self {
.init(name: "ExternalSSO", enabled: true, variant: nil)
}
static var fidoKeys: Self {
.init(name: "FIDO2Mobile", enabled: true, variant: nil)
}