Skip to content

Commit

Permalink
Reduce Allow first video time
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep committed Oct 31, 2024
1 parent 757a5b5 commit c1f901d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
6 changes: 5 additions & 1 deletion DuckDuckGo/DuckPlayer/DuckPlayerSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c1f901d

Please sign in to comment.