iOS: done #767 (mark read on scroll)

This commit is contained in:
David Sinclair 2015-11-09 14:51:12 -08:00
parent 2dd7214925
commit b535b6d87f
3 changed files with 65 additions and 0 deletions

View file

@ -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 {

View file

@ -70,6 +70,26 @@
<key>Key</key>
<string>default_feed_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Mark stories read on scroll</string>
<key>Titles</key>
<array>
<string>Mark read when scrolling past</string>
<string>Don't automatically mark read</string>
</array>
<key>DefaultValue</key>
<string>nothing</string>
<key>Values</key>
<array>
<string>mark_on_scroll</string>
<string>nothing</string>
</array>
<key>Key</key>
<string>default_scroll_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>

View file

@ -70,6 +70,26 @@
<key>Key</key>
<string>default_feed_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Mark stories read on scroll</string>
<key>Titles</key>
<array>
<string>Mark read when scrolling past</string>
<string>Don't automatically mark read</string>
</array>
<key>DefaultValue</key>
<string>nothing</string>
<key>Values</key>
<array>
<string>mark_on_scroll</string>
<string>nothing</string>
</array>
<key>Key</key>
<string>default_scroll_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>