diff --git a/firefox-ios/Client/Application/AppDelegate.swift b/firefox-ios/Client/Application/AppDelegate.swift index 914c6e29fe6f..a5a4912565e1 100644 --- a/firefox-ios/Client/Application/AppDelegate.swift +++ b/firefox-ios/Client/Application/AppDelegate.swift @@ -11,7 +11,7 @@ import TabDataStore import class MozillaAppServices.Viaduct -class AppDelegate: UIResponder, UIApplicationDelegate { +class AppDelegate: UIResponder, UIApplicationDelegate, FeatureFlaggable { let logger = DefaultLogger.shared var notificationCenter: NotificationProtocol = NotificationCenter.default var orientationLock = UIInterfaceOrientationMask.all @@ -164,8 +164,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Cleanup can be a heavy operation, take it out of the startup path. Instead check after a few seconds. DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) { [weak self] in - // TODO: testing to see if this fixes https://mozilla-hub.atlassian.net/browse/FXIOS-7632 - // self?.profile.cleanupHistoryIfNeeded() + if self?.featureFlags.isFeatureEnabled(.cleanupHistoryReenabled, checking: .buildOnly) ?? false { + self?.profile.cleanupHistoryIfNeeded() + } self?.ratingPromptManager.updateData() } diff --git a/firefox-ios/Client/Application/UITestAppDelegate.swift b/firefox-ios/Client/Application/UITestAppDelegate.swift index 6f047c1f1cee..f180ef2a3c38 100644 --- a/firefox-ios/Client/Application/UITestAppDelegate.swift +++ b/firefox-ios/Client/Application/UITestAppDelegate.swift @@ -9,7 +9,7 @@ import Kingfisher import class MozillaAppServices.HardcodedNimbusFeatures -class UITestAppDelegate: AppDelegate, FeatureFlaggable { +class UITestAppDelegate: AppDelegate { lazy var dirForTestProfile = { return "\(self.appRootDir())/profile.testProfile" }() private var internalProfile: Profile? diff --git a/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift b/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift index 5b388842d407..470b9ee2e22d 100644 --- a/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift +++ b/firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift @@ -15,6 +15,7 @@ enum NimbusFeatureFlagID: String, CaseIterable { case bottomSearchBar case contextualHintForToolbar case creditCardAutofillStatus + case cleanupHistoryReenabled case fakespotBackInStock case fakespotFeature case fakespotProductAds @@ -109,6 +110,7 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar { .bookmarksRefactor, .accountSettingsRedux, .addressAutofillEdit, + .cleanupHistoryReenabled, .creditCardAutofillStatus, .closeRemoteTabs, .fakespotBackInStock, diff --git a/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift b/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift index c8943ea8c36c..fd187470250b 100644 --- a/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift +++ b/firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift @@ -24,6 +24,9 @@ final class NimbusFeatureFlagLayer { .isToolbarCFREnabled: return checkAwesomeBarFeature(for: featureID, from: nimbus) + case .cleanupHistoryReenabled: + return checkCleanupHistoryReenabled(from: nimbus) + case .contextualHintForToolbar: return checkNimbusForContextualHintsFeature(for: featureID, from: nimbus) @@ -144,6 +147,11 @@ final class NimbusFeatureFlagLayer { return nimbus.features.bookmarkRefactorFeature.value().enabled } + private func checkCleanupHistoryReenabled(from nimbus: FxNimbus) -> Bool { + let config = nimbus.features.cleanupHistoryReenabled.value() + return config.enabled + } + private func checkGeneralFeature(for featureID: NimbusFeatureFlagID, from nimbus: FxNimbus ) -> Bool { diff --git a/firefox-ios/nimbus-features/cleanupHistoryReenabled.yaml b/firefox-ios/nimbus-features/cleanupHistoryReenabled.yaml new file mode 100644 index 000000000000..243cfb7ee99d --- /dev/null +++ b/firefox-ios/nimbus-features/cleanupHistoryReenabled.yaml @@ -0,0 +1,19 @@ +# The configuration file for the cleanupHistoryIfNeeded re-enabling functionnality +features: + cleanup-history-reenabled: + description: > + This feature flag will help us slowly re-enable the cleanupHistoryIfNeeded functionnality at startup of the app + variables: + enabled: + description: > + When true the cleanupHistoryIfNeeded will be run + type: Boolean + default: false + defaults: + - channel: beta + value: + enabled: true + - channel: developer + value: + enabled: true + diff --git a/firefox-ios/nimbus.fml.yaml b/firefox-ios/nimbus.fml.yaml index e264b98601d8..cec90b6289e6 100644 --- a/firefox-ios/nimbus.fml.yaml +++ b/firefox-ios/nimbus.fml.yaml @@ -17,6 +17,7 @@ include: - nimbus-features/addressAutofillFeature.yaml - nimbus-features/autofillFeature.yaml - nimbus-features/bookmarkRefactorFeature.yaml + - nimbus-features/cleanupHistoryReenabled.yaml - nimbus-features/contextualHintFeature.yaml - nimbus-features/fakespotFeature.yaml - nimbus-features/feltPrivacyFeature.yaml