From f313f7e88f670707823c2bd3306a96ad34888033 Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Wed, 9 Oct 2024 14:12:35 +0200 Subject: [PATCH 1/4] DuckPlayer Experiment Fix --- DuckDuckGo/DuckPlayer/DuckPlayer.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/DuckPlayer/DuckPlayer.swift b/DuckDuckGo/DuckPlayer/DuckPlayer.swift index e3630118c1..fd2277e216 100644 --- a/DuckDuckGo/DuckPlayer/DuckPlayer.swift +++ b/DuckDuckGo/DuckPlayer/DuckPlayer.swift @@ -184,7 +184,12 @@ final class DuckPlayer: DuckPlayerProtocol { } public func getUserValues(params: Any, message: WKScriptMessage) -> Encodable? { - encodeUserValues() + let duckPlayerExperiment = DuckPlayerLaunchExperiment() + if duckPlayerExperiment.isEnrolled && duckPlayerExperiment.isExperimentCohort { + return encodeUserValues() + } + return nil + } @MainActor From b7480042e90364416ea4aeb456e38f567b55b6f7 Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Wed, 9 Oct 2024 14:13:04 +0200 Subject: [PATCH 2/4] Update Debug config --- DuckDuckGo/DuckPlayer/DuckPlayerLaunchExperiment.swift | 4 ++-- DuckDuckGo/RootDebugViewController.swift | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DuckDuckGo/DuckPlayer/DuckPlayerLaunchExperiment.swift b/DuckDuckGo/DuckPlayer/DuckPlayerLaunchExperiment.swift index 8edd25ed56..be9821fe3e 100644 --- a/DuckDuckGo/DuckPlayer/DuckPlayerLaunchExperiment.swift +++ b/DuckDuckGo/DuckPlayer/DuckPlayerLaunchExperiment.swift @@ -227,9 +227,9 @@ final class DuckPlayerLaunchExperiment: DuckPlayerLaunchExperimentHandling { lastVideoIDReportedV2 = nil } - func override() { + func override(control: Bool = false) { enrollmentDateV2 = Date() - experimentCohortV2 = "experiment" + experimentCohortV2 = control ? "control" : "experiment" lastDayPixelFiredV2 = nil lastWeekPixelFiredV2 = nil lastVideoIDReportedV2 = nil diff --git a/DuckDuckGo/RootDebugViewController.swift b/DuckDuckGo/RootDebugViewController.swift index 287ef73822..23500ebf8c 100644 --- a/DuckDuckGo/RootDebugViewController.swift +++ b/DuckDuckGo/RootDebugViewController.swift @@ -49,6 +49,7 @@ class RootDebugViewController: UITableViewController { case resetSyncPromoPrompts = 677 case resetDuckPlayerExperiment = 678 case overrideDuckPlayerExperiment = 679 + case overrideDuckPlayerExperimentControl = 680 } @IBOutlet weak var shareButton: UIBarButtonItem! @@ -189,6 +190,9 @@ class RootDebugViewController: UITableViewController { case .overrideDuckPlayerExperiment: DuckPlayerLaunchExperiment().override() ActionMessageView.present(message: "Overriding experiment. You are now in the 'experiment' group. Restart the app to complete") + case .overrideDuckPlayerExperimentControl: + DuckPlayerLaunchExperiment().override(control: true) + ActionMessageView.present(message: "Overriding experiment. You are now in the 'control' group. Restart the app to complete") } } } From 0744f889797aa5c59e605dcb63c7ca774ac6a8a4 Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Wed, 9 Oct 2024 14:52:11 +0200 Subject: [PATCH 3/4] Add Comment --- DuckDuckGo/DuckPlayer/DuckPlayer.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DuckDuckGo/DuckPlayer/DuckPlayer.swift b/DuckDuckGo/DuckPlayer/DuckPlayer.swift index fd2277e216..cde2b9d08b 100644 --- a/DuckDuckGo/DuckPlayer/DuckPlayer.swift +++ b/DuckDuckGo/DuckPlayer/DuckPlayer.swift @@ -184,6 +184,9 @@ final class DuckPlayer: DuckPlayerProtocol { } public func getUserValues(params: Any, message: WKScriptMessage) -> Encodable? { + // If the user is in the 'control' group, sending 'nil' effectively disables + // Duckplayer in SERP, showing old overlays. + // Fixes: https://app.asana.com/0/1207252092703676/1208450923559111 let duckPlayerExperiment = DuckPlayerLaunchExperiment() if duckPlayerExperiment.isEnrolled && duckPlayerExperiment.isExperimentCohort { return encodeUserValues() From b2aec6e3d73c449cafa8077bf669569faa23d79a Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Wed, 9 Oct 2024 14:59:19 +0200 Subject: [PATCH 4/4] Add Row to SB --- DuckDuckGo/Debug.storyboard | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/DuckDuckGo/Debug.storyboard b/DuckDuckGo/Debug.storyboard index 313b40911f..ec8cb0aca3 100644 --- a/DuckDuckGo/Debug.storyboard +++ b/DuckDuckGo/Debug.storyboard @@ -1,9 +1,9 @@ - + - + @@ -360,7 +360,7 @@ - + @@ -390,7 +390,16 @@ - + + + + + + + + + + @@ -974,34 +983,34 @@ - + - + - + - +