diff --git a/clients/ios/Classes/FeedsObjCViewController.m b/clients/ios/Classes/FeedsObjCViewController.m index 07b065458..20cfcde4f 100644 --- a/clients/ios/Classes/FeedsObjCViewController.m +++ b/clients/ios/Classes/FeedsObjCViewController.m @@ -1958,19 +1958,24 @@ heightForHeaderInSection:(NSInteger)section { } if (sender == nil) { - FeedTableCell *cell = (FeedTableCell *)[self tableView:feedTitlesTable cellForRowAtIndexPath:indexPath]; + NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:indexPath.section]; + id feedId = [[appDelegate.dictFolders objectForKey:folderName] objectAtIndex:indexPath.row]; + NSString *feedIdStr = [NSString stringWithFormat:@"%@", feedId]; + BOOL isInactive = appDelegate.dictInactiveFeeds[feedIdStr] != nil; - if ([cell.reuseIdentifier isEqualToString:@"BlankCellIdentifier"]) { + if (isInactive || [appDelegate isFolderOrParentCollapsed:folderName]) { foundNext = NO; } else { - NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:indexPath.section]; - id feedId = [[appDelegate.dictFolders objectForKey:folderName] objectAtIndex:indexPath.row]; - NSString *feedIdStr = [NSString stringWithFormat:@"%@", feedId]; - BOOL hasUnread = cell.positiveCount > 0 || cell.neutralCount > 0 || cell.negativeCount > 0; - BOOL isInactive = appDelegate.dictInactiveFeeds[feedIdStr] != nil; + FeedTableCell *cell = (FeedTableCell *)[self tableView:feedTitlesTable cellForRowAtIndexPath:indexPath]; - if (!hasUnread || isInactive) { + if ([cell.reuseIdentifier isEqualToString:@"BlankCellIdentifier"]) { foundNext = NO; + } else { + BOOL hasUnread = cell.positiveCount > 0 || cell.neutralCount > 0 || cell.negativeCount > 0; + + if (!hasUnread) { + foundNext = NO; + } } } } diff --git a/clients/ios/Classes/NewsBlurAppDelegate.h b/clients/ios/Classes/NewsBlurAppDelegate.h index 795768305..74d8815b4 100644 --- a/clients/ios/Classes/NewsBlurAppDelegate.h +++ b/clients/ios/Classes/NewsBlurAppDelegate.h @@ -415,7 +415,6 @@ SFSafariViewControllerDelegate> { - (UnreadCounts *)splitUnreadCountForFeed:(NSString *)feedId; - (UnreadCounts *)splitUnreadCountForFolder:(NSString *)folderName; - (NSDictionary *)markVisibleStoriesRead; -- (BOOL)isFolderCollapsed:(NSString *)folderName; - (void)markActiveFolderAllRead; - (void)markFeedAllRead:(id)feedId; @@ -451,6 +450,9 @@ SFSafariViewControllerDelegate> { + (int)computeStoryScore:(NSDictionary *)intelligence; - (NSString *)extractFolderName:(NSString *)folderName; - (NSString *)extractParentFolderName:(NSString *)folderName; +- (BOOL)hasParentFolder:(NSString *)folderName; +- (BOOL)isFolderCollapsed:(NSString *)folderName; +- (BOOL)isFolderOrParentCollapsed:(NSString *)folderName; - (NSArray *)parentFoldersForFeed:(NSString *)feedId; - (NSString *)feedIdWithoutSearchQuery:(NSString *)feedId; - (NSString *)searchQueryForFeedId:(NSString *)feedId; diff --git a/clients/ios/Classes/NewsBlurAppDelegate.m b/clients/ios/Classes/NewsBlurAppDelegate.m index 852218f3e..b187c7b21 100644 --- a/clients/ios/Classes/NewsBlurAppDelegate.m +++ b/clients/ios/Classes/NewsBlurAppDelegate.m @@ -2798,6 +2798,20 @@ return !![self.collapsedFolders objectForKey:folderName]; } +- (BOOL)isFolderOrParentCollapsed:(NSString *)folderName { + if ([self isFolderCollapsed:folderName]) { + return YES; + } + + if (![self hasParentFolder:folderName]) { + return NO; + } + + NSString *parentFolder = [self extractParentFolderName:folderName]; + + return [self isFolderOrParentCollapsed:parentFolder]; +} + #pragma mark - Story Management - (NSDictionary *)markVisibleStoriesRead { @@ -3342,6 +3356,10 @@ #pragma mark - Feed Management +- (BOOL)hasParentFolder:(NSString *)folderName { + return [folderName containsString:@" ▸ "]; +} + - (NSString *)extractParentFolderName:(NSString *)folderName { if ([folderName containsString:@"Top Level"] || [folderName isEqual:@"everything"] ||