Skip to content

Commit

Permalink
avoid animation on shield to be called on same page navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
SabrinaTardio committed Aug 22, 2024
1 parent 59c1608 commit 12b0c99
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion DuckDuckGo/Tab/Model/Tab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,22 @@ protocol NewWindowPolicyDecisionMaker {
}

var webViewDidFinishNavigationPublisher: some Publisher<Void, Never> {
navigationStatePublisher.compactMap { $0 }.filter { $0.isFinished }.asVoid()
navigationStatePublisher
.combineLatest(navigationDelegate.$currentNavigation)
.filter { navigationState, currentNavigation in
guard let navigationState = navigationState, navigationState.isFinished else {
return false
}
guard let currentNavigation = currentNavigation else {
return false
}
return MainActor.assumeIsolated {
let isSameDocumentNavigation = (currentNavigation.redirectHistory.first ?? currentNavigation.navigationAction).navigationType.isSameDocumentNavigation
return !isSameDocumentNavigation
}
}
.map { _ in () }
.eraseToAnyPublisher()
}

// MARK: - Properties
Expand Down

0 comments on commit 12b0c99

Please sign in to comment.