diff --git a/clients/ios/Classes/FeedDetailViewController.m b/clients/ios/Classes/FeedDetailViewController.m index 88d972db3..bbce6930f 100644 --- a/clients/ios/Classes/FeedDetailViewController.m +++ b/clients/ios/Classes/FeedDetailViewController.m @@ -46,6 +46,7 @@ @interface FeedDetailViewController () @property (nonatomic) UIActionSheet* actionSheet_; // add this line +@property (nonatomic) NSUInteger scrollingMarkReadRow; @end @@ -253,6 +254,7 @@ self.showImagePreview = [userPreferences boolForKey:@"story_list_preview_images"]; appDelegate.fontDescriptorTitleSize = nil; + self.scrollingMarkReadRow = NSNotFound; [self.storyTitlesTable reloadData]; } @@ -329,6 +331,7 @@ } appDelegate.originalStoryCount = (int)[appDelegate unreadCount]; + self.scrollingMarkReadRow = NSNotFound; if ((storiesCollection.isSocialRiverView || storiesCollection.isSocialView)) { @@ -1587,6 +1590,28 @@ heightForRowAtIndexPath:(NSIndexPath *)indexPath { [self fetchFeedDetail:storiesCollection.feedPage+1 withCallback:nil]; } } + + NSIndexPath *indexPath = [self.storyTitlesTable indexPathForRowAtPoint:self.storyTitlesTable.contentOffset]; + NSString *scrollPref = [[NSUserDefaults standardUserDefaults] stringForKey:@"default_scroll_read_filter"]; + + if (indexPath && [scrollPref isEqualToString:@"mark_on_scroll"]) { + NSUInteger topRow = indexPath.row; + + if (self.scrollingMarkReadRow == NSNotFound) { + self.scrollingMarkReadRow = topRow; + } else if (topRow > self.scrollingMarkReadRow) { + for (NSUInteger thisRow = self.scrollingMarkReadRow; thisRow < topRow; thisRow++) { + NSInteger storyIndex = [storiesCollection indexFromLocation:thisRow]; + NSDictionary *story = [[storiesCollection activeFeedStories] objectAtIndex:storyIndex]; + + if ([storiesCollection isStoryUnread:story]) { + [storiesCollection markStoryRead:story]; + } + } + + self.scrollingMarkReadRow = topRow; + } + } } - (void)changeIntelligence:(NSInteger)newLevel { diff --git a/clients/ios/Resources/Settings.bundle/Root.plist b/clients/ios/Resources/Settings.bundle/Root.plist index c04cb76c8..45d580f3a 100644 --- a/clients/ios/Resources/Settings.bundle/Root.plist +++ b/clients/ios/Resources/Settings.bundle/Root.plist @@ -70,6 +70,26 @@ Key default_feed_read_filter + + Type + PSMultiValueSpecifier + Title + Mark stories read on scroll + Titles + + Mark read when scrolling past + Don't automatically mark read + + DefaultValue + nothing + Values + + mark_on_scroll + nothing + + Key + default_scroll_read_filter + Type PSToggleSwitchSpecifier diff --git a/clients/ios/Resources/Settings.bundle/Root~ipad.plist b/clients/ios/Resources/Settings.bundle/Root~ipad.plist index 5eb0625f9..7e351194b 100644 --- a/clients/ios/Resources/Settings.bundle/Root~ipad.plist +++ b/clients/ios/Resources/Settings.bundle/Root~ipad.plist @@ -70,6 +70,26 @@ Key default_feed_read_filter + + Type + PSMultiValueSpecifier + Title + Mark stories read on scroll + Titles + + Mark read when scrolling past + Don't automatically mark read + + DefaultValue + nothing + Values + + mark_on_scroll + nothing + + Key + default_scroll_read_filter + Type PSMultiValueSpecifier