-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Storing api root url from discovery process #22005
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
Storing api root url from discovery process #22005
Conversation
Generated by 🚫 Danger |
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 refactors the way application password credentials are stored by switching from direct SQL persistence to using the Flux dispatcher and SiteStore
, and ensures the API root URL from discovery is saved. It also updates related tests and refines error logging.
- Refactor persistence: replace
SiteSqlUtils
calls withSiteStore
and a newDispatcherWrapper
- Save
wpApiRestUrl
from the discovery result when storing credentials - Update tests to mock and verify against
siteStore
andDispatcherWrapper
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/test/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelperTest.kt | Tests updated to mock SiteStore and DispatcherWrapper instead of SiteSqlUtils |
src/main/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelper.kt | Replaced persistence with dispatcher actions, added API root URL capture, and wrapped dispatcher |
src/main/java/org/wordpress/android/ui/accounts/applicationpassword/ApplicationPasswordLoginViewModel.kt | Adjusted log statements to use exception messages instead of raw stack trace arrays |
...ress/src/main/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelper.kt
Outdated
Show resolved
Hide resolved
...ress/src/main/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelper.kt
Outdated
Show resolved
Hide resolved
...a/org/wordpress/android/ui/accounts/applicationpassword/ApplicationPasswordLoginViewModel.kt
Outdated
Show resolved
Hide resolved
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22005-2e71c07 | |
Commit | 2e71c07 | |
Direct Download | jetpack-prototype-build-pr22005-2e71c07.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr22005-2e71c07 | |
Commit | 2e71c07 | |
Direct Download | wordpress-prototype-build-pr22005-2e71c07.apk |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #22005 +/- ##
=======================================
Coverage 39.02% 39.02%
=======================================
Files 2153 2153
Lines 101494 101494
Branches 15585 15585
=======================================
Hits 39613 39613
Misses 58384 58384
Partials 3497 3497 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@adalpari When I follow the testing steps using the same Jurassic Ninja site I shared with you on Slack earlier, I first see a toast saying the credentials were stored and then see another saying there was an error saving credentials: apppass.mp4Checking the ![]() |
@nbradbury I think there might be a race condition. I've now changed the approach. Could you give it another try? |
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 think there might be a race condition. I've now changed the approach. Could you give it another try?
That seems to have fixed the problem 🎉 Unfortunately, this PR is failing CI now. I'll go ahead and approve it and you can merge once that's addressed.
Yes, I broke some tests, so I am fixing them right now. Thanks! |
…-root-url-from-discovery-process
|
Description
This PR stores the API_ROOT_URL from the discovery process in advance of waiting for the sites fetch to get it.
This is done this way to be sure we are using the result from the RS discovery in cases where there is no access to the current XML-RPC endpoints.
In addition, some refactor has been done and now we are using SiteStore directly instead of some SQL calls.
Testing instructions
WP_API_REST_URL
one are filled