Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MBL-1158: Add feature flag for logging in with OAuth #1928

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
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"
Copy link
Contributor Author

@amy-at-kickstarter amy-at-kickstarter Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called "android_oauth" on Android, so just keeping it parallel

}

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