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

Move WPAccount wordPressComRestAPI definition to Swift #24230

Merged
merged 4 commits into from
Mar 19, 2025

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Mar 17, 2025

Part of #24165.

Following up on a suggestion by @kean internally, ref p1741953158905339-slack-C08HQR4C2TS, this PR splits the definition of the wordPressComRestAPI property in WPAccount from its implementation between the Objective-C and Swift layer in an attempt to allow moving WPAccount away from the app target(s) and into WordPressData.

The unit tests are green, which is encouraging.

I also tested this on device via Jetpack.

@dangermattic
Copy link
Collaborator

dangermattic commented Mar 17, 2025

1 Warning
⚠️ This PR is assigned to the milestone 25.9. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 17, 2025

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr24230-50f3d06
Version25.8
Bundle IDorg.wordpress.alpha
Commit50f3d06
App Center BuildWPiOS - One-Offs #11725
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Mar 17, 2025

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr24230-50f3d06
Version25.8
Bundle IDcom.jetpack.alpha
Commit50f3d06
App Center Buildjetpack-installable-builds #10753
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@mokagio mokagio self-assigned this Mar 17, 2025
@mokagio mokagio added Core Data Issues related to Core Data Enhancement labels Mar 17, 2025
@mokagio mokagio added this to the 25.9 milestone Mar 17, 2025
@mokagio mokagio requested review from crazytonyli and kean March 17, 2025 10:10
@mokagio mokagio marked this pull request as ready for review March 17, 2025 10:10
Copy link
Contributor

@kean kean left a comment

Choose a reason for hiding this comment

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

I reviewed the new Swift implementation side-by-side with the old one, and tested the login/logout in the app. It seems like a simple and solid change. I left two small (nit) comments.

get {
if let api = objc_getAssociatedObject(self, &apiAssociatedKey) as? WordPressComRestApi {
return api
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) I'd suggest removing the else to reduce the indenting a bit.

if let api = objc_getAssociatedObject(self, &apiAssociatedKey) as? WordPressComRestApi {
return api
} else {
if authToken.isEmpty {
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) seems like a good place for a guard

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for both guard suggestions!

Finally got to address them in 50f3d06

@mokagio mokagio force-pushed the mokagio/decouple-wpaccount-rest-api branch from 1755968 to 50f3d06 Compare March 19, 2025 04:49
@mokagio mokagio enabled auto-merge March 19, 2025 04:49
@mokagio mokagio added this pull request to the merge queue Mar 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 19, 2025
@kean kean added this pull request to the merge queue Mar 19, 2025
Merged via the queue into trunk with commit 10c83d3 Mar 19, 2025
25 checks passed
@kean kean deleted the mokagio/decouple-wpaccount-rest-api branch March 19, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Data Issues related to Core Data Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants