Skip to content

Commit 14cef9c

Browse files
committed
Update fields that now became accessible as properties
1 parent 49fa6ca commit 14cef9c

File tree

9 files changed

+21
-27
lines changed

9 files changed

+21
-27
lines changed

WordPress/Classes/Models/ReaderPost.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,14 @@ extern NSString * const ReaderPostStoredCommentTextKey;
8383
+ (instancetype)createOrReplaceFromRemotePost:(RemoteReaderPost *)remotePost forTopic:(ReaderAbstractTopic *)topic context:(NSManagedObjectContext *) managedObjectContext;
8484

8585
- (BOOL)isCrossPost;
86-
- (BOOL)isPrivate;
8786
- (BOOL)isP2Type;
8887
- (NSString *)authorString;
8988
- (BOOL)contentIncludesFeaturedImage;
89+
- (NSURL *)siteIconForDisplayOfSize:(NSInteger)size;
90+
- (SourceAttributionStyle)sourceAttributionStyle;
91+
- (NSString *)sourceAuthorNameForDisplay;
92+
- (NSURL *)sourceAvatarURLForDisplay;
93+
- (NSString *)sourceBlogNameForDisplay;
9094
- (BOOL)isSourceAttributionWPCom;
9195
- (NSDictionary *)railcarDictionary;
9296

WordPress/Classes/Models/ReaderPost.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,6 @@ - (BOOL)isCrossPost
237237
return self.crossPostMeta != nil;
238238
}
239239

240-
- (BOOL)isAtomic
241-
{
242-
return self.isBlogAtomic;
243-
}
244-
245-
- (BOOL)isPrivate
246-
{
247-
return self.isBlogPrivate;
248-
}
249-
250240
- (BOOL)isP2Type
251241
{
252242
NSInteger orgID = [self.organizationID intValue];
@@ -431,7 +421,7 @@ - (NSDictionary *)railcarDictionary
431421
return nil;
432422
}
433423

