-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Show password login webview and prepare internal architecture #21855
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
Show password login webview and prepare internal architecture #21855
Conversation
Generated by 🚫 Danger |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21855-30a529b | |
Commit | 30a529b | |
Direct Download | wordpress-prototype-build-pr21855-30a529b.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21855-30a529b | |
Commit | 30a529b | |
Direct Download | jetpack-prototype-build-pr21855-30a529b.apk |
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java
Fixed
Show fixed
Hide fixed
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java
Fixed
Show fixed
Hide fixed
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #21855 +/- ##
=======================================
Coverage 39.38% 39.38%
=======================================
Files 2134 2133 -1
Lines 100053 100044 -9
Branches 15408 15408
=======================================
Hits 39406 39406
+ Misses 57164 57155 -9
Partials 3483 3483 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR introduces a new password login flow by presenting an authentication webview for API discovery and prepares the internal architecture for handling callback URLs in a subsequent iteration. Key changes include removing the obsolete LoginSiteAddressViewModel and its tests, updating LoginActivity to use a dedicated CustomTabsIntent helper for launching webviews, and enhancing LoginViewModel to perform API discovery with consolidated error handling and analytics tracking.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
libs/login/src/main/java/org/wordpress/android/login/viewmodel/LoginSiteAddressViewModel.kt | Removed obsolete view model used for API discovery |
libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.kt | Removed dependency on LoginSiteAddressViewModel and its API discovery call |
WordPress/src/test/java/org/wordpress/android/ui/accounts/LoginViewModelTest.kt | Added tests validating the new API discovery flow in LoginViewModel |
WordPress/src/test/java/org/wordpress/android/login/viewmodel/LoginSiteAddressViewModelTest.kt | Removed tests for the deleted view model |
WordPress/src/main/java/org/wordpress/android/ui/accounts/login/WPcomLoginHelper.kt | Added a helper to append query parameters to the authorization URL |
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginViewModel.kt | Refactored API discovery method to integrate with WPcomLoginHelper and enhanced logging/analytics |
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java | Simplified custom tabs handling and introduced a new method to launch the application password flow |
WordPress/src/main/java/org/wordpress/android/modules/ViewModelModule.java | Removed the dependency injection binding for the deleted view model |
Files not reviewed (1)
- libs/login/build.gradle: Language not supported
Comments suppressed due to low confidence (2)
WordPress/src/main/java/org/wordpress/android/modules/ViewModelModule.java:451
- Ensure that removing the LoginSiteAddressViewModel binding does not affect any existing dependency injections in the app.
@Binds @IntoMap @ViewModelKey(LoginSiteAddressViewModel.class)
libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.kt:190
- Add a clarifying comment to explain the migration of API discovery logic, indicating where and how this functionality is now handled.
// viewModel.runApiDiscovery(cleanedUrl)
} catch (throwable: Throwable) { | ||
Log.e("WP_RS", "VM: Error during API discovery for $url", throwable) | ||
AnalyticsTracker.track(AnalyticsTracker.Stat.BACKGROUND_REST_AUTODISCOVERY_FAILED) | ||
"" |
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.
Consider catching specific exceptions instead of Throwable to avoid masking underlying issues during API discovery.
} catch (throwable: Throwable) { | |
Log.e("WP_RS", "VM: Error during API discovery for $url", throwable) | |
AnalyticsTracker.track(AnalyticsTracker.Stat.BACKGROUND_REST_AUTODISCOVERY_FAILED) | |
"" | |
} catch (e: IOException) { | |
Log.e("WP_RS", "VM: Network error during API discovery for $url", e) | |
AnalyticsTracker.track(AnalyticsTracker.Stat.BACKGROUND_REST_AUTODISCOVERY_FAILED) | |
"" | |
} catch (e: IllegalArgumentException) { | |
Log.e("WP_RS", "VM: Invalid argument during API discovery for $url", e) | |
AnalyticsTracker.track(AnalyticsTracker.Stat.BACKGROUND_REST_AUTODISCOVERY_FAILED) | |
"" |
Copilot uses AI. Check for mistakes.
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java
Fixed
Show fixed
Hide fixed
|
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.
Looks good - glad to see some progress on this! Feel free to merge when ready
Description
This PR is adding a new step for the Application Password login in the
LoginActivity
. See the previous discarded place for this logic: #21852In this new iteration we are showing to the user the authentication webview and intercepting the callback url. NOTE: the callback is yet not handled. That will be done in the next iteration: handling it and storing it.
Testing instructions
LoginActivity
, uncomment line 705Verify you see a log like:
Found authorization for https://vanilla.wpmt.co URL: https://vanilla.wpmt.co/wp-admin/authorize-application.php?app_name=android-jetpack-client&success_url=jetpack%3A%2F%2Fwpcom-authorize
Verify you are redirected to the authentication webview
Screen.Recording.2025-05-05.at.15.49.53.mov
<!-
Consider testing the following yourself before requesting a review:
-->