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;
|
NSMutableArray * activeFeedStoryLocationIds;
|
||||||
NSDictionary * activeStory;
|
NSDictionary * activeStory;
|
||||||
NSURL * activeOriginalStoryURL;
|
NSURL * activeOriginalStoryURL;
|
||||||
|
|
||||||
int storyCount;
|
int storyCount;
|
||||||
int originalStoryCount;
|
int originalStoryCount;
|
||||||
NSInteger selectedIntelligence;
|
NSInteger selectedIntelligence;
|
||||||
|
|
@ -99,7 +100,8 @@
|
||||||
- (void)setStories:(NSArray *)activeFeedStoriesValue;
|
- (void)setStories:(NSArray *)activeFeedStoriesValue;
|
||||||
- (void)addStories:(NSArray *)stories;
|
- (void)addStories:(NSArray *)stories;
|
||||||
- (int)unreadCount;
|
- (int)unreadCount;
|
||||||
- (int)visibleUnreadCount;
|
- (int)unreadCountForFeed:(NSString *)feedId;
|
||||||
|
- (int)unreadCountForFolder:(NSString *)folderName;
|
||||||
- (void)markActiveStoryRead;
|
- (void)markActiveStoryRead;
|
||||||
- (void)markActiveFeedAllRead;
|
- (void)markActiveFeedAllRead;
|
||||||
- (void)calculateStoryLocations;
|
- (void)calculateStoryLocations;
|
||||||
|
|
|
||||||
|
|
@ -294,19 +294,50 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)unreadCount {
|
- (int)unreadCount {
|
||||||
|
if (self.isRiverView) {
|
||||||
|
return [self unreadCountForFolder:nil];
|
||||||
|
} else {
|
||||||
|
return [self unreadCountForFeed:nil];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (int)unreadCountForFeed:(NSString *)feedId {
|
||||||
int total = 0;
|
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) {
|
if ([self selectedIntelligence] <= 0) {
|
||||||
total += [[self.activeFeed objectForKey:@"nt"] intValue];
|
total += [[feed objectForKey:@"nt"] intValue];
|
||||||
}
|
}
|
||||||
if ([self selectedIntelligence] <= -1) {
|
if ([self selectedIntelligence] <= -1) {
|
||||||
total += [[self.activeFeed objectForKey:@"ng"] intValue];
|
total += [[feed objectForKey:@"ng"] intValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int)visibleUnreadCount {
|
- (int)unreadCountForFolder:(NSString *)folderName {
|
||||||
return 0;
|
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 {
|
- (void)addStories:(NSArray *)stories {
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
NewsBlurAppDelegate *appDelegate;
|
NewsBlurAppDelegate *appDelegate;
|
||||||
|
|
||||||
NSMutableDictionary * activeFeedLocations;
|
NSMutableDictionary * activeFeedLocations;
|
||||||
NSMutableDictionary *stillVisibleFeeds;
|
|
||||||
NSMutableDictionary *visibleFeeds;
|
NSMutableDictionary *visibleFeeds;
|
||||||
|
NSMutableDictionary *stillVisibleFeeds;
|
||||||
BOOL viewShowingAllFeeds;
|
BOOL viewShowingAllFeeds;
|
||||||
PullToRefreshView *pull;
|
PullToRefreshView *pull;
|
||||||
NSDate *lastUpdate;
|
NSDate *lastUpdate;
|
||||||
|
|
@ -66,8 +66,8 @@
|
||||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem * sitesButton;
|
@property (nonatomic, retain) IBOutlet UIBarButtonItem * sitesButton;
|
||||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem * addButton;
|
@property (nonatomic, retain) IBOutlet UIBarButtonItem * addButton;
|
||||||
@property (nonatomic, retain) NSMutableDictionary *activeFeedLocations;
|
@property (nonatomic, retain) NSMutableDictionary *activeFeedLocations;
|
||||||
@property (nonatomic, retain) NSMutableDictionary *stillVisibleFeeds;
|
|
||||||
@property (nonatomic, retain) NSMutableDictionary *visibleFeeds;
|
@property (nonatomic, retain) NSMutableDictionary *visibleFeeds;
|
||||||
|
@property (nonatomic, retain) NSMutableDictionary *stillVisibleFeeds;
|
||||||
@property (nonatomic, readwrite) BOOL viewShowingAllFeeds;
|
@property (nonatomic, readwrite) BOOL viewShowingAllFeeds;
|
||||||
@property (nonatomic, retain) PullToRefreshView *pull;
|
@property (nonatomic, retain) PullToRefreshView *pull;
|
||||||
@property (nonatomic, retain) NSDate *lastUpdate;
|
@property (nonatomic, retain) NSDate *lastUpdate;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
@synthesize logoutButton;
|
@synthesize logoutButton;
|
||||||
@synthesize intelligenceControl;
|
@synthesize intelligenceControl;
|
||||||
@synthesize activeFeedLocations;
|
@synthesize activeFeedLocations;
|
||||||
@synthesize stillVisibleFeeds;
|
|
||||||
@synthesize visibleFeeds;
|
@synthesize visibleFeeds;
|
||||||
|
@synthesize stillVisibleFeeds;
|
||||||
@synthesize sitesButton;
|
@synthesize sitesButton;
|
||||||
@synthesize addButton;
|
@synthesize addButton;
|
||||||
@synthesize viewShowingAllFeeds;
|
@synthesize viewShowingAllFeeds;
|
||||||
|
|
@ -163,8 +163,8 @@
|
||||||
[logoutButton release];
|
[logoutButton release];
|
||||||
[intelligenceControl release];
|
[intelligenceControl release];
|
||||||
[activeFeedLocations release];
|
[activeFeedLocations release];
|
||||||
[stillVisibleFeeds release];
|
|
||||||
[visibleFeeds release];
|
[visibleFeeds release];
|
||||||
|
[stillVisibleFeeds release];
|
||||||
[sitesButton release];
|
[sitesButton release];
|
||||||
[addButton release];
|
[addButton release];
|
||||||
[pull release];
|
[pull release];
|
||||||
|
|
@ -507,7 +507,6 @@ viewForHeaderInSection:(NSInteger)section {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)sectionTapped:(UIButton *)button {
|
- (IBAction)sectionTapped:(UIButton *)button {
|
||||||
NSLog(@"touch view: %@", button);
|
|
||||||
button.backgroundColor = [UIColor blackColor];
|
button.backgroundColor = [UIColor blackColor];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
[buttonPrevious setTitle:@"Previous"];
|
[buttonPrevious setTitle:@"Previous"];
|
||||||
}
|
}
|
||||||
|
|
||||||
float unreads = [appDelegate unreadCount];
|
float unreads = (float)[appDelegate unreadCount];
|
||||||
float total = [appDelegate originalStoryCount];
|
float total = [appDelegate originalStoryCount];
|
||||||
float progress = (total - unreads) / total;
|
float progress = (total - unreads) / total;
|
||||||
// NSLog(@"Total: %f / %f = %f", unreads, total, progress);
|
// NSLog(@"Total: %f / %f = %f", unreads, total, progress);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue