Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions MIGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
This file documents changes in the data model. Please explain any changes to the
data model as well as any custom migrations.

## WordPress 156

@kean 2025-10-08

- Remove unused `AbstactPost` properties: `metaIsLocal`, `metaPublishImmediatelly`, `statusAfterSync`, `confirmedChangesHash`
- Remove unused `Blog` properties: `rawBlockEditorSettings`
- Remove unused `BlobEntity`
- Add `metadata` field to `AbstractPost`
- Add `commentsStatus` and `pingsStatus` to `Post`
- Add `formattedSize` to `Media`

## WordPress 155

@crazytonyli 2025-04-07
Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/WordPressKitObjC/MediaServiceRemoteREST.m
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ + (RemoteMedia *)remoteMediaFromJSONDictionary:(NSDictionary *)jsonMedia
remoteMedia.remoteThumbnailURL = [jsonMedia stringForKeyPath:@"thumbnails.fmt_std"];
remoteMedia.videopressGUID = [jsonMedia stringForKey:@"videopress_guid"];
remoteMedia.length = [jsonMedia numberForKey:@"length"];
remoteMedia.formattedSize = [jsonMedia stringForKey:@"size"];
return remoteMedia;
}

Expand Down
2 changes: 2 additions & 0 deletions Modules/Sources/WordPressKitObjC/PostServiceRemoteREST.m
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ + (RemotePost *)remotePostFromJSONDictionary:(NSDictionary *)jsonPost {
post.format = jsonPost[@"format"];
post.order = [jsonPost numberForKey:@"menu_order"].integerValue;

post.commentsStatus = [jsonPost stringForKeyPath:@"discussion.comment_status"];
post.pingsStatus = [jsonPost stringForKeyPath:@"discussion.ping_status"];
post.commentCount = [jsonPost numberForKeyPath:@"discussion.comment_count"] ?: @0;
post.likeCount = [jsonPost numberForKeyPath:@"like_count"] ?: @0;

Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/WordPressKitObjC/include/RemoteMedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
@property (nonatomic, strong, nullable) NSString *videopressGUID;
@property (nonatomic, strong, nullable) NSNumber *length;
@property (nonatomic, strong, nullable) NSString *remoteThumbnailURL;
@property (nonatomic, strong, nullable) NSString *formattedSize;

@end
2 changes: 2 additions & 0 deletions Modules/Sources/WordPressKitObjC/include/RemotePost.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ extern NSString * const PostStatusDeleted;
*/
@property (nonatomic, strong) RemotePostAutosave *autosave;

@property (nonatomic, strong) NSString *commentsStatus;
@property (nonatomic, strong) NSString *pingsStatus;
@property (nonatomic, strong) NSNumber *commentCount;
@property (nonatomic, strong) NSNumber *likeCount;

Expand Down
1 change: 1 addition & 0 deletions Sources/WordPressData/Objective-C/AbstractPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ @implementation AbstractPost
@dynamic autosaveIdentifier;
@dynamic foreignID;
@dynamic order;
@dynamic rawMetadata;
@synthesize voiceContent;

#pragma mark - Life Cycle Methods
Expand Down
1 change: 0 additions & 1 deletion Sources/WordPressData/Objective-C/Blog.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ @implementation Blog
@dynamic quotaSpaceUsed;
@dynamic pageTemplateCategories;
@dynamic publicizeInfo;
@dynamic rawBlockEditorSettings;

@synthesize videoPressEnabled;
@synthesize xmlrpcApi = _xmlrpcApi;
Expand Down
1 change: 1 addition & 0 deletions Sources/WordPressData/Objective-C/Media.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ @implementation Media
@dynamic height;
@dynamic filename;
@dynamic filesize;
@dynamic formattedSize;
@dynamic creationDate;
@dynamic blog;
@dynamic posts;
Expand Down
4 changes: 4 additions & 0 deletions Sources/WordPressData/Objective-C/PostHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ + (void)updatePost:(AbstractPost *)post withRemotePost:(RemotePost *)remotePost
[self updateCommentsForPost:post];
}

post.rawMetadata = [PostHelper makeRawMetadataFrom:remotePost];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will now simply store everything, so it'll be easy to add more features that rely on metadata in the future if needed. I also plan to add couple of convenience APIs to make it easier to parse it and find the options you need.


post.autosaveTitle = remotePost.autosave.title;
post.autosaveExcerpt = remotePost.autosave.excerpt;
post.autosaveContent = remotePost.autosave.content;
Expand All @@ -69,6 +71,8 @@ + (void)updatePost:(AbstractPost *)post withRemotePost:(RemotePost *)remotePost
pagePost.foreignID = remotePost.foreignID;
} else if ([post isKindOfClass:[Post class]]) {
Post *postPost = (Post *)post;
postPost.commentsStatus = remotePost.commentsStatus;
postPost.pingsStatus = remotePost.pingsStatus;
postPost.commentCount = remotePost.commentCount;
postPost.likeCount = remotePost.likeCount;
postPost.postFormat = remotePost.format;
Expand Down
4 changes: 4 additions & 0 deletions Sources/WordPressData/Objective-C/include/AbstractPost.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ typedef NS_ENUM(NSUInteger, AbstractPostRemoteStatus) {

@property (nonatomic, strong, nullable) NSDate *confirmedChangesTimestamp;

/// Contains all the custom metadata associated with a post, including the
/// Jetpack plugin metadata.`
@property (nonatomic, strong, nullable) NSData *rawMetadata;

@property (nonatomic, strong, nullable) NSString *voiceContent;

// Revision management
Expand Down
2 changes: 0 additions & 2 deletions Sources/WordPressData/Objective-C/include/Blog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ NS_ASSUME_NONNULL_BEGIN
@class SiteSuggestion;
@class PageTemplateCategory;
@class PublicizeInfo;
@class BlobEntity;
@class PostCategory;
@class PostTag;
@class PublicizeConnection;
Expand Down Expand Up @@ -179,7 +178,6 @@ typedef NS_ENUM(NSInteger, SiteVisibility) {
@property (nonatomic, strong, readwrite, nullable) NSNumber *quotaSpaceAllowed;
@property (nonatomic, strong, readwrite, nullable) NSNumber *quotaSpaceUsed;
@property (nullable, nonatomic, retain) NSSet<PageTemplateCategory *> *pageTemplateCategories;
@property (nonatomic, strong, readwrite, nullable) BlobEntity *rawBlockEditorSettings __deprecated_msg("Use BlockEditorCache instead");;

/**
* @details Maps to a BlogSettings instance, which contains a collection of the available preferences,
Expand Down
1 change: 1 addition & 0 deletions Sources/WordPressData/Objective-C/include/Media.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ typedef NS_ENUM(NSUInteger, MediaType) {
@property (nonatomic, strong, nullable) NSString *desc;
@property (nonatomic, strong, nullable) NSString *filename;
@property (nonatomic, strong, nullable) NSNumber *filesize;
@property (nonatomic, strong, nullable) NSString *formattedSize;
@property (nonatomic, strong, nullable) NSNumber *height;
@property (nonatomic, strong, nullable) NSNumber *length;
@property (nonatomic, strong, nullable) NSString *localThumbnailIdentifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>WordPress 155.xcdatamodel</string>
<string>WordPress 156.xcdatamodel</string>
</dict>
</plist>
Loading