Skip to content

Commit

Permalink
MBL-1158: Add feature flag for logging in with OAuth (#1928)
Browse files Browse the repository at this point in the history
* MBL-1158: Add feature flag for logging in with OAuth

* Fix failure in RemoteConfigFeatureFlagToolsViewModelTests
  • Loading branch information
amy-at-kickstarter committed Feb 5, 2024
1 parent 9a7c871 commit c1f77f0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Library/RemoteConfig/RemoteConfigFeature+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ public func featurePostCampaignPledgeEnabled() -> Bool {
public func featureReportThisProjectEnabled() -> Bool {
featureEnabled(feature: .reportThisProjectEnabled)
}

public func featureLoginWithOAuthEnabled() -> Bool {
featureEnabled(feature: .loginWithOAuthEnabled)
}
16 changes: 16 additions & 0 deletions Library/RemoteConfig/RemoteConfigFeature+HelpersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,20 @@ final class RemoteConfigFeatureHelpersTests: TestCase {
whenRemoteConfigFeatureIsFalse: .reportThisProjectEnabled
)
}

func testLoginWithOAuth_RemoteConfig_FeatureFlag_True() {
self
.assert(
featureFlagIsTrue: featureLoginWithOAuthEnabled,
whenRemoteConfigFeatureIsTrue: .loginWithOAuthEnabled
)
}

func testLoginWithOAuth_RemoteConfig_FeatureFlag_False() {
self
.assert(
featureFlagIsFalse: featureLoginWithOAuthEnabled,
whenRemoteConfigFeatureIsFalse: .loginWithOAuthEnabled
)
}
}
2 changes: 2 additions & 0 deletions Library/RemoteConfig/RemoteConfigFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public enum RemoteConfigFeature: String, CaseIterable {
case facebookLoginInterstitialEnabled = "facebook_interstitial"
case postCampaignPledgeEnabled = "post_campaign_pledge"
case reportThisProjectEnabled = "report_this_project"
case loginWithOAuthEnabled = "ios_oauth"
}

extension RemoteConfigFeature: CustomStringConvertible {
Expand All @@ -18,6 +19,7 @@ extension RemoteConfigFeature: CustomStringConvertible {
case .facebookLoginInterstitialEnabled: return "Facebook Login Interstitial"
case .postCampaignPledgeEnabled: return "Post Campaign Pledging"
case .reportThisProjectEnabled: return "Report This Project"
case .loginWithOAuthEnabled: return "Login with OAuth"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private func isFeatureEnabled(_ feature: RemoteConfigFeature) -> Bool {
return featurePostCampaignPledgeEnabled()
case .reportThisProjectEnabled:
return featureReportThisProjectEnabled()
case .loginWithOAuthEnabled:
return featureLoginWithOAuthEnabled()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
RemoteConfigFeature.darkModeEnabled.rawValue: true,
RemoteConfigFeature.facebookLoginInterstitialEnabled.rawValue: true,
RemoteConfigFeature.postCampaignPledgeEnabled.rawValue: true,
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true,
RemoteConfigFeature.loginWithOAuthEnabled.rawValue: true
]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
Expand All @@ -51,7 +52,8 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
RemoteConfigFeature.darkModeEnabled.rawValue: false,
RemoteConfigFeature.facebookLoginInterstitialEnabled.rawValue: true,
RemoteConfigFeature.postCampaignPledgeEnabled.rawValue: false,
RemoteConfigFeature.reportThisProjectEnabled.rawValue: false
RemoteConfigFeature.reportThisProjectEnabled.rawValue: false,
RemoteConfigFeature.loginWithOAuthEnabled.rawValue: true
]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
Expand Down

0 comments on commit c1f77f0

Please sign in to comment.