-
Notifications
You must be signed in to change notification settings - Fork 130
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
Authenticated WebView improvement [Part 1] #13468
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
@@ -32,7 +32,6 @@ fun BlazeCampaignDetailWebViewScreen( | |||
userAgent = userAgent, | |||
wpComAuthenticator = wpComAuthenticator, | |||
onUrlLoaded = onUrlLoaded, | |||
clearCache = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearing cache was enabled here for Blaze campaign details, I don't think this was intentional, so I removed it. The feature works without issues without this, but if I'm missing something, I can bring it back (cc @JorgeMucientes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tested this and found no issues. I see no reason to clear the cache in this case, so it looks good to me.
} | ||
|
||
webView?.let { webView -> | ||
LaunchedEffect(url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With using a LaunchedEffect
for this, we simplified the code quite a bit as we don't need to check what was the last requested URL.
This also will help in the next PR, as we need to make authenticateAndLoadUrl
a suspendable function.
|
||
Box(modifier = modifier) { | ||
val webViewAlpha by remember { | ||
derivedStateOf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using derivedStateOf
for this feels more Compose idiomatic than the local functions we were using before, and should be better for performance, as before we were recalculating the alpha on each recomposition even if it didn't change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested web views on various screens and couldn't find any issues. Organized commits help a lot with the review, thank you for that.
I noticed an issue, but I’m unsure if it was introduced in this PR, and I couldn’t find an error log at first glance. When the Themes screen is open, and I put the app in the background and relaunch it, the app doesn’t start on the Themes screen. Instead, it shows the main screen. I also tested this in trunk
, and it resumes from the Themes screen there. Could you check this, please?
Screen_recording_20250208_173756.webm
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/compose/component/web/WCWebView.kt
Show resolved
Hide resolved
@@ -32,7 +32,6 @@ fun BlazeCampaignDetailWebViewScreen( | |||
userAgent = userAgent, | |||
wpComAuthenticator = wpComAuthenticator, | |||
onUrlLoaded = onUrlLoaded, | |||
clearCache = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tested this and found no issues. I see no reason to clear the cache in this case, so it looks good to me.
I can't reproduce this issue using this branch, and this PR didn't make any changes to this part, I modified only the handling of the theme preview logic, which is in From the look of your video, it seems the "recent apps" repasses the Intent and creates a new task, which removes the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wiped the emulator’s data and performed a cold boot, but the issue persisted. I then created a new emulator, and the issue is no longer reproducible. That’s strange, it must be related to the emulator itself. In any case, everything looks good. 👍🏻
Part of: #13467
Tip
Excluding the commit f0ce7cd when reviewing would make the review easier, this commit just renames few classes.
Description
This PR is a preparation for the next PR that implements the improvements suggested in pe5sF9-3QB-p2, it handles the following changes:
WCWebView
composable, and make some changes to make it more use better Compose idiomatic approaches.WebViewClient
, this turned out to be not needed for this feature, but I believe it can be useful for other features.WPComWebView...
toAuthenticatedWebView...
to align better with the new roles.Steps to reproduce
This PR shouldn't introduce any behavior changes (except one for Blaze campaign details that I will explain below), so just testing few areas that use the
WCWebView
and theAuthenticatedWebView
, for example:Testing information
The tests that have been performed
^
RELEASE-NOTES.txt
if necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: