Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DuckPlayer Native PoC: Webview storage + nav coordination #3912

Merged
merged 24 commits into from
Feb 3, 2025

Conversation

afterxleep
Copy link
Collaborator

@afterxleep afterxleep commented Jan 31, 2025

Task/Issue URL: https://app.asana.com/0/0/1209280272427911/f
Tech Design URL:
CC:

Description:

  • Sets webview to be not persistent so we don’t store cookies
  • Extracts WKWebview into a separate view
  • Handles internal (Youtube) navigation inside the player, and blocks other requests.

Steps to test this PR:

  1. Enable the PoC
  2. Go to Youtube and open a video
  3. Tap the Youtube logo or video title
  4. You should get a [DuckPlayer] Navigation request to <URL> log message, but nothing should happen
  5. Video controls should work as expected
  6. Confirm that videos that were not loading before, such as this one work correctly
  7. Try to load an embed protected video like this one
  8. Confirm you get a [DuckPlayer] Navigation request to <URL> log message when tapping “Watch in Youtube” there

Definition of Done (Internal Only):

@afterxleep afterxleep changed the base branch from main to daniel/duckplayer/29.defaults.removal January 31, 2025 18:00
@afterxleep afterxleep changed the base branch from daniel/duckplayer/29.defaults.removal to main January 31, 2025 18:00
@@ -109,28 +105,3 @@ struct DuckPlayerView: View {
.background(Color.black)
}
}

// WebView wrapper for WKWebView
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved into a separate type-

}

func makeUIView(context: Context) -> WKWebView {
let configuration = WKWebViewConfiguration()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bunch of privacy protections, and removed persistent storage


func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
// Prevent automatic opening of URLs in browser
if let url = navigationAction.request.url {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disallow window creation and other navigation

@afterxleep afterxleep marked this pull request as ready for review January 31, 2025 18:09
@afterxleep afterxleep requested a review from Bunn January 31, 2025 18:09
@afterxleep afterxleep merged commit fc8e924 into main Feb 3, 2025
43 of 44 checks passed
@afterxleep afterxleep deleted the daniel/duckplayer/30.native.poc.2 branch February 3, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants