Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBL-904: Remove feature flag for tab "Use of AI" #1914

Merged
merged 3 commits into from
Jan 23, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -41,10 +41,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 @@ -110,22 +110,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 @@ -7,7 +7,6 @@ public enum RemoteConfigFeature: String, CaseIterable {
case facebookLoginInterstitialEnabled = "facebook_interstitial"
case postCampaignPledgeEnabled = "post_campaign_pledge"
case reportThisProjectEnabled = "report_this_project"
case useOfAIProjectTab = "use_of_ai_project_tab"
}

extension RemoteConfigFeature: CustomStringConvertible {
Expand All @@ -19,7 +18,6 @@ extension RemoteConfigFeature: CustomStringConvertible {
case .facebookLoginInterstitialEnabled: return "Facebook Login Interstitial"
case .postCampaignPledgeEnabled: return "Post Campaign Pledging"
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 @@ -97,8 +97,6 @@ private func isFeatureEnabled(_ feature: RemoteConfigFeature) -> Bool {
return featurePostCampaignPledgeEnabled()
case .reportThisProjectEnabled:
return featureReportThisProjectEnabled()
case .useOfAIProjectTab:
return featureUseOfAIProjectTabEnabled()
}
}

Expand All @@ -124,9 +122,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 @@ -152,8 +147,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 @@ -27,8 +27,7 @@ final class RemoteConfigFlagToolsViewModelTests: TestCase {
RemoteConfigFeature.darkModeEnabled.rawValue: true,
RemoteConfigFeature.facebookLoginInterstitialEnabled.rawValue: true,
RemoteConfigFeature.postCampaignPledgeEnabled.rawValue: true,
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true,
RemoteConfigFeature.useOfAIProjectTab.rawValue: true
RemoteConfigFeature.reportThisProjectEnabled.rawValue: true
]

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

withEnvironment(remoteConfigClient: mockRemoteConfigClient) {
Expand Down