Feed Statistics View

- Bugfix: group unread count fetch & undo / redo operations
- ModalSheet refactored
This commit is contained in:
relikd
2019-01-22 02:01:04 +01:00
parent f8961d9d34
commit d239f295cf
17 changed files with 551 additions and 121 deletions

View File

@@ -29,6 +29,7 @@
+ (instancetype)newFeedAndMetaInContext:(NSManagedObjectContext*)context;
+ (instancetype)appendToRootWithDefaultIntervalInContext:(NSManagedObjectContext*)moc;
- (void)calculateAndSetIndexPathString;
- (void)resetArticleCountAndIndexPathString;
- (void)updateWithRSS:(RSParsedFeed*)obj postUnreadCountChange:(BOOL)flag;
// Article properties
- (NSArray<FeedArticle*>*)sortedArticles;

View File

@@ -57,6 +57,17 @@
self.indexPath = pthStr;
}
/// Reset attributes @c articleCount, @c unreadCount, and @c indexPath.
- (void)resetArticleCountAndIndexPathString {
int16_t totalCount = (int16_t)self.articles.count;
int16_t unreadCount = (int16_t)[[self.articles valueForKeyPath:@"@sum.unread"] integerValue];
if (self.articleCount != totalCount)
self.articleCount = totalCount;
if (self.unreadCount != unreadCount)
self.unreadCount = unreadCount; // remember to update global total unread count
[self calculateAndSetIndexPathString];
}
#pragma mark - Update Feed Items -
@@ -144,6 +155,8 @@
fa.author = entry.author;
fa.link = entry.link;
fa.published = entry.datePublished;
if (!fa.published)
fa.published = entry.dateModified;
[self addArticlesObject:fa];
return fa;
}