Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep committed Nov 12, 2024
1 parent 2daac15 commit 09f7795
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions DuckDuckGo/DuckPlayer/DuckPlayerNavigationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ final class DuckPlayerNavigationHandler: NSObject {
// Watch in YT videos always open in new tab
redirectToYouTubeVideo(url: url, webView: webView, forceNewTab: true)
}
}
}

}

Expand Down Expand Up @@ -671,18 +671,18 @@ extension DuckPlayerNavigationHandler: DuckPlayerNavigationHandling {
// Update the Referrer based on the first URL change detected
setReferrer(webView: webView)

// Overlay Usage Pixel handling
if let url = webView.url {
duckPlayerOverlayUsagePixels?.handleNavigationAndFirePixels(url: url, duckPlayerMode: duckPlayerMode)
}

// We don't want YouTube redirects happening while default navigation is happening
// This can be caused by Duplicate Nav events, and quick URL changes
if let lastTimestamp = lastNavigationHandling,
Date().timeIntervalSince(lastTimestamp) < lastNavigationHandlingThrottleDuration {
return .notHandled(.duplicateNavigation)
}

// Overlay Usage Pixel handling
if let url = webView.url {
duckPlayerOverlayUsagePixels?.handleNavigationAndFirePixels(url: url, duckPlayerMode: duckPlayerMode)
}

// Check if DuckPlayer feature is enabled
guard isDuckPlayerFeatureEnabled else {
return .notHandled(.featureOff)
Expand Down
3 changes: 1 addition & 2 deletions DuckDuckGo/DuckPlayer/DuckPlayerOverlayUsagePixels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ final class DuckPlayerOverlayUsagePixels: DuckPlayerOverlayPixelFiring {
}
}

// Refined truncation logic:
// Truncation logic: Remove all URLs up to the last occurrence of the current URL in normalized form
if let lastOccurrenceIndex = (0..<navigationHistory.count - 1).last(where: { navigationHistory[$0].forComparison() == comparisonURL }) {
// Truncate history to keep only up to the last occurrence of the current URL in normalized form
navigationHistory = Array(navigationHistory.prefix(upTo: lastOccurrenceIndex + 1))
}

Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ class TabViewController: UIViewController {
}

if webView.canGoBack {
webView.goBack()
webView.goBack()
chromeDelegate?.omniBar.resignFirstResponder()
return
}
Expand Down

0 comments on commit 09f7795

Please sign in to comment.