mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Saving stories, new saved stories view, and blue saved stories count. Just need to update saved stories count on save.
This commit is contained in:
parent
072077f0d3
commit
6f2141b62d
19 changed files with 242 additions and 62 deletions
|
@ -622,7 +622,7 @@ def load_starred_stories(request):
|
|||
story['read_status'] = 1
|
||||
story['starred'] = True
|
||||
story['intelligence'] = {
|
||||
'feed': 0,
|
||||
'feed': 1,
|
||||
'author': 0,
|
||||
'tags': 0,
|
||||
'title': 0,
|
||||
|
|
|
@ -16,5 +16,6 @@
|
|||
- (void) cancelRequests;
|
||||
|
||||
- (void)informError:(id)error;
|
||||
- (void)informMessage:(NSString *)message;
|
||||
|
||||
@end
|
||||
|
|
|
@ -82,6 +82,14 @@
|
|||
// [alertView release];
|
||||
}
|
||||
|
||||
- (void)informMessage:(NSString *)message {
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
||||
HUD.mode = MBProgressHUDModeText;
|
||||
HUD.labelText = message;
|
||||
[HUD hide:YES afterDelay:.75];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UIViewController
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@
|
|||
if ((appDelegate.isSocialRiverView ||
|
||||
appDelegate.isSocialView ||
|
||||
(appDelegate.isRiverView &&
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]))) {
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]) ||
|
||||
[appDelegate.activeFolder isEqualToString:@"saved_stories"])) {
|
||||
settingsButton.enabled = NO;
|
||||
} else {
|
||||
settingsButton.enabled = YES;
|
||||
|
@ -136,7 +137,8 @@
|
|||
|
||||
if (appDelegate.isSocialRiverView ||
|
||||
(appDelegate.isRiverView &&
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"])) {
|
||||
[appDelegate.activeFolder isEqualToString:@"everything"]) ||
|
||||
[appDelegate.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
feedMarkReadButton.enabled = NO;
|
||||
} else {
|
||||
feedMarkReadButton.enabled = YES;
|
||||
|
@ -277,6 +279,11 @@
|
|||
@"http://%@/social/river_stories/?page=%d&order=newest",
|
||||
NEWSBLUR_URL,
|
||||
self.feedPage];
|
||||
} else if (appDelegate.activeFolder == @"saved_stories") {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"http://%@/reader/starred_stories/?page=%d",
|
||||
NEWSBLUR_URL,
|
||||
self.feedPage];
|
||||
} else {
|
||||
theFeedDetailURL = [NSString stringWithFormat:
|
||||
@"http://%@/reader/river_stories/?feeds=%@&page=%d",
|
||||
|
@ -892,8 +899,8 @@
|
|||
NSArray *buttonTitles = nil;
|
||||
BOOL showVisible = YES;
|
||||
BOOL showEntire = YES;
|
||||
if ([appDelegate.activeFolder isEqualToString:@"Everything"]) showEntire = NO;
|
||||
if (visibleUnreadCount >= totalUnreadCount || visibleUnreadCount <= 0) showVisible = NO;
|
||||
if ([appDelegate.activeFolder isEqualToString:@"everything"]) showEntire = NO;
|
||||
if (visibleUnreadCount >= totalUnreadCount || visibleUnreadCount <= 0) showVisible = NO;
|
||||
NSString *entireText = [NSString stringWithFormat:@"Mark %@ read",
|
||||
appDelegate.isRiverView ?
|
||||
@"entire folder" :
|
||||
|
|
|
@ -54,6 +54,16 @@
|
|||
[unreadCount calculateOffsets:counts.ps nt:counts.nt];
|
||||
countWidth = [unreadCount offsetWidth];
|
||||
[self addSubview:unreadCount];
|
||||
} else if (folderName == @"saved_stories") {
|
||||
unreadCount = [[UnreadCountView alloc] initWithFrame:rect];
|
||||
unreadCount.appDelegate = appDelegate;
|
||||
unreadCount.opaque = NO;
|
||||
unreadCount.psCount = appDelegate.savedStoriesCount;
|
||||
unreadCount.blueCount = appDelegate.savedStoriesCount;
|
||||
|
||||
[unreadCount calculateOffsets:appDelegate.savedStoriesCount nt:0];
|
||||
countWidth = [unreadCount offsetWidth];
|
||||
[self addSubview:unreadCount];
|
||||
}
|
||||
|
||||
// create the parent view that will hold header Label
|
||||
|
@ -87,9 +97,11 @@
|
|||
UIFont *font = [UIFont boldSystemFontOfSize:11];
|
||||
NSString *folderTitle;
|
||||
if (section == 0) {
|
||||
folderTitle = @"ALL BLURBLOG STORIES";
|
||||
folderTitle = [@"All Blurblog Stories" uppercaseString];
|
||||
} else if (section == 1) {
|
||||
folderTitle = @"ALL STORIES";
|
||||
folderTitle = [@"All Stories" uppercaseString];
|
||||
} else if (folderName == @"saved_stories") {
|
||||
folderTitle = [@"Saved Stories" uppercaseString];
|
||||
} else {
|
||||
folderTitle = [[appDelegate.dictFoldersArray objectAtIndex:section] uppercaseString];
|
||||
}
|
||||
|
@ -119,7 +131,7 @@
|
|||
disclosureButton.frame = CGRectMake(customView.frame.size.width - 32, -1, 29, 29);
|
||||
|
||||
// Add collapse button to all folders except Everything
|
||||
if (section != 1) {
|
||||
if (section != 1 && folderName != @"saved_stories") {
|
||||
if (!isFolderCollapsed) {
|
||||
disclosureButton.transform = CGAffineTransformMakeRotation(M_PI_2);
|
||||
}
|
||||
|
@ -130,7 +142,7 @@
|
|||
UIImage *disclosureBorder = [UIImage imageNamed:@"disclosure_border.png"];
|
||||
[disclosureBorder drawInRect:CGRectMake(customView.frame.size.width - 32, -1, 29, 29)];
|
||||
} else {
|
||||
// Everything folder doesn't get a button
|
||||
// Everything/Saved folder doesn't get a button
|
||||
[disclosureButton setUserInteractionEnabled:NO];
|
||||
}
|
||||
[customView addSubview:disclosureButton];
|
||||
|
@ -153,6 +165,13 @@
|
|||
} else {
|
||||
folderImageViewX = 7;
|
||||
}
|
||||
} else if (folderName == @"saved_stories") {
|
||||
folderImage = [UIImage imageNamed:@"clock.png"];
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
folderImageViewX = 10;
|
||||
} else {
|
||||
folderImageViewX = 7;
|
||||
}
|
||||
} else {
|
||||
if (isFolderCollapsed) {
|
||||
folderImage = [UIImage imageNamed:@"folder_collapsed.png"];
|
||||
|
|
|
@ -147,17 +147,27 @@
|
|||
}
|
||||
|
||||
if (indexPath.row == 0) {
|
||||
cell.textLabel.text = [@"Save this story" uppercaseString];
|
||||
bool isSaved = [[appDelegate.activeStory objectForKey:@"starred"] boolValue];
|
||||
if (isSaved) {
|
||||
cell.textLabel.text = [@"Unsave this story" uppercaseString];
|
||||
} else {
|
||||
cell.textLabel.text = [@"Save this story" uppercaseString];
|
||||
}
|
||||
cell.imageView.image = [UIImage imageNamed:@"time"];
|
||||
} else if (indexPath.row == 1) {
|
||||
cell.textLabel.text = [@"Mark as unread" uppercaseString];
|
||||
bool isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
if (isRead) {
|
||||
cell.textLabel.text = [@"Mark as unread" uppercaseString];
|
||||
} else {
|
||||
cell.textLabel.text = [@"Mark as read" uppercaseString];
|
||||
}
|
||||
cell.imageView.image = [UIImage imageNamed:@"bullet_orange"];
|
||||
} else if (indexPath.row == 2) {
|
||||
cell.textLabel.text = [@"Share this story" uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"rainbow"];
|
||||
} else if (indexPath.row == 3) {
|
||||
cell.textLabel.text = [@"Send to..." uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"email"];
|
||||
} else if (indexPath.row == 3) {
|
||||
cell.textLabel.text = [@"Share this story" uppercaseString];
|
||||
cell.imageView.image = [UIImage imageNamed:@"rainbow"];
|
||||
}
|
||||
|
||||
return cell;
|
||||
|
@ -177,13 +187,23 @@
|
|||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.row == 0) {
|
||||
[appDelegate.storyDetailViewController markStoryAsSaved];
|
||||
bool isSaved = [[appDelegate.activeStory objectForKey:@"starred"] boolValue];
|
||||
if (isSaved) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnsaved];
|
||||
} else {
|
||||
[appDelegate.storyDetailViewController markStoryAsSaved];
|
||||
}
|
||||
} else if (indexPath.row == 1) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnread];
|
||||
bool isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
if (isRead) {
|
||||
[appDelegate.storyDetailViewController markStoryAsUnread];
|
||||
} else {
|
||||
[appDelegate.storyDetailViewController markStoryAsRead];
|
||||
}
|
||||
} else if (indexPath.row == 2) {
|
||||
[appDelegate.storyDetailViewController openShareDialog];
|
||||
} else if (indexPath.row == 3) {
|
||||
[appDelegate.storyDetailViewController openSendToDialog];
|
||||
} else if (indexPath.row == 3) {
|
||||
[appDelegate.storyDetailViewController openShareDialog];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@
|
|||
int originalStoryCount;
|
||||
NSInteger selectedIntelligence;
|
||||
int visibleUnreadCount;
|
||||
int savedStoriesCount;
|
||||
NSMutableArray * recentlyReadStories;
|
||||
NSMutableSet * recentlyReadFeeds;
|
||||
NSMutableArray * readStories;
|
||||
|
@ -178,6 +179,7 @@
|
|||
@property (readwrite) int storyCount;
|
||||
@property (readwrite) int originalStoryCount;
|
||||
@property (readwrite) int visibleUnreadCount;
|
||||
@property (readwrite) int savedStoriesCount;
|
||||
@property (readwrite) NSInteger selectedIntelligence;
|
||||
@property (readwrite) NSMutableArray * recentlyReadStories;
|
||||
@property (readwrite) NSMutableSet * recentlyReadFeeds;
|
||||
|
@ -255,6 +257,7 @@
|
|||
- (void)markStoryRead:(NSDictionary *)story feed:(NSDictionary *)feed;
|
||||
- (void)markStoryUnread:(NSString *)storyId feedId:(id)feedId;
|
||||
- (void)markStoryUnread:(NSDictionary *)story feed:(NSDictionary *)feed;
|
||||
- (void)markActiveStorySaved:(BOOL)saved;
|
||||
- (void)markActiveFeedAllRead;
|
||||
- (void)markActiveFolderAllRead;
|
||||
- (void)markFeedAllRead:(id)feedId;
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
@synthesize activeStory;
|
||||
@synthesize storyCount;
|
||||
@synthesize visibleUnreadCount;
|
||||
@synthesize savedStoriesCount;
|
||||
@synthesize originalStoryCount;
|
||||
@synthesize selectedIntelligence;
|
||||
@synthesize activeOriginalStoryURL;
|
||||
|
@ -150,6 +151,7 @@
|
|||
|
||||
- (void)viewDidLoad {
|
||||
self.visibleUnreadCount = 0;
|
||||
self.savedStoriesCount = 0;
|
||||
[self setRecentlyReadStories:[NSMutableArray array]];
|
||||
}
|
||||
|
||||
|
@ -552,6 +554,8 @@
|
|||
feedTitle = @"All Shared Stories";
|
||||
} else if ([self.activeFolder isEqualToString:@"everything"]) {
|
||||
feedTitle = @"All Stories";
|
||||
} else if ([self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
feedTitle = @"Saved Stories";
|
||||
} else {
|
||||
feedTitle = self.activeFolder;
|
||||
}
|
||||
|
@ -825,7 +829,6 @@
|
|||
NSArray *folder;
|
||||
|
||||
if ([[self.folderCountCache objectForKey:folderName] boolValue]) {
|
||||
NSLog(@"In folder count cache: %@", folderName);
|
||||
counts.ps = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-ps", folderName]] intValue];
|
||||
counts.nt = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-nt", folderName]] intValue];
|
||||
counts.ng = [[self.folderCountCache objectForKey:[NSString stringWithFormat:@"%@-ng", folderName]] intValue];
|
||||
|
@ -857,7 +860,6 @@
|
|||
if (!self.folderCountCache) {
|
||||
self.folderCountCache = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
NSLog(@"Saving to folder cache: %@", folderName);
|
||||
[self.folderCountCache setObject:[NSNumber numberWithBool:YES] forKey:folderName];
|
||||
[self.folderCountCache setObject:[NSNumber numberWithInt:counts.ps] forKey:[NSString stringWithFormat:@"%@-ps", folderName]];
|
||||
[self.folderCountCache setObject:[NSNumber numberWithInt:counts.nt] forKey:[NSString stringWithFormat:@"%@-nt", folderName]];
|
||||
|
@ -1174,6 +1176,27 @@
|
|||
self.activeFeed = newFeed;
|
||||
}
|
||||
|
||||
- (void)markActiveStorySaved:(BOOL)saved {
|
||||
NSLog(@"Save story: %@ --- %d", self.activeStory, saved);
|
||||
NSMutableDictionary *newStory = [self.activeStory mutableCopy];
|
||||
[newStory setValue:[NSNumber numberWithBool:saved] forKey:@"starred"];
|
||||
|
||||
self.activeStory = newStory;
|
||||
|
||||
// make the story as read in self.activeFeedStories
|
||||
NSString *newStoryIdStr = [NSString stringWithFormat:@"%@", [newStory valueForKey:@"id"]];
|
||||
NSMutableArray *newActiveFeedStories = [self.activeFeedStories mutableCopy];
|
||||
for (int i = 0; i < [newActiveFeedStories count]; i++) {
|
||||
NSMutableArray *thisStory = [[newActiveFeedStories objectAtIndex:i] mutableCopy];
|
||||
NSString *thisStoryIdStr = [NSString stringWithFormat:@"%@", [thisStory valueForKey:@"id"]];
|
||||
if ([newStoryIdStr isEqualToString:thisStoryIdStr]) {
|
||||
[newActiveFeedStories replaceObjectAtIndex:i withObject:newStory];
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.activeFeedStories = newActiveFeedStories;
|
||||
}
|
||||
|
||||
- (void)markActiveFeedAllRead {
|
||||
id feedId = [self.activeFeed objectForKey:@"id"];
|
||||
[self markFeedAllRead:feedId];
|
||||
|
@ -1377,6 +1400,8 @@
|
|||
titleLabel.text = [NSString stringWithFormat:@" All Shared Stories"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"everything"]) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" All Stories"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" Saved Stories"];
|
||||
} else if (self.isRiverView) {
|
||||
titleLabel.text = [NSString stringWithFormat:@" %@", self.activeFolder];
|
||||
} else if (self.isSocialView) {
|
||||
|
@ -1401,6 +1426,10 @@
|
|||
UIImage *titleImage;
|
||||
if (self.isSocialRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"group_white.png"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"everything"]) {
|
||||
titleImage = [UIImage imageNamed:@"archive_white.png"];
|
||||
} else if (self.isRiverView && [self.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleImage = [UIImage imageNamed:@"clock_white.png"];
|
||||
} else if (self.isRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"folder_white.png"];
|
||||
} else {
|
||||
|
|
|
@ -274,7 +274,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setTimeOutSeconds:30];
|
||||
[request startAsynchronous];
|
||||
NSLog(@"urlFeedList is %@", urlFeedList);
|
||||
|
||||
self.lastUpdate = [NSDate date];
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,8 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
JSONObjectWithData:responseData
|
||||
options:kNilOptions
|
||||
error:&error];
|
||||
|
||||
appDelegate.savedStoriesCount = [[results objectForKey:@"starred_count"] intValue];
|
||||
|
||||
// NSLog(@"results are %@", results);
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
self.stillVisibleFeeds = [NSMutableDictionary dictionary];
|
||||
|
@ -399,6 +400,10 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[allFolders setValue:[[NSArray alloc] init] forKey:@"everything"];
|
||||
}
|
||||
|
||||
if (appDelegate.savedStoriesCount) {
|
||||
[allFolders setValue:[[NSArray alloc] init] forKey:@"saved_stories"];
|
||||
}
|
||||
|
||||
appDelegate.dictFolders = allFolders;
|
||||
|
||||
// set up dictFeeds
|
||||
|
@ -450,6 +455,12 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
[appDelegate.dictFoldersArray removeObject:@"everything"];
|
||||
[appDelegate.dictFoldersArray insertObject:@"everything" atIndex:1];
|
||||
}
|
||||
|
||||
// Add Saved Stories folder
|
||||
if (appDelegate.savedStoriesCount) {
|
||||
[appDelegate.dictFoldersArray removeObject:@"saved_stories"];
|
||||
[appDelegate.dictFoldersArray insertObject:@"saved_stories" atIndex:appDelegate.dictFoldersArray.count];
|
||||
}
|
||||
|
||||
if (self.viewShowingAllFeeds) {
|
||||
[self calculateFeedLocations:NO];
|
||||
|
@ -683,7 +694,7 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
|
||||
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
|
||||
|
||||
return [[self.activeFeedLocations objectForKey:folderName] count];
|
||||
}
|
||||
|
||||
|
@ -868,13 +879,13 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
// NSString *folder = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
NSString *folderName = [appDelegate.dictFoldersArray objectAtIndex:section];
|
||||
// if ([[folder stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] length] == 0) {
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
if ([tableView.dataSource tableView:tableView numberOfRowsInSection:section] == 0 &&
|
||||
section != 1) {
|
||||
int rows = [tableView.dataSource tableView:tableView numberOfRowsInSection:section];
|
||||
if (rows == 0 && section != 1 && folderName != @"saved_stories") {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import "WEPopoverController.h"
|
||||
#import "BaseViewController.h"
|
||||
|
||||
@class NewsBlurAppDelegate;
|
||||
@class ASIHTTPRequest;
|
||||
|
||||
@interface StoryDetailViewController : UIViewController
|
||||
@interface StoryDetailViewController : BaseViewController
|
||||
<UIPopoverControllerDelegate, WEPopoverControllerDelegate,
|
||||
UIScrollViewDelegate> {
|
||||
NewsBlurAppDelegate *appDelegate;
|
||||
|
@ -78,7 +79,11 @@ UIScrollViewDelegate> {
|
|||
- (void)finishMarkAsRead:(ASIHTTPRequest *)request;
|
||||
- (void)openSendToDialog;
|
||||
- (void)markStoryAsUnread;
|
||||
- (void)finishMarkAsUnread:(ASIHTTPRequest *)request;
|
||||
- (void)markStoryAsSaved;
|
||||
- (void)finishMarkAsSaved:(ASIHTTPRequest *)request;
|
||||
- (void)markStoryAsUnsaved;
|
||||
- (void)finishMarkAsUnsaved:(ASIHTTPRequest *)request;
|
||||
- (void)openShareDialog;
|
||||
- (void)finishLikeComment:(ASIHTTPRequest *)request;
|
||||
- (void)subscribeToBlurblog;
|
||||
|
|
|
@ -889,6 +889,10 @@
|
|||
UIImage *titleImage;
|
||||
if (appDelegate.isSocialRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"group_white.png"];
|
||||
} else if (appDelegate.isRiverView && [appDelegate.activeFolder isEqualToString:@"everything"]) {
|
||||
titleImage = [UIImage imageNamed:@"archive_white.png"];
|
||||
} else if (appDelegate.isRiverView && [appDelegate.activeFolder isEqualToString:@"saved_stories"]) {
|
||||
titleImage = [UIImage imageNamed:@"clock_white.png"];
|
||||
} else if (appDelegate.isRiverView) {
|
||||
titleImage = [UIImage imageNamed:@"folder_white.png"];
|
||||
} else {
|
||||
|
@ -1182,7 +1186,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsRead:)];
|
||||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
@ -1214,7 +1218,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
[request setPostValue:[appDelegate.activeComment objectForKey:@"user_id"] forKey:@"comment_user_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishLikeComment:)];
|
||||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
@ -1254,14 +1258,21 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
|
||||
|
||||
- (void)requestFailed:(ASIHTTPRequest *)request {
|
||||
NSLog(@"Error in mark as read is %@", [request error]);
|
||||
NSLog(@"Error in story detail: %@", [request error]);
|
||||
NSString *error;
|
||||
if ([request error]) {
|
||||
error = [NSString stringWithFormat:@"%@", [request error]];
|
||||
} else {
|
||||
error = @"The server barfed!";
|
||||
}
|
||||
[self informError:error];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsRead:(ASIHTTPRequest *)request {
|
||||
// NSString *responseString = [request responseString];
|
||||
// NSDictionary *results = [[NSDictionary alloc]
|
||||
// initWithDictionary:[responseString JSONValue]];
|
||||
// NSLog(@"results in mark as read is %@", results);
|
||||
// NSString *responseString = [request responseString];
|
||||
// NSDictionary *results = [[NSDictionary alloc]
|
||||
// initWithDictionary:[responseString JSONValue]];
|
||||
// NSLog(@"results in mark as read is %@", results);
|
||||
}
|
||||
|
||||
- (void)openSendToDialog {
|
||||
|
@ -1300,15 +1311,68 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)markStoryAsSaved {
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_starred",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"id"]
|
||||
forKey:@"story_id"];
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsSaved:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsSaved:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
[appDelegate markActiveStorySaved:YES];
|
||||
[self informMessage:@"This story is now saved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnsaved {
|
||||
// [appDelegate markActiveStoryUnread];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_unstarred",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
|
||||
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"id"]
|
||||
forKey:@"story_id"];
|
||||
[request setPostValue:[appDelegate.activeStory
|
||||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsUnsaved:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
}
|
||||
|
||||
- (void)finishMarkAsUnsaved:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
// [appDelegate markActiveStoryUnread];
|
||||
// [appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[appDelegate markActiveStorySaved:NO];
|
||||
[self informMessage:@"This story is no longer saved"];
|
||||
}
|
||||
|
||||
- (void)markStoryAsUnread {
|
||||
if ([[appDelegate.activeStory objectForKey:@"read_status"] intValue] == 1) {
|
||||
NSLog(@"Read status: %@", [appDelegate.activeStory objectForKey:@"read_status"]);
|
||||
|
||||
[appDelegate markActiveStoryUnread];
|
||||
|
||||
NSString *urlString = [NSString stringWithFormat:@"http://%@/reader/mark_story_as_unread",
|
||||
NEWSBLUR_URL];
|
||||
NSURL *url = [NSURL URLWithString:urlString];
|
||||
|
@ -1321,14 +1385,22 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
objectForKey:@"story_feed_id"]
|
||||
forKey:@"feed_id"];
|
||||
|
||||
[request setDidFinishSelector:@selector(finishMarkAsRead:)];
|
||||
[request setDidFailSelector:@selector(finishedWithError:)];
|
||||
[request setDidFinishSelector:@selector(finishMarkAsUnread:)];
|
||||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request setDelegate:self];
|
||||
[request startAsynchronous];
|
||||
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)finishMarkAsUnread:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] != 200) {
|
||||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
[appDelegate markActiveStoryUnread];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[self informMessage:@"This story is now unread"];
|
||||
}
|
||||
|
||||
# pragma mark
|
||||
|
|
|
@ -26,6 +26,7 @@ typedef enum {
|
|||
@property (assign, nonatomic) int ntPadding;
|
||||
@property (assign, nonatomic) int psCount;
|
||||
@property (assign, nonatomic) int ntCount;
|
||||
@property (assign, nonatomic) int blueCount;
|
||||
@property (assign, nonatomic) CGRect rect;
|
||||
|
||||
- (void)drawInRect:(CGRect)r ps:(int)ps nt:(int)nt listType:(NBFeedListType)listType;
|
||||
|
|
|
@ -16,12 +16,13 @@ static UIColor *indicatorBlackColor = nil;
|
|||
static UIColor *positiveBackgroundColor = nil;
|
||||
static UIColor *neutralBackgroundColor = nil;
|
||||
static UIColor *negativeBackgroundColor = nil;
|
||||
static UIColor *blueBackgroundColor = nil;
|
||||
|
||||
@implementation UnreadCountView
|
||||
|
||||
@synthesize appDelegate;
|
||||
@synthesize psWidth, psPadding, ntWidth, ntPadding;
|
||||
@synthesize psCount, ntCount;
|
||||
@synthesize psCount, ntCount, blueCount;
|
||||
@synthesize rect;
|
||||
|
||||
+ (void) initialize {
|
||||
|
@ -33,9 +34,11 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
UIColor *ps = UIColorFromRGB(0x3B7613);
|
||||
UIColor *nt = UIColorFromRGB(0xF9C72A);
|
||||
UIColor *ng = UIColorFromRGB(0xCC2A2E);
|
||||
UIColor *blue = UIColorFromRGB(0x11448B);
|
||||
positiveBackgroundColor = ps;
|
||||
neutralBackgroundColor = nt;
|
||||
negativeBackgroundColor = ng;
|
||||
blueBackgroundColor = blue;
|
||||
// UIColor *psGrad = UIColorFromRGB(0x559F4D);
|
||||
// UIColor *ntGrad = UIColorFromRGB(0xE4AB00);
|
||||
// UIColor *ngGrad = UIColorFromRGB(0x9B181B);
|
||||
|
@ -66,8 +69,12 @@ static UIColor *negativeBackgroundColor = nil;
|
|||
int psOffset = ps == 0 ? 0 : psWidth - 20;
|
||||
int ntOffset = nt == 0 ? 0 : ntWidth - 20;
|
||||
|
||||
if (ps > 0) {
|
||||
[positiveBackgroundColor set];
|
||||
if (ps > 0 || blueCount) {
|
||||
if (blueCount) {
|
||||
[blueBackgroundColor set];
|
||||
} else {
|
||||
[positiveBackgroundColor set];
|
||||
}
|
||||
CGRect rr;
|
||||
|
||||
if (listType == NBFeedListSocial) {
|
||||
|
|
|
@ -361,6 +361,9 @@
|
|||
FF41309D162CEC7100DDB6A7 /* time.png in Resources */ = {isa = PBXBuildFile; fileRef = FF41309C162CEC7100DDB6A7 /* time.png */; };
|
||||
FF4130A0162CECAE00DDB6A7 /* email.png in Resources */ = {isa = PBXBuildFile; fileRef = FF41309F162CECAE00DDB6A7 /* email.png */; };
|
||||
FF4130A3162E10CF00DDB6A7 /* MenuTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FF4130A2162E10CF00DDB6A7 /* MenuTableViewCell.m */; };
|
||||
FF4130A5162F3AA900DDB6A7 /* clock.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130A4162F3AA900DDB6A7 /* clock.png */; };
|
||||
FF4130A9162F3BD300DDB6A7 /* clock_white.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130A8162F3BD300DDB6A7 /* clock_white.png */; };
|
||||
FF4130AB162F3C2F00DDB6A7 /* archive_white.png in Resources */ = {isa = PBXBuildFile; fileRef = FF4130AA162F3C2F00DDB6A7 /* archive_white.png */; };
|
||||
FF546DF71602930100948020 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FF546DF61602930100948020 /* Default-568h@2x.png */; };
|
||||
FF546DF9160298E500948020 /* fleuron@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FF546DF8160298E500948020 /* fleuron@2x.png */; };
|
||||
FF5EA47F143B691000B7563D /* AddSiteViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FF5EA47D143B691000B7563D /* AddSiteViewController.m */; };
|
||||
|
@ -886,6 +889,9 @@
|
|||
FF41309F162CECAE00DDB6A7 /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = email.png; sourceTree = "<group>"; };
|
||||
FF4130A1162E10CF00DDB6A7 /* MenuTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuTableViewCell.h; sourceTree = "<group>"; };
|
||||
FF4130A2162E10CF00DDB6A7 /* MenuTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuTableViewCell.m; sourceTree = "<group>"; };
|
||||
FF4130A4162F3AA900DDB6A7 /* clock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock.png; sourceTree = "<group>"; };
|
||||
FF4130A8162F3BD300DDB6A7 /* clock_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = clock_white.png; sourceTree = "<group>"; };
|
||||
FF4130AA162F3C2F00DDB6A7 /* archive_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = archive_white.png; sourceTree = "<group>"; };
|
||||
FF546DF61602930100948020 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||
FF546DF8160298E500948020 /* fleuron@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "fleuron@2x.png"; sourceTree = "<group>"; };
|
||||
FF5EA47C143B691000B7563D /* AddSiteViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddSiteViewController.h; sourceTree = "<group>"; };
|
||||
|
@ -1175,6 +1181,9 @@
|
|||
431B857615A132B600DCE497 /* Images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FF4130AA162F3C2F00DDB6A7 /* archive_white.png */,
|
||||
FF4130A8162F3BD300DDB6A7 /* clock_white.png */,
|
||||
FF4130A4162F3AA900DDB6A7 /* clock.png */,
|
||||
FF41309F162CECAE00DDB6A7 /* email.png */,
|
||||
FF41309C162CEC7100DDB6A7 /* time.png */,
|
||||
FF5F3A8A162B8390008DBE3E /* car.png */,
|
||||
|
@ -2168,6 +2177,9 @@
|
|||
FF5F3A8B162B8390008DBE3E /* car.png in Resources */,
|
||||
FF41309D162CEC7100DDB6A7 /* time.png in Resources */,
|
||||
FF4130A0162CECAE00DDB6A7 /* email.png in Resources */,
|
||||
FF4130A5162F3AA900DDB6A7 /* clock.png in Resources */,
|
||||
FF4130A9162F3BD300DDB6A7 /* clock_white.png in Resources */,
|
||||
FF4130AB162F3C2F00DDB6A7 /* archive_white.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -2,21 +2,6 @@
|
|||
<Bucket
|
||||
type = "1"
|
||||
version = "1.0">
|
||||
<FileBreakpoints>
|
||||
<FileBreakpoint
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Classes/NewsBlurViewController.m"
|
||||
timestampString = "371953230.901928"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "600"
|
||||
endingLineNumber = "600"
|
||||
landmarkName = "-switchSitesUnread"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
</FileBreakpoints>
|
||||
<SymbolicBreakpoints>
|
||||
<SymbolicBreakpoint
|
||||
shouldBeEnabled = "Yes"
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// #define BACKGROUND_REFRESH_SECONDS -5
|
||||
#define BACKGROUND_REFRESH_SECONDS -10*60
|
||||
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
|
||||
#define NEWSBLUR_LINK_COLOR 0x405BA8
|
||||
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd
|
||||
|
|
BIN
media/ios/Resources/archive_white.png
Normal file
BIN
media/ios/Resources/archive_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
media/ios/Resources/clock.png
Normal file
BIN
media/ios/Resources/clock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
media/ios/Resources/clock_white.png
Normal file
BIN
media/ios/Resources/clock_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
Loading…
Add table
Reference in a new issue