434-
- (void) didSave {
424+
- (void)didSave {
435425
[super didSave];
436426

437427
// A ReaderCard can have either a post, or a list of topics, but not both.

WordPress/Classes/Networking/MediaHost+ReaderPost.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension MediaHost {
99
}
1010

1111
init(with post: ReaderPost, failure: (ReaderPostError) -> ()) {
12-
let isAccessibleThroughWPCom = post.isWPCom() || post.isJetpack()
12+
let isAccessibleThroughWPCom = post.isWPCom || post.isJetpack
1313

1414
// This is the only way in which we can obtain the username and authToken here.
1515
// It'd be nice if all data was associated with an account instead, for transparency
@@ -22,9 +22,9 @@ extension MediaHost {
2222

2323
self.init(
2424
isAccessibleThroughWPCom: isAccessibleThroughWPCom,
25-
isPrivate: post.isPrivate(),
26-
isAtomic: post.isAtomic(),
27-
siteID: post.siteID()?.intValue,
25+
isPrivate: post.isBlogPrivate,
26+
isAtomic: post.isBlogAtomic,
27+
siteID: post.siteID?.intValue,
2828
username: username,
2929
authToken: authToken,
3030
failure: { error in

WordPress/Classes/Services/CommentService.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ - (void)replyToPost:(ReaderPost *)post
684684
{
685685
// Create and optimistically save a comment, based on the current wpcom acct
686686
// post and content provided.
687-
BOOL isPrivateSite = post.isPrivate;
687+
BOOL isPrivateSite = post.isBlogPrivate;
688688
[self createHierarchicalCommentWithContent:content withParent:nil postObjectID:post.objectID siteID:post.siteID completion:^(NSManagedObjectID *commentID) {
689689
if (!commentID) {
690690
NSError *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{NSDebugDescriptionErrorKey: @"Failed to create a comment for a post"}];
@@ -737,7 +737,7 @@ - (void)replyToHierarchicalCommentWithID:(NSNumber *)commentID
737737
{
738738
// Create and optimistically save a comment, based on the current wpcom acct
739739
// post and content provided.
740-
BOOL isPrivateSite = post.isPrivate;
740+
BOOL isPrivateSite = post.isBlogPrivate;
741741
[self createHierarchicalCommentWithContent:content withParent:nil postObjectID:post.objectID siteID:post.siteID completion:^(NSManagedObjectID *commentObjectID) {
742742
if (!commentObjectID) {
743743
NSError *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{NSDebugDescriptionErrorKey: @"Failed to create a comment for a post"}];
@@ -1204,7 +1204,7 @@ - (BOOL)mergeHierarchicalComments:(NSArray *)comments forPage:(NSUInteger)page f
12041204

12051205
comment.depth = ancestors.count;
12061206
comment.post = post;
1207-
comment.content = [self sanitizeCommentContent:comment.content isPrivateSite:post.isPrivate];
1207+
comment.content = [self sanitizeCommentContent:comment.content isPrivateSite:post.isBlogPrivate];
12081208
[commentsToKeep addObject:comment];
12091209
}
12101210

WordPress/Classes/ViewRelated/Comments/ContentRenderer/RichCommentContentRenderer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private extension RichCommentContentRenderer {
7575
// We'll log the error, so we know it's there, but we won't halt execution.
7676
WordPressAppDelegate.crashLogging?.logError(error)
7777
})
78-
} else if let post = comment.post as? ReaderPost, post.isPrivate() {
78+
} else if let post = comment.post as? ReaderPost, post.isBlogPrivate {
7979
return MediaHost(with: post, failure: { error in
8080
// We'll log the error, so we know it's there, but we won't halt execution.
8181
WordPressAppDelegate.crashLogging?.logError(error)

WordPress/Classes/ViewRelated/Reader/Detail/Views/ReaderDetailToolbar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class ReaderDetailToolbar: UIView, NibLoadable {
259259
return
260260
}
261261

262-
reblogButton.isEnabled = ReaderHelpers.isLoggedIn() && !post.isPrivate()
262+
reblogButton.isEnabled = ReaderHelpers.isLoggedIn() && !post.isBlogPrivate
263263
WPStyleGuide.applyReaderReblogActionButtonStyle(reblogButton, showTitle: false)
264264

265265
configureActionButtonStyle(reblogButton)

WordPress/Classes/ViewRelated/Reader/ReaderHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ struct ReaderNotificationKeys {
226226

227227
// If the user is an admin on the post's site do not bump the page view unless
228228
// the the post is private.
229-
if !post.isPrivate() && isUserAdminOnSiteWithID(siteID) {
229+
if !post.isBlogPrivate && isUserAdminOnSiteWithID(siteID) {
230230
return
231231
}
232232

WordPress/Classes/ViewRelated/Reader/ReaderPost+Display.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import Foundation
33
extension ReaderPost {
44

55
var isCommentsEnabled: Bool {
6-
let usesWPComAPI = isWPCom() || isJetpack()
7-
let commentCount = commentCount()?.intValue ?? 0
6+
let usesWPComAPI = isWPCom || isJetpack
7+
let commentCount = commentCount?.intValue ?? 0
88
let hasComments = commentCount > 0
99

10-
return usesWPComAPI && (commentsOpen() || hasComments)
10+
return usesWPComAPI && (commentsOpen || hasComments)
1111
}
1212
}

WordPress/Classes/ViewRelated/Reader/ReaderPostCellViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ struct ReaderPostToolbarViewModel {
115115
isBookmarked: post.isSavedForLater,
116116
isCommentsEnabled: post.isCommentsEnabled,
117117
commentCount: post.commentCount?.intValue ?? 0,
118-
isLikesEnabled: post.isLikesEnabled(),
118+
isLikesEnabled: post.isLikesEnabled,
119119
likeCount: post.likeCount?.intValue ?? 0,
120-
isLiked: post.isLiked()
120+
isLiked: post.isLiked
121121
)
122122
}
123123
}

0 commit comments

Comments
 (0)