Skip to content

Commit

Permalink
MBL-904: Remove feature flag for tab "Use of AI"
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-at-kickstarter committed Jan 17, 2024
1 parent e64ceaa commit ebb41ad
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 41 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions Library/RemoteConfig/RemoteConfigFeature+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,3 @@ public func featureReportThisProjectEnabled() -> Bool {
(AppEnvironment.current.remoteConfigClient?
.isFeatureEnabled(featureKey: RemoteConfigFeature.reportThisProjectEnabled) ?? false)
}

public func featureUseOfAIProjectTabEnabled() -> Bool {
return AppEnvironment.current.userDefaults
.remoteConfigFeatureFlags[RemoteConfigFeature.useOfAIProjectTab.rawValue] ??
(AppEnvironment.current.remoteConfigClient?
.isFeatureEnabled(featureKey: RemoteConfigFeature.useOfAIProjectTab) ?? false)
}
18 changes: 0 additions & 18 deletions Library/RemoteConfig/RemoteConfigFeature+HelpersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,4 @@ final class RemoteConfigFeatureHelpersTests: TestCase {
XCTAssertFalse(featureReportThisProjectEnabled())
}
}

func testUseOfAIProjectTab_RemoteConfig_FeatureFlag_False() {
let mockRemoteConfigClient = MockRemoteConfigClient()
|> \.features .~ [RemoteConfigFeature.useOfAIProjectTab.rawValue: false]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
XCTAssertFalse(featureUseOfAIProjectTabEnabled())
}
}

func testUseOfAIProjectTab_RemoteConfig_FeatureFlag_True() {
let mockRemoteConfigClient = MockRemoteConfigClient()
|> \.features .~ [RemoteConfigFeature.useOfAIProjectTab.rawValue: true]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
XCTAssertTrue(featureUseOfAIProjectTabEnabled())
}
}
}
2 changes: 0 additions & 2 deletions Library/RemoteConfig/RemoteConfigFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ public enum RemoteConfigFeature: String, CaseIterable {
case darkModeEnabled = "dark_mode"
case facebookLoginInterstitialEnabled = "facebook_interstitial"
case reportThisProjectEnabled = "report_this_project"
case useOfAIProjectTab = "use_of_ai_project_tab"
}

extension RemoteConfigFeature: CustomStringConvertible {
Expand All @@ -17,7 +16,6 @@ extension RemoteConfigFeature: CustomStringConvertible {
case .darkModeEnabled: return "Dark Mode"
case .facebookLoginInterstitialEnabled: return "Facebook Login Interstitial"
case .reportThisProjectEnabled: return "Report This Project"
case .useOfAIProjectTab: return "Use of AI Project Tab"
}
}
}
3 changes: 1 addition & 2 deletions Library/ViewModels/ProjectNavigationSelectorViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public final class ProjectNavigationSelectorViewModel: ProjectNavigationSelector

var includeAIDisclosure = false

if let aiDisclosure = extendedProjectProperties
.aiDisclosure, aiDisclosure.involvesAi, featureUseOfAIProjectTabEnabled() {
if let aiDisclosure = extendedProjectProperties.aiDisclosure, aiDisclosure.involvesAi {
includeAIDisclosure = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ private func isFeatureEnabled(_ feature: RemoteConfigFeature) -> Bool {
return featureFacebookLoginInterstitialEnabled()
case .reportThisProjectEnabled:
return featureReportThisProjectEnabled()
case .useOfAIProjectTab:
return featureUseOfAIProjectTabEnabled()
}
}

Expand All @@ -119,9 +117,6 @@ private func getValueFromUserDefaults(for feature: RemoteConfigFeature) -> Bool?
case .reportThisProjectEnabled:
return AppEnvironment.current.userDefaults
.remoteConfigFeatureFlags[RemoteConfigFeature.reportThisProjectEnabled.rawValue]
case .useOfAIProjectTab:
return AppEnvironment.current.userDefaults
.remoteConfigFeatureFlags[RemoteConfigFeature.useOfAIProjectTab.rawValue]
}
}

Expand All @@ -144,8 +139,5 @@ private func setValueInUserDefaults(for feature: RemoteConfigFeature, and value:
case .reportThisProjectEnabled:
return AppEnvironment.current.userDefaults
.remoteConfigFeatureFlags[RemoteConfigFeature.reportThisProjectEnabled.rawValue] = value
case .useOfAIProjectTab:
return AppEnvironment.current.userDefaults
.remoteConfigFeatureFlags[RemoteConfigFeature.useOfAIProjectTab.rawValue] = value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
RemoteConfigFeature.consentManagementDialogEnabled.rawValue: true,
RemoteConfigFeature.darkModeEnabled.rawValue: true,
RemoteConfigFeature.facebookLoginInterstitialEnabled.rawValue: true,
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true,
RemoteConfigFeature.useOfAIProjectTab.rawValue: true
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true
]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
Expand All @@ -50,8 +49,7 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
RemoteConfigFeature.consentManagementDialogEnabled.rawValue: true,
RemoteConfigFeature.darkModeEnabled.rawValue: false,
RemoteConfigFeature.facebookLoginInterstitialEnabled.rawValue: true,
RemoteConfigFeature.reportThisProjectEnabled.rawValue: false,
RemoteConfigFeature.useOfAIProjectTab.rawValue: false
RemoteConfigFeature.reportThisProjectEnabled.rawValue: false
]

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
Expand Down

0 comments on commit ebb41ad

Please sign in to comment.