From c1f901d56d53e9609fac1cf656f9511b71e26965 Mon Sep 17 00:00:00 2001 From: Daniel Bernal Date: Thu, 31 Oct 2024 09:49:55 +0100 Subject: [PATCH] Reduce Allow first video time --- DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift | 3 +-- DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift b/DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift index a1ae3745cd..74a224c31c 100644 --- a/DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift +++ b/DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift @@ -793,7 +793,6 @@ extension DuckPlayerNavigationHandler: DuckPlayerNavigationHandling { func handleAttach(webView: WKWebView) { // Reset referrer and initial settings - duckPlayer.settings.allowFirstVideo = false referrer = .other // Ensure feature and mode are enabled @@ -836,7 +835,7 @@ extension DuckPlayerNavigationHandler: DuckPlayerNavigationHandling { // This is a fallback as the WKNavigation Delegate does not // Always fires finishLoading (For JS Navigation) which // triggers handleDidFinishLoading - DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { self.duckPlayer.settings.allowFirstVideo = false } diff --git a/DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift b/DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift index 2100b563bd..08983d5755 100644 --- a/DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift +++ b/DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift @@ -173,7 +173,11 @@ final class DuckPlayerSettingsDefault: DuckPlayerSettings { } /// Flag to allow the first video to play without redirection. - var allowFirstVideo: Bool = false + var allowFirstVideo: Bool = false { + didSet { + print("DP: Allow first video: \(allowFirstVideo)") + } + } /// Determines if Duck Player should open videos in a new tab. var openInNewTab: Bool {