Skip to content

Commit

Permalink
Use remote flag for SDK-less Google sign in in production
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Mar 22, 2023
1 parent 1d88de9 commit e91ca3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
10 changes: 9 additions & 1 deletion WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,15 @@ enum FeatureFlag: Int, CaseIterable, OverrideableFlag {
case .readerUserBlocking:
return true
case .sdkLessGoogleSignIn:
return true
switch BuildConfiguration.current {
case .appStore:
// This flag has a remote counterpart that should take precendence.
// But if that doesn't happen, we play it safe and stick with the SDK in production.
return false
case _:
// While using internal builds, leave it on by default
return true
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ extension WordPressAuthenticationManager {
// Ref https://github.com/wordpress-mobile/WordPress-iOS/pull/12332#issuecomment-521994963
let enableSignInWithApple = !(BuildConfiguration.current ~= [.a8cBranchTest, .a8cPrereleaseTesting])

let googleLogingWithoutSDK: Bool = {
switch BuildConfiguration.current {
case .appStore:
// Rely on the remote flag in production
return RemoteFeatureFlagStore().value(for: FeatureFlag.sdkLessGoogleSignIn)
case _:
// Do whatever is hardcoded or overridden on device in non-production builds
return FeatureFlag.sdkLessGoogleSignIn.enabled
}
}()

return WordPressAuthenticatorConfiguration(wpcomClientId: ApiCredentials.client,
wpcomSecret: ApiCredentials.secret,
wpcomScheme: WPComScheme,
Expand All @@ -76,7 +87,7 @@ extension WordPressAuthenticationManager {
enableUnifiedAuth: true,
enableUnifiedCarousel: FeatureFlag.unifiedPrologueCarousel.enabled,
enableSocialLogin: true,
googleLoginWithoutSDK: FeatureFlag.sdkLessGoogleSignIn.enabled)
googleLoginWithoutSDK: googleLogingWithoutSDK)
}

private func authenticatorStyle() -> WordPressAuthenticatorStyle {
Expand Down

0 comments on commit e91ca3c

Please sign in to comment.