Move model files from apps targets to WordPressData - #24378
Conversation
Generated by 🚫 Danger |
5e4258a to
8b47455
Compare
| @@ -0,0 +1 @@ | |||
| // Here only to have the matching .m where to define the DDLogLevel value. | |||
There was a problem hiding this comment.
Might not even be necessary. Gotta try that...
| #ifndef WordPress_Swift_h | ||
| #define WordPress_Swift_h | ||
| // FIXME: Defined here to avoid compilation errors while files are migrated over... | ||
| #endif /* WordPress_Swift_h */ |
There was a problem hiding this comment.
Should be able to remove this now...
| var wordPressComRestApi: WordPressComRestApi? { | ||
| account?.wordPressComRestApi | ||
| // FIXME: We are banking on the fact that by the time a consumer reads this, WPAccount will already have initialized its API client instance. | ||
| account?._private_wordPressComRestApi |
There was a problem hiding this comment.
Maybe we could decouple WPAccount wordPressComRestApi from WordPressAuthenticator using... a Notification?
WordPress-iOS/WordPress/Classes/Models/WPAccount+RestApi.swift
Lines 12 to 20 in b14619b
WordPress-iOS/WordPress/Classes/Models/WPAccount+RestApi.swift
Lines 27 to 38 in b14619b
I suggest a Notification because I don't think injecting callbacks or using a delegate would be feasible with a model like this.
710846d to
8e8a6d7
Compare
| return [self supportsRestApi] && [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled]; | ||
| // FIXME: See https://github.com/wordpress-mobile/WordPress-iOS/pull/24332 | ||
| // return [self supportsRestApi] && [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled]; | ||
| return [self supportsRestApi]; | ||
| case BlogFeatureTenor: | ||
| return [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled]; | ||
| // FIXME: See https://github.com/wordpress-mobile/WordPress-iOS/pull/24332 | ||
| // return [JetpackFeaturesRemovalCoordinator jetpackFeaturesEnabled]; | ||
| return NO; |
|
|
||
| let startupEvent = SentryStartupEvent() | ||
| // FIXME: Import the Sentry stuff, too — But it accesses the app delegate! | ||
| // let startupEvent = SentryStartupEvent() |
There was a problem hiding this comment.
@crazytonyli is this ContextManager Sentry logging something that we need, or is it by any chance something that we added at the time of adoption just to monitor 🤞 ?
Being able to just chop it off would simplify things.
There was a problem hiding this comment.
See also p1743115991824589/1743090023.463689-slack-C08HQR4C2TS
There was a problem hiding this comment.
I'm sorry I missed this message. I don't think I added the events. It's very likely that they were there before my time. I doubt these events ever occur on production. I did a quick search on Sentry and don't see any related events. However, I think it's best to keep them in case we introduce some issues to the Core Data layer. At the bare minimum, we can send the events to the app via a notification.
8e8a6d7 to
caa0730
Compare
caa0730 to
f15a95b
Compare
f0b8baf to
9747c86
Compare
1b81897 to
c5f7a76
Compare
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 27563 | |
| Version | PR #24378 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 255fd0c | |
| Installation URL | 4pqsd6d4r1f50 |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 27563 | |
| Version | PR #24378 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 255fd0c | |
| Installation URL | 035hhosmgq1go |
c5f7a76 to
35a3999
Compare
35a3999 to
85779b2
Compare
…tAPI Same rationale as 09990b8
Triggered by a few errors like ``` In file included from /Users/gio/Developer/a8c/wpios/WordPress/Classes/ViewRelated/Suggestions/SuggestionsTableViewCell.m:3: /Users/gio/Developer/a8c/wpios/DerivedData/WordPress/Build/Intermediates.noindex/WordPress.build/Debug-iphonesimulator/Keystone.build/DerivedSources/Keystone-Swift.h:295:9: fatal error: module 'WebKit' not found 295 | @import WebKit; | ~~~~~~~^~~~~~ ``` which I got after linking WordPressData against Keystone and moving all the sources there.
Apparently unnecessary, see #24420 (comment)
Via ``` sed -i '' -E 's/representedClassName="(WordPress)?(\.)?([^"]+)"/representedClassName=".\3"/g' \ Sources/WordPressData/Resources/WordPress.xcdatamodeld/WordPress\ 155.xcdatamodel/contents ``` which switched to "Current Product Module" but resulted in unit tests failure in WordPressData, followed by ``` ➜ sed -i '' -E 's/representedClassName="\.([^"]+)"/representedClassName="\1"/g' \ Sources/WordPressData/Resources/WordPress.xcdatamodeld/WordPress\ 155.xcdatamodel/contents ```
Done via
```
find . \
\( -path './DerivedData' -o -path './.git' -o -path './vendor' \) \
-prune -o -type f -name "*.swift" \
-exec sed -i '' -E 's/forEntityName: "([A-Za-z_][A-Za-z0-9_]*)"/forEntityName: \1.entityName()/g' {} +
```
Done via
```
find . \
\( -path './DerivedData' -o -path './.git' -o -path './vendor' \) \
-prune -o -type f -name "*.swift" \
-exec sed -i '' -E 's/forEntityName: NSStringFromClass\(([A-Za-z_][A-Za-z0-9_]*)\.self\)/forEntityName: \1.entityName()/g' {} +
```
The goal is to have a single way to get the entity name so we can adapt
it to the new WordPressData setup in one go.
The goal is to have a single way to get the entity name so we can adapt it to the new WordPressData setup in one go.
Done via
```
find . \( -path './DerivedData' -o -path './.git' -o -path './vendor' \) \
-prune -o -type f -name "*.swift" \
-exec sed -i '' -E 's/forEntityName: ([A-Za-z_][A-Za-z0-9_]*)\.classNameWithoutNamespaces\(\)/forEntityName: \1.entityName()/g' {} +
```
The goal is to have a single way to get the entity name so we can adapt
it to the new WordPressData setup in one go.
* Move remaining types to WordPressData * Use Current Module for Swift-only types * Fix ReaderTeamTopic compilation * Add missing class names * Remove unused SiteInfo * Add Bundle.wordPressData and update DataMigratorTests * Update CoreDataMigrationTests * Fix unit tests (AppEnvironment required)
200048d to
200bb3e
Compare
| } | ||
|
|
||
| let startupEvent = SentryStartupEvent() | ||
| // FIXME: Import the Sentry stuff, too — But it accesses the app delegate! |
There was a problem hiding this comment.
| // FIXME: Crashes because WPAccount fixture sets username and triggers BuildSettings access | ||
| // func testThatPluginManagementIsEnabledForJetpack() { | ||
| // let blog = BlogBuilder(mainContext) | ||
| // .withAnAccount() | ||
| // .withJetpack(version: "5.6", username: "test_user", email: "user@example.com") | ||
| // .with(isHostedAtWPCom: false) | ||
| // .with(isAdmin: true) | ||
| // .build() | ||
| // | ||
| // XCTAssertTrue(blog.supports(.pluginManagement)) | ||
| // } |
There was a problem hiding this comment.
| /// Creates a Blog | ||
| /// | ||
| /// Defaults to creating a self-hosted blog | ||
| // FIXME: Currently duplicated from WordPressTests for ease of working. Eventually, should be extracted in a WordPressDataTestsHelper framework to share here and with the consumers. |
There was a problem hiding this comment.
|
| // EmitSwiftModule normal arm64 (in target 'WordPressNotificationServiceExtension' from project 'WordPress') | ||
| // cd /path/to/repo/WordPress | ||
| // | ||
| // <unknown>:0: error: missing required modules: 'CocoaLumberjack', 'CocoaLumberjackSwiftSupport' |
There was a problem hiding this comment.
(nit, let's address later) we now have WPLogging.h for use in non-app targets (or any targets)
There was a problem hiding this comment.
Noted. And tracked in https://linear.app/a8c/issue/AINFRA-424/adopt-wploggingh
| // | ||
| "BuildSettingsKit", | ||
| "FormattableContentKit", | ||
| "SFHFKeychainUtils", |
There was a problem hiding this comment.
This is duplicated dependency which produces a new warning.
| "SFHFKeychainUtils", |
There was a problem hiding this comment.
I didn't see this comment, but noticed the warning elsewhere and addressed via #24514
| GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| "DEBUG=1", | ||
| "$(inherited)", | ||
| "WPDATA=1", |
There was a problem hiding this comment.
Good catch! Thanks!




Builds on top of #24374, with standalone commits from #24375 and #24376, part of #24165.