mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing next/prewvious buttons in River view to include all unread stories and gracefully load new stories in river (iOS).
This commit is contained in:
parent
58e8263bcd
commit
7405d927d7
5 changed files with 44 additions and 12 deletions
|
@ -36,6 +36,7 @@
|
|||
NSMutableArray * activeFeedStoryLocationIds;
|
||||
NSDictionary * activeStory;
|
||||
NSURL * activeOriginalStoryURL;
|
||||
|
||||
int storyCount;
|
||||
int originalStoryCount;
|
||||
NSInteger selectedIntelligence;
|
||||
|
@ -99,7 +100,8 @@
|
|||
- (void)setStories:(NSArray *)activeFeedStoriesValue;
|
||||
- (void)addStories:(NSArray *)stories;
|
||||
- (int)unreadCount;
|
||||
- (int)visibleUnreadCount;
|
||||
- (int)unreadCountForFeed:(NSString *)feedId;
|
||||
- (int)unreadCountForFolder:(NSString *)folderName;
|
||||
- (void)markActiveStoryRead;
|
||||
- (void)markActiveFeedAllRead;
|
||||
- (void)calculateStoryLocations;
|
||||
|
|
|
@ -294,19 +294,50 @@
|
|||
}
|
||||
|
||||
- (int)unreadCount {
|
||||
if (self.isRiverView) {
|
||||
return [self unreadCountForFolder:nil];
|
||||
} else {
|
||||
return [self unreadCountForFeed:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (int)unreadCountForFeed:(NSString *)feedId {
|
||||
int total = 0;
|
||||
total += [[self.activeFeed objectForKey:@"ps"] intValue];
|
||||
NSDictionary *feed;
|
||||
|
||||
if (feedId) {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
|
||||
feed = [self.dictFeeds objectForKey:feedIdStr];
|
||||
} else {
|
||||
feed = self.activeFeed;
|
||||
}
|
||||
|
||||
total += [[feed objectForKey:@"ps"] intValue];
|
||||
if ([self selectedIntelligence] <= 0) {
|
||||
total += [[self.activeFeed objectForKey:@"nt"] intValue];
|
||||
total += [[feed objectForKey:@"nt"] intValue];
|
||||
}
|
||||
if ([self selectedIntelligence] <= -1) {
|
||||
total += [[self.activeFeed objectForKey:@"ng"] intValue];
|
||||
total += [[feed objectForKey:@"ng"] intValue];
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
- (int)visibleUnreadCount {
|
||||
return 0;
|
||||
- (int)unreadCountForFolder:(NSString *)folderName {
|
||||
int total = 0;
|
||||
NSArray *folder;
|
||||
|
||||
if (!folderName) {
|
||||
folder = [self.dictFolders objectForKey:self.activeFolder];
|
||||
} else {
|
||||
folder = [self.dictFolders objectForKey:folderName];
|
||||
}
|
||||
|
||||
for (id feedId in folder) {
|
||||
total += [self unreadCountForFeed:feedId];
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
- (void)addStories:(NSArray *)stories {
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
NewsBlurAppDelegate *appDelegate;
|
||||
|
||||
NSMutableDictionary * activeFeedLocations;
|
||||
NSMutableDictionary *stillVisibleFeeds;
|
||||
NSMutableDictionary *visibleFeeds;
|
||||
NSMutableDictionary *stillVisibleFeeds;
|
||||
BOOL viewShowingAllFeeds;
|
||||
PullToRefreshView *pull;
|
||||
NSDate *lastUpdate;
|
||||
|
@ -66,8 +66,8 @@
|
|||
@property (nonatomic, retain) IBOutlet UIBarButtonItem * sitesButton;
|
||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem * addButton;
|
||||
@property (nonatomic, retain) NSMutableDictionary *activeFeedLocations;
|
||||
@property (nonatomic, retain) NSMutableDictionary *stillVisibleFeeds;
|
||||
@property (nonatomic, retain) NSMutableDictionary *visibleFeeds;
|
||||
@property (nonatomic, retain) NSMutableDictionary *stillVisibleFeeds;
|
||||
@property (nonatomic, readwrite) BOOL viewShowingAllFeeds;
|
||||
@property (nonatomic, retain) PullToRefreshView *pull;
|
||||
@property (nonatomic, retain) NSDate *lastUpdate;
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
@synthesize logoutButton;
|
||||
@synthesize intelligenceControl;
|
||||
@synthesize activeFeedLocations;
|
||||
@synthesize stillVisibleFeeds;
|
||||
@synthesize visibleFeeds;
|
||||
@synthesize stillVisibleFeeds;
|
||||
@synthesize sitesButton;
|
||||
@synthesize addButton;
|
||||
@synthesize viewShowingAllFeeds;
|
||||
|
@ -163,8 +163,8 @@
|
|||
[logoutButton release];
|
||||
[intelligenceControl release];
|
||||
[activeFeedLocations release];
|
||||
[stillVisibleFeeds release];
|
||||
[visibleFeeds release];
|
||||
[stillVisibleFeeds release];
|
||||
[sitesButton release];
|
||||
[addButton release];
|
||||
[pull release];
|
||||
|
@ -507,7 +507,6 @@ viewForHeaderInSection:(NSInteger)section {
|
|||
}
|
||||
|
||||
- (IBAction)sectionTapped:(UIButton *)button {
|
||||
NSLog(@"touch view: %@", button);
|
||||
button.backgroundColor = [UIColor blackColor];
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
[buttonPrevious setTitle:@"Previous"];
|
||||
}
|
||||
|
||||
float unreads = [appDelegate unreadCount];
|
||||
float unreads = (float)[appDelegate unreadCount];
|
||||
float total = [appDelegate originalStoryCount];
|
||||
float progress = (total - unreads) / total;
|
||||
// NSLog(@"Total: %f / %f = %f", unreads, total, progress);
|
||||
|
|
Loading…
Add table
Reference in a new issue