Skip to content

Commit

Permalink
[DuckPlayer] 13. Add openInfo message to Overlay (#3151)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1204099484721401/1207905905078570/f

Description:

Add a new JS message handler
Fixes a failing test
  • Loading branch information
afterxleep authored Jul 26, 2024
1 parent 4e66be5 commit a58a943
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions DuckDuckGo/DuckPlayer/YoutubeOverlayUserScript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ final class YoutubeOverlayUserScript: NSObject, Subfeature {
static let openDuckPlayer = "openDuckPlayer"
static let sendDuckPlayerPixel = "sendDuckPlayerPixel"
static let initialSetup = "initialSetup"
static let openInfo = "openInfo"
}

weak var broker: UserScriptMessageBroker?
Expand Down Expand Up @@ -108,6 +109,8 @@ final class YoutubeOverlayUserScript: NSObject, Subfeature {
return handleSendJSPixel
case Handlers.initialSetup:
return duckPlayer.initialSetupOverlay
case Handlers.openInfo:
return duckPlayer.openDuckPlayerInfo
default:
assertionFailure("YoutubeOverlayUserScript: Failed to parse User Script message: \(methodName)")
// TODO: Send pixel here
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGoTests/YoutublePlayerNavigationHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class DuckPlayerNavigationHandlerTests: XCTestCase {

// MARK: - Decide policyFor Tests


@MainActor
func testDecidePolicyForVideoWasAlreadyHandled() {

Expand All @@ -108,7 +109,7 @@ class DuckPlayerNavigationHandlerTests: XCTestCase {
let expectation = self.expectation(description: "Completion handler called")
let playerSettings = MockDuckPlayerSettings(appSettings: mockAppSettings, privacyConfigManager: mockPrivacyConfig)
let player = MockDuckPlayer(settings: playerSettings)
let handler = DuckPlayerNavigationHandler(duckPlayer: player)
let handler = DuckPlayerNavigationHandler(duckPlayer: player, featureFlagger: featureFlagger)
var navigationPolicy: WKNavigationActionPolicy?

handler.lastHandledVideoID = "abc123"
Expand Down

0 comments on commit a58a943

Please sign in to comment.