Decouple WPAccount from WordPressAuthenticationManager - #24392
Merged
Conversation
Collaborator
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 2, 2025 03:40
eb98d90 to
d5b1292
Compare
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 2, 2025 05:07
d5b1292 to
4d2af8c
Compare
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 27156 | |
| Version | PR #24392 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | a6a94f4 | |
| Installation URL | 4hor8llih9n3g |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 27156 | |
| Version | PR #24392 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | a6a94f4 | |
| Installation URL | 1hsga40m2kj20 |
mokagio
commented
Apr 2, 2025
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 2, 2025 09:07
4d2af8c to
5c5c991
Compare
Contributor
Author
|
Kept trying to figure out what the issues was with the unit tests getting stuck after my change... I thought it had to do with the keychain warning in the console. Then I finally thought to look at the Simulator (🤦♂️ for not thinking of it straightaway)
I'll timebox 30 mins for this. If I don't figure it out, I'll just remove the test in the interest of moving forward with #24165. |
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 3, 2025 00:48
5c5c991 to
76aca24
Compare
mokagio
marked this pull request as ready for review
April 3, 2025 04:24
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 3, 2025 04:24
4131962 to
9f043d1
Compare
crazytonyli
reviewed
Apr 3, 2025
| } | ||
|
|
||
| guard let authToken, !authToken.isEmpty else { | ||
| DispatchQueue.main.async { |
Contributor
There was a problem hiding this comment.
I don't think we should delete this dispatch async call. We need to either post the notification from the main thread or respond to the notification from the main thread.
Contributor
There was a problem hiding this comment.
wordPressComRestApi gets accessed from the background threads.
Contributor
Author
There was a problem hiding this comment.
mokagio
force-pushed
the
mokagio/wpaccount-notifications
branch
from
April 6, 2025 21:59
297481e to
4023911
Compare
crazytonyli
approved these changes
Apr 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Part of #24165. See also p1743540472163989-slack-C08HQR4C2TS.
There's logic in
WPAccountthat generates an API client and checks the associated state. If the client token is "invalid", it presents a dedicated sign-in screen to re-authenticate.This is a bit of a blocker for moving
WPAccountto WordPressData, because of all the dependencies that come with the authentication process, not to mention the fact that authentication should be unrelated with WordPressData.To decouple the two, we can make
WPAccountpost a notification instead of directly triggering the sign-in presentation.I don't know how to test this in the real world, but I covered the new logic with unit tests where possible.