Skip to content

Commit

Permalink
Refactor FXIOS-11016 #24065 Reenable cleanupHistoryIfNeeded (#24066)
Browse files Browse the repository at this point in the history
* Reenable cleanupHistoryIfNeeded

* Adding feature flag
  • Loading branch information
lmarceau authored Jan 10, 2025
1 parent 2c58eda commit 72d9e37
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
7 changes: 4 additions & 3 deletions firefox-ios/Client/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion firefox-ios/Client/Application/UITestAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 2 additions & 0 deletions firefox-ios/Client/FeatureFlags/NimbusFlaggableFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum NimbusFeatureFlagID: String, CaseIterable {
case bottomSearchBar
case contextualHintForToolbar
case creditCardAutofillStatus
case cleanupHistoryReenabled
case fakespotBackInStock
case fakespotFeature
case fakespotProductAds
Expand Down Expand Up @@ -109,6 +110,7 @@ struct NimbusFlaggableFeature: HasNimbusSearchBar {
.bookmarksRefactor,
.accountSettingsRedux,
.addressAutofillEdit,
.cleanupHistoryReenabled,
.creditCardAutofillStatus,
.closeRemoteTabs,
.fakespotBackInStock,
Expand Down
8 changes: 8 additions & 0 deletions firefox-ios/Client/Nimbus/NimbusFeatureFlagLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down
19 changes: 19 additions & 0 deletions firefox-ios/nimbus-features/cleanupHistoryReenabled.yaml
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions firefox-ios/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 72d9e37

Please sign in to comment.