Skip to content

Tweak a few file to allow WordPressData to compile - #24375

Merged
mokagio merged 6 commits into
trunkfrom
mokagio/more-wordpress-data-tweaks
Apr 1, 2025
Merged

Tweak a few file to allow WordPressData to compile#24375
mokagio merged 6 commits into
trunkfrom
mokagio/more-wordpress-data-tweaks

Conversation

@mokagio

@mokagio mokagio commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

Discovered these while working on #24378.

Part of #24165.

@mokagio
mokagio force-pushed the mokagio/more-wordpress-data-tweaks branch from f39cba1 to 6bc1aed Compare April 1, 2025 10:47
@dangermattic

dangermattic commented Apr 1, 2025

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ This PR is assigned to the milestone 25.9. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

///
public func migrateAuthKey(for username: String) {
guard AppConfiguration.isJetpack,
guard BuildSettings.current.brand == .jetpack,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Using BuildSettings over AppConfiguration allows moving to WordPressData where the latter is not available.

Comment thread WordPress/Classes/Models/Blog/Blog.m Outdated
{
if (self.account) {
return self.account.wordPressComRestApi;
return self.account._private_wordPressComRestApi;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wordPressComRestApi uses WordPressAuthenticationManager which depends on WordPressAuthenticator which we don't want to add to WordPressData.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this method need to be in WordPressData? Would it make sense to keep inside the app targets like the similar WPAccount extension?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question... I'll have to check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After a quick check, I think it should be possible to move it to 1) Swift and 2) the apps targets. This will also require moving some additional logic for logging / Zendesk / customer support, but it should not be too complex...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed via 75f416c (#24375) @kean — thanks again for the suggestion

Comment on lines -44 to -48
/// Returns the local image for the icon representing the social network.
var localIconImage: UIImage {
WPStyleGuide.socialIcon(for: rawValue as NSString)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

socialIcon(for service: NSString) -> UIImage is defined in the apps target / Keystone, which WordPressData does not have access to.

By moving it away from here, we unblock adding this required extension to the framework.

@mokagio mokagio added this to the 25.9 milestone Apr 1, 2025
@mokagio mokagio added the Core Data Issues related to Core Data label Apr 1, 2025
@mokagio
mokagio requested review from crazytonyli and kean April 1, 2025 10:52
@mokagio
mokagio marked this pull request as ready for review April 1, 2025 10:52
@wpmobilebot

wpmobilebot commented Apr 1, 2025

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number26995
VersionPR #24375
Bundle IDorg.wordpress.alpha
Commit75f416c
Installation URL0ri5om2m3uv30
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Apr 1, 2025

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number26995
VersionPR #24375
Bundle IDcom.jetpack.alpha
Commit75f416c
Installation URL0tvuiusqnh4tg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Apologies for the annoying diff due to the change from methods to
computed vars.

I suppose I could have left the implementations as method, but it felt
cleaner to move them to more Swift-idiomatic computed vars.
@mokagio
mokagio force-pushed the mokagio/more-wordpress-data-tweaks branch from bea1e47 to 75f416c Compare April 1, 2025 12:00
@mokagio

mokagio commented Apr 1, 2025

Copy link
Copy Markdown
Contributor Author

The tests failed in CI before 75f416c (#24375). For the record, for 75f416c they pass on my end... but you'll have to take my word for it because my Xcode just quit itself to update...

Screenshot 2025-04-01 at 11 03 22 PM

@kean kean left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. If you need something rewriting from Objective-C, let me know.

@mokagio
mokagio added this pull request to the merge queue Apr 1, 2025
Merged via the queue into trunk with commit c2e7219 Apr 1, 2025
@mokagio
mokagio deleted the mokagio/more-wordpress-data-tweaks branch April 1, 2025 18:52
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants