Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.
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
8 changes: 0 additions & 8 deletions DuckDuckGo/AppDelegate/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate, FileDownloadManagerDel
#endif
}

// Temporary feature flag tester, to validate that phased rollouts are working as intended.
// This is to be removed before the end of August 2023.
lazy var featureFlagTester: PhasedRolloutFeatureFlagTester = {
return PhasedRolloutFeatureFlagTester()
}()

func applicationDidBecomeActive(_ notification: Notification) {
syncService?.initializeIfNeeded(isInternalUser: internalUserDecider?.isInternalUser ?? false)
syncService?.scheduler.notifyAppLifecycleEvent()

featureFlagTester.sendFeatureFlagEnabledPixelIfNecessary()
}

func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
Expand Down
14 changes: 14 additions & 0 deletions DuckDuckGo/Main/View/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ final class MainViewController: NSViewController {
view.registerForDraggedTypes([.URL, .fileURL])

registerForBookmarkBarPromptNotifications()
registerForDidBecomeActiveNotifications()
}

var bookmarkBarPromptObserver: Any?
Expand Down Expand Up @@ -124,6 +125,19 @@ final class MainViewController: NSViewController {
updateDividerColor()
}

func registerForDidBecomeActiveNotifications() {
NotificationCenter.default.addObserver(self,
selector: #selector(applicationDidBecomeActive),
name: NSApplication.didBecomeActiveNotification,
object: nil)
}

@objc func applicationDidBecomeActive() {
// Temporary feature flag tester, to validate that phased rollouts are working as intended.
// This is to be removed before the end of August 2023.
PhasedRolloutFeatureFlagTester.shared.sendFeatureFlagEnabledPixelIfNecessary()
}

override func viewDidLayout() {
findInPageContainerView.applyDropShadow()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ final class PhasedRolloutFeatureFlagTester {
static let hasSentPixelKey = "network-protection.incremental-feature-flag-test.has-sent-pixel"
}

static let shared = PhasedRolloutFeatureFlagTester()

private let privacyConfigurationManager: PrivacyConfigurationManaging
private let pixelSender: PhasedRolloutPixelSender
private let userDefaults: UserDefaults
Expand All @@ -56,6 +58,7 @@ final class PhasedRolloutFeatureFlagTester {
}

markPixelAsSent()

pixelSender.sendPixel { [weak self] error in
if error != nil {
self?.markPixelAsUnsent()
Expand Down