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

Navigate to YT from Duck Player #4780

Conversation

CrisBarreiro
Copy link
Contributor

Task/Issue URL: https://app.asana.com/0/0/1207562793310532/f

Description

Steps to test this PR

Feature 1

  • [ ]
  • [ ]

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

Copy link
Contributor Author

CrisBarreiro commented Jul 19, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @CrisBarreiro and the rest of your teammates on Graphite Graphite

@CrisBarreiro CrisBarreiro marked this pull request as ready for review July 30, 2024 09:29
@CrisBarreiro CrisBarreiro marked this pull request as draft July 30, 2024 09:30
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from b267e13 to 4a370c6 Compare July 30, 2024 09:43
@CrisBarreiro CrisBarreiro mentioned this pull request Jul 31, 2024
3 tasks
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch 2 times, most recently from 5172524 to 8789ab0 Compare August 5, 2024 09:42
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from 40fc837 to d9fa7be Compare August 7, 2024 09:56
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from 8789ab0 to 8c40743 Compare August 7, 2024 09:56
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from d9fa7be to 8242a9f Compare August 7, 2024 10:28
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from 8c40743 to 1865035 Compare August 7, 2024 10:28
@CrisBarreiro CrisBarreiro marked this pull request as ready for review August 7, 2024 10:32
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from 8242a9f to fab0899 Compare August 7, 2024 13:16
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from 1865035 to 742ea02 Compare August 7, 2024 13:17
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from fab0899 to 8d68e61 Compare August 8, 2024 11:44
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from 742ea02 to ae1e3be Compare August 8, 2024 11:44
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from 8d68e61 to 1f34224 Compare August 8, 2024 11:50
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from ae1e3be to 54cc443 Compare August 8, 2024 11:50
Copy link
Contributor

@marcosholgado marcosholgado left a comment

Choose a reason for hiding this comment

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

Overall LGTM. Not really sure what to test functionality wise since there are no testing steps and more tests could be added. Will wait to get the different scenarios to test before approving.

@@ -1092,7 +1092,7 @@ class BrowserTabViewModel @Inject constructor(
when (stateChange) {
is WebNavigationStateChange.NewPage -> {
val uri = stateChange.url.toUri()
if (duckPlayer.isYoutubeNoCookie(uri)) {
if (duckPlayer.isSimulatedYoutubeNoCookie(uri)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All the changes to the view model should probably be tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in top of the stack

@@ -383,12 +383,15 @@ class BrowserWebViewClient @Inject constructor(
pageLoadedHandler.onPageLoaded(it, navigationList.currentItem?.title, safeStart, currentTimeProvider.elapsedRealtime())
shouldSendPagePaintedPixel(webView = webView, url = it)
appCoroutineScope.launch(dispatcherProvider.io()) {
if (duckPlayer.isYoutubeNoCookie(url)) {
if (duckPlayer.isSimulatedYoutubeNoCookie(url)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in top of the stack

@@ -159,6 +122,10 @@ class WebViewRequestInterceptor(
return WebResourceResponse(null, null, null)
}

if (url != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to top of the stack

@@ -34,6 +34,7 @@ dependencies {
implementation Kotlin.stdlib.jdk7
implementation AndroidX.core.ktx
implementation KotlinX.coroutines.core
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why is this needed.


@SingleInstanceIn(AppScope::class)
@ContributesBinding(AppScope::class)
class RealDuckPlayer @Inject constructor(
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested in the top of the stack

@marcosholgado marcosholgado self-assigned this Aug 9, 2024
@marcosholgado
Copy link
Contributor

Had a go at the test cases and found these behaviours not matching them.

Back button with Always Ask

  • Open a video in YouTube
  • Go to Duck Player
  • On the Duck Player page use the back button on your phone
  • The video should load in YouTube with no overlay shown <- This doesn't happen for me and the overlay is always shown.

Back button with Always

  • Open a video in YouTube, check Duck Player is loaded
  • On the Duck Player page use the back button on your phone
  • The video should load in YouTube <- This never happens and I'm taken back to the new tab screen instead. Which I think makes sense because YT never actually loads.

Back button age restricted videos

  • Open video using Duck Player URL
  • On the Duck Player page use the back button on your phone
  • Check YouTube is loaded <- as above, YT doesn't load, instead I'm taken to the new tab screen.

@CrisBarreiro
Copy link
Contributor Author

Had a go at the test cases and found these behaviours not matching them.

Back button with Always Ask

* Open a video in YouTube

* Go to Duck Player

* On the Duck Player page use the back button on your phone

* The video should load in YouTube with no overlay shown <- This doesn't happen for me and the overlay is always shown.

Back button with Always

* Open a video in YouTube, check Duck Player is loaded

* On the Duck Player page use the back button on your phone

* The video should load in YouTube <- This never happens and I'm taken back to the new tab screen instead. Which I think makes sense because YT never actually loads.

Back button age restricted videos

* Open video using Duck Player URL

* On the Duck Player page use the back button on your phone

* Check YouTube is loaded <- as above, YT doesn't load, instead I'm taken to the new tab screen.

@marcosholgado thanks for having a look!

Back button with Always Ask -> I think the current behavior makes sense, as the page the user had seen before contains the overlay, and we probably shouldn't treat it in the same way as tapping the YouTube button

For the other 2 cases, as you mentioned, since YouTube never actually loads, it doesn't make sense to navigate back to it. That was a mistake on my site when writing the test cases

Copy link
Contributor

@marcosholgado marcosholgado left a comment

Choose a reason for hiding this comment

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

LGTM

@CrisBarreiro CrisBarreiro mentioned this pull request Aug 19, 2024
1 task
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch 2 times, most recently from 0a98f10 to 2d3b27f Compare August 20, 2024 11:14
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/update-initial-setup-duck-player-page branch from 1f34224 to 878ad02 Compare August 20, 2024 15:28
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/navigate-back-from-duck-player branch from 2d3b27f to 9539c9c Compare August 20, 2024 15:28
Base automatically changed from feature/cris/update-initial-setup-duck-player-page to feature/cris/duckplayer/create-module August 20, 2024 15:37
@CrisBarreiro CrisBarreiro merged commit 9539c9c into feature/cris/duckplayer/create-module Aug 20, 2024
4 of 5 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cris/navigate-back-from-duck-player branch August 20, 2024 15:40
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