mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-11-01 09:09:51 +00:00
actions for interactions module
This commit is contained in:
parent
65a32da504
commit
8308a2929f
9 changed files with 194 additions and 72 deletions
|
|
@ -16,5 +16,6 @@
|
|||
@property (retain, nonatomic) OHAttributedLabel *activityLabel;
|
||||
|
||||
- (int)refreshActivity:(NSDictionary *)activity withUsername:(NSString *)username;
|
||||
- (NSString *)stripFormatting:(NSString *)str;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@
|
|||
|
||||
- (int)refreshActivity:(NSDictionary *)activity withUsername:(NSString *)username {
|
||||
self.activityLabel = [[[OHAttributedLabel alloc] init] autorelease];
|
||||
self.activityLabel.frame = CGRectMake(10, 10, 280, 80);
|
||||
self.activityLabel.frame = CGRectMake(10, 10, 280, 120);
|
||||
self.activityLabel.backgroundColor = [UIColor clearColor];
|
||||
|
||||
NSString *category = [activity objectForKey:@"category"];
|
||||
NSString *content = [activity objectForKey:@"content"];
|
||||
NSString *title = [activity objectForKey:@"title"];
|
||||
NSString *title = [self stripFormatting:[NSString stringWithFormat:@"%@", [activity objectForKey:@"title"]]];
|
||||
|
||||
if ([category isEqualToString:@"follow"]) {
|
||||
|
||||
|
|
@ -67,9 +67,10 @@
|
|||
self.activityLabel.attributedText = attrStr;
|
||||
|
||||
} else if ([category isEqualToString:@"comment_reply"]) {
|
||||
NSString *comment = [NSString stringWithFormat:@"\"%@\"", content];
|
||||
NSString *withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"];
|
||||
|
||||
NSString* txt = [NSString stringWithFormat:@"%@ replied to %@:\n\"%@\"", username, withUserUsername, content];
|
||||
NSString* txt = [NSString stringWithFormat:@"%@ replied to %@: %@", username, withUserUsername, comment];
|
||||
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:txt];
|
||||
|
||||
[attrStr setFont:[UIFont fontWithName:@"Helvetica" size:14]];
|
||||
|
|
@ -83,12 +84,37 @@
|
|||
[attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txt rangeOfString:withUserUsername]];
|
||||
[attrStr setTextBold:YES range:[txt rangeOfString:withUserUsername]];
|
||||
|
||||
[attrStr setFont:[UIFont fontWithName:@"Helvetica" size:13] range:[txt rangeOfString:content]];
|
||||
[attrStr setTextColor:UIColorFromRGB(0x999999) range:[txt rangeOfString:comment]];
|
||||
|
||||
self.activityLabel.attributedText = attrStr;
|
||||
|
||||
} else if ([category isEqualToString:@"comment_like"]) {
|
||||
NSString *comment = [NSString stringWithFormat:@"\"%@\"", content];
|
||||
NSString *withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"];
|
||||
NSString* txt = [NSString stringWithFormat:@"%@ favorited %@'s comment on %@: %@", username, withUserUsername, title, comment];
|
||||
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:txt];
|
||||
|
||||
[attrStr setFont:[UIFont fontWithName:@"Helvetica" size:14]];
|
||||
[attrStr setTextColor:UIColorFromRGB(0x333333)];
|
||||
|
||||
if (![username isEqualToString:@"You"]){
|
||||
[attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txt rangeOfString:username]];
|
||||
[attrStr setTextBold:YES range:[txt rangeOfString:username]];
|
||||
}
|
||||
|
||||
[attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txt rangeOfString:withUserUsername]];
|
||||
[attrStr setTextBold:YES range:[txt rangeOfString:withUserUsername]];
|
||||
|
||||
[attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txt rangeOfString:title]];
|
||||
|
||||
[attrStr setTextColor:UIColorFromRGB(0x999999) range:[txt rangeOfString:comment]];
|
||||
|
||||
self.activityLabel.attributedText = attrStr;
|
||||
|
||||
|
||||
} else if ([category isEqualToString:@"sharedstory"]) {
|
||||
NSString* txt = [NSString stringWithFormat:@"%@ shared %@:\n\"%@\"", username, title, content];
|
||||
NSString *comment = [NSString stringWithFormat:@"\"%@\"", content];
|
||||
NSString *txt = [NSString stringWithFormat:@"%@ shared %@: %@", username, title, comment];
|
||||
NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:txt];
|
||||
|
||||
[attrStr setFont:[UIFont fontWithName:@"Helvetica" size:14]];
|
||||
|
|
@ -100,17 +126,14 @@
|
|||
}
|
||||
|
||||
[attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txt rangeOfString:title]];
|
||||
|
||||
[attrStr setFont:[UIFont fontWithName:@"Helvetica" size:13] range:[txt rangeOfString:content]];
|
||||
|
||||
|
||||
[attrStr setTextColor:UIColorFromRGB(0x666666) range:[txt rangeOfString:comment]];
|
||||
self.activityLabel.attributedText = attrStr;
|
||||
|
||||
// star and feedsub are always private.
|
||||
// star and feedsub are always private.
|
||||
} else if ([category isEqualToString:@"star"]) {
|
||||
self.activityLabel.text = [NSString stringWithFormat:@"You saved %@", content];
|
||||
|
||||
} else if ([category isEqualToString:@"feedsub"]) {
|
||||
|
||||
self.activityLabel.text = [NSString stringWithFormat:@"You subscribed to %@", content];
|
||||
}
|
||||
|
||||
|
|
@ -122,4 +145,14 @@
|
|||
return height;
|
||||
}
|
||||
|
||||
- (NSString *)stripFormatting:(NSString *)str {
|
||||
while ([str rangeOfString:@" "].location != NSNotFound) {
|
||||
str = [str stringByReplacingOccurrencesOfString:@" " withString:@" "];
|
||||
}
|
||||
while ([str rangeOfString:@"\n"].location != NSNotFound) {
|
||||
str = [str stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
UIBarButtonItem * feedMarkReadButton;
|
||||
UISegmentedControl * intelligenceControl;
|
||||
UIPopoverController *popoverController;
|
||||
BOOL foundTryFeed;
|
||||
}
|
||||
|
||||
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
@property (nonatomic, readwrite) int feedPage;
|
||||
@property (nonatomic, readwrite) BOOL pageFetching;
|
||||
@property (nonatomic, readwrite) BOOL pageFinished;
|
||||
|
||||
@property (nonatomic, readwrite) BOOL foundTryFeed;
|
||||
|
||||
- (void)resetFeedDetail;
|
||||
- (void)fetchNextPage:(void(^)())callback;
|
||||
|
|
@ -56,6 +57,7 @@
|
|||
- (void)renderStories:(NSArray *)newStories;
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scroll;
|
||||
- (IBAction)selectIntelligence;
|
||||
- (void)changeIntelligence:(NSInteger)newLevel;
|
||||
- (NSDictionary *)getStoryAtRow:(NSInteger)indexPathRow;
|
||||
- (void)checkScroll;
|
||||
- (UIView *)makeFeedTitleBar:(NSDictionary *)feed cell:(UITableViewCell *)cell makeRect:(CGRect)rect;
|
||||
|
|
@ -70,6 +72,7 @@
|
|||
- (void)changeActiveFeedDetailRow;
|
||||
- (void)changeRowStyleToRead:(UITableViewCell *)cell;
|
||||
- (void)instafetchFeed;
|
||||
- (void)loadStory:(UITableViewCell *)cell atRow:(int)row;
|
||||
|
||||
- (void)loadFaviconsFromActiveFeed;
|
||||
- (void)saveAndDrawFavicons:(ASIHTTPRequest *)request;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
@synthesize pageFetching;
|
||||
@synthesize pageFinished;
|
||||
@synthesize intelligenceControl;
|
||||
@synthesize foundTryFeed;
|
||||
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
|
||||
|
|
@ -61,6 +62,7 @@
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
self.pageFinished = NO;
|
||||
self.foundTryFeed = NO;
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialView) {
|
||||
|
|
@ -71,7 +73,6 @@
|
|||
self.storyTitlesTable.separatorColor = [UIColor colorWithRed:.9 green:.9 blue:.9 alpha:1.0];
|
||||
}
|
||||
|
||||
|
||||
// set center title
|
||||
UIView *titleLabel = [appDelegate makeFeedTitle:appDelegate.activeFeed];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
|
|
@ -124,7 +125,7 @@
|
|||
settingsButton.enabled = NO;
|
||||
} else {
|
||||
settingsButton.enabled = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
@ -162,7 +163,8 @@
|
|||
- (void)fetchFeedDetail:(int)page withCallback:(void(^)())callback {
|
||||
NSString *theFeedDetailURL;
|
||||
|
||||
if ([appDelegate.activeFeed objectForKey:@"id"] != nil && !self.pageFetching && !self.pageFinished) {
|
||||
if (!self.pageFetching && !self.pageFinished) {
|
||||
|
||||
self.feedPage = page;
|
||||
self.pageFetching = YES;
|
||||
int storyCount = appDelegate.storyCount;
|
||||
|
|
@ -181,7 +183,6 @@
|
|||
[appDelegate.activeFeed objectForKey:@"id"],
|
||||
self.feedPage];
|
||||
}
|
||||
|
||||
[self cancelRequests];
|
||||
__weak ASIHTTPRequest *request = [self requestWithURL:theFeedDetailURL];
|
||||
[request setDelegate:self];
|
||||
|
|
@ -270,7 +271,7 @@
|
|||
NSString *responseString = [request responseString];
|
||||
NSDictionary *results = [[NSDictionary alloc]
|
||||
initWithDictionary:[responseString JSONValue]];
|
||||
|
||||
|
||||
if (!(appDelegate.isRiverView || appDelegate.isSocialView) && request.tag != [[results objectForKey:@"feed_id"] intValue]) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -284,7 +285,7 @@
|
|||
}
|
||||
[self loadFaviconsFromActiveFeed];
|
||||
}
|
||||
|
||||
|
||||
NSArray *newStories = [results objectForKey:@"stories"];
|
||||
NSMutableArray *confirmedNewStories = [NSMutableArray array];
|
||||
if ([appDelegate.activeFeedStories count]) {
|
||||
|
|
@ -370,6 +371,34 @@
|
|||
|
||||
self.pageFetching = NO;
|
||||
|
||||
// test for tryfeed
|
||||
if (appDelegate.isTryFeed) {
|
||||
for (int i = 0; i < appDelegate.activeFeedStories.count; i++) {
|
||||
NSString *storyIdStr = [[appDelegate.activeFeedStories objectAtIndex:i] objectForKey:@"id"];
|
||||
if ([storyIdStr isEqualToString:appDelegate.tryFeedStoryId]) {
|
||||
NSDictionary *feed = [appDelegate.activeFeedStories objectAtIndex:i];
|
||||
|
||||
int score = [NewsBlurAppDelegate computeStoryScore:[feed objectForKey:@"intelligence"]];
|
||||
|
||||
if (score < appDelegate.selectedIntelligence) {
|
||||
[self changeIntelligence:score];
|
||||
}
|
||||
int locationOfStoryId = [appDelegate locationOfStoryId:storyIdStr];
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:locationOfStoryId inSection:0];
|
||||
|
||||
[self.storyTitlesTable selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionBottom];
|
||||
self.foundTryFeed = YES;
|
||||
|
||||
UITableViewCell *cell = [self.storyTitlesTable cellForRowAtIndexPath:indexPath];
|
||||
[self changeRowStyleToRead:cell];
|
||||
[self loadStory:cell atRow:indexPath.row];
|
||||
[MBProgressHUD hideHUDForView:appDelegate.splitStoryDetailNavigationController.view animated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[self performSelector:@selector(checkScroll)
|
||||
withObject:nil
|
||||
afterDelay:0.2];
|
||||
|
|
@ -538,21 +567,22 @@
|
|||
if (rowIndex == indexPath.row) {
|
||||
[self.storyTitlesTable selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
|
||||
}
|
||||
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)loadStory:(UITableViewCell *)cell atRow:(int)row {
|
||||
[self changeRowStyleToRead:cell];
|
||||
[appDelegate setActiveStory:[[appDelegate activeFeedStories] objectAtIndex:row]];
|
||||
[appDelegate setOriginalStoryCount:[appDelegate unreadCount]];
|
||||
[appDelegate loadStoryDetailView];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (indexPath.row < [appDelegate.activeFeedStoryLocations count]) {
|
||||
|
||||
FeedDetailTableCell *cell = (FeedDetailTableCell*) [tableView cellForRowAtIndexPath:indexPath];
|
||||
[self changeRowStyleToRead:cell];
|
||||
|
||||
int location = [[[appDelegate activeFeedStoryLocations] objectAtIndex:indexPath.row] intValue];
|
||||
[appDelegate setActiveStory:[[appDelegate activeFeedStories] objectAtIndex:location]];
|
||||
[appDelegate setOriginalStoryCount:[appDelegate unreadCount]];
|
||||
[appDelegate loadStoryDetailView];
|
||||
|
||||
[self loadStory:cell atRow:location];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -652,7 +682,8 @@
|
|||
NSInteger currentOffset = self.storyTitlesTable.contentOffset.y;
|
||||
NSInteger maximumOffset = self.storyTitlesTable.contentSize.height - self.storyTitlesTable.frame.size.height;
|
||||
|
||||
if (maximumOffset - currentOffset <= 60.0) {
|
||||
if (maximumOffset - currentOffset <= 60.0 ||
|
||||
(appDelegate.isTryFeed && !self.foundTryFeed)) {
|
||||
if (appDelegate.isRiverView) {
|
||||
[self fetchRiverPage:self.feedPage+1 withCallback:nil];
|
||||
} else {
|
||||
|
|
@ -663,6 +694,14 @@
|
|||
|
||||
- (IBAction)selectIntelligence {
|
||||
NSInteger newLevel = [self.intelligenceControl selectedSegmentIndex] - 1;
|
||||
[self changeIntelligence:newLevel];
|
||||
|
||||
[self performSelector:@selector(checkScroll)
|
||||
withObject:nil
|
||||
afterDelay:1.0];
|
||||
}
|
||||
|
||||
- (void)changeIntelligence:(NSInteger)newLevel {
|
||||
NSInteger previousLevel = [appDelegate selectedIntelligence];
|
||||
NSMutableArray *insertIndexPaths = [NSMutableArray array];
|
||||
NSMutableArray *deleteIndexPaths = [NSMutableArray array];
|
||||
|
|
@ -671,9 +710,13 @@
|
|||
|
||||
if (newLevel < previousLevel) {
|
||||
[appDelegate setSelectedIntelligence:newLevel];
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
[userPreferences setInteger:(newLevel + 1) forKey:@"selectedIntelligence"];
|
||||
[userPreferences synchronize];
|
||||
|
||||
[appDelegate calculateStoryLocations];
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i < [[appDelegate activeFeedStoryLocations] count]; i++) {
|
||||
int location = [[[appDelegate activeFeedStoryLocations] objectAtIndex:i] intValue];
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
|
||||
|
|
@ -716,10 +759,6 @@
|
|||
withRowAnimation:UITableViewRowAnimationNone];
|
||||
}
|
||||
[self.storyTitlesTable endUpdates];
|
||||
|
||||
[self performSelector:@selector(checkScroll)
|
||||
withObject:nil
|
||||
afterDelay:1.0];
|
||||
}
|
||||
|
||||
- (NSDictionary *)getStoryAtRow:(NSInteger)indexPathRow {
|
||||
|
|
@ -1079,7 +1118,7 @@
|
|||
NSString *responseString = [request responseString];
|
||||
NSDictionary *results = [[NSDictionary alloc]
|
||||
initWithDictionary:[responseString JSONValue]];
|
||||
|
||||
|
||||
[self renderStories:[results objectForKey:@"stories"]];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,13 @@
|
|||
NewsBlurAppDelegate *appDelegate;
|
||||
UITableView *interactionsTable;
|
||||
NSMutableArray *interactionsArray;
|
||||
UIPopoverController *popoverController;
|
||||
}
|
||||
|
||||
@property (nonatomic) NewsBlurAppDelegate *appDelegate;
|
||||
@property (nonatomic, strong) UITableView *interactionsTable;
|
||||
@property (nonatomic) NSArray *interactionsArray;
|
||||
@property (nonatomic, strong) UIPopoverController *popoverController;
|
||||
|
||||
- (void)refreshWithInteractions:(NSMutableArray *)interactions;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
@synthesize appDelegate;
|
||||
@synthesize interactionsTable;
|
||||
@synthesize interactionsArray;
|
||||
@synthesize popoverController;
|
||||
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
|
|
@ -96,7 +97,7 @@
|
|||
cell.textLabel.text = [NSString stringWithFormat:@"%@ replied to your reply: %@", username, content];
|
||||
|
||||
} else if ([category isEqualToString:@"story_reshare"]) {
|
||||
cell.textLabel.text = [NSString stringWithFormat:@"%@ re-shared: %@ | %@", username, title, content];
|
||||
cell.textLabel.text = [NSString stringWithFormat:@"%@ re-shared: %@.", username, title];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -115,14 +116,23 @@
|
|||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
|
||||
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:appDelegate.userProfileViewController];
|
||||
[popoverController setPopoverContentSize:CGSizeMake(320, 416)];
|
||||
[popoverController presentPopoverFromRect:cell.bounds
|
||||
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:appDelegate.userProfileViewController];
|
||||
[self.popoverController setPopoverContentSize:CGSizeMake(320, 416)];
|
||||
[self.popoverController presentPopoverFromRect:cell.bounds
|
||||
inView:cell
|
||||
permittedArrowDirections:UIPopoverArrowDirectionAny
|
||||
animated:YES];
|
||||
}
|
||||
} else if ([category isEqualToString:@"comment_reply"]) {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"feed_id"]];
|
||||
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"content_id"]];
|
||||
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr];
|
||||
} else if ([category isEqualToString:@"reply_reply"] ||
|
||||
[category isEqualToString:@"story_reshare"]) {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[interaction objectForKey:@"with_user"] objectForKey:@"id"]];
|
||||
NSString *contentIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"content_id"]];
|
||||
[appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@
|
|||
BOOL popoverHasFeedView;
|
||||
BOOL inStoryDetail;
|
||||
BOOL inFeedDetail;
|
||||
BOOL isTryFeed;
|
||||
NSString *tryFeedStoryId;
|
||||
NSDictionary * activeFeed;
|
||||
NSString * activeFolder;
|
||||
NSDictionary * activeComment;
|
||||
|
|
@ -124,6 +126,8 @@
|
|||
@property (readwrite) NSString * activeUserProfileId;
|
||||
@property (nonatomic, readwrite) BOOL isRiverView;
|
||||
@property (nonatomic, readwrite) BOOL isSocialView;
|
||||
@property (nonatomic, readwrite) BOOL isTryFeed;
|
||||
@property (nonatomic) NSString *tryFeedStoryId;
|
||||
@property (nonatomic, readwrite) BOOL isShowingShare;
|
||||
@property (nonatomic, readwrite) BOOL popoverHasFeedView;
|
||||
@property (nonatomic, readwrite) BOOL inStoryDetail;
|
||||
|
|
@ -177,6 +181,7 @@
|
|||
- (void)showAddSite;
|
||||
- (void)showMoveSite;
|
||||
- (void)loadFeedDetailView;
|
||||
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId;
|
||||
- (void)showDashboard;
|
||||
- (void)loadRiverFeedDetailView;
|
||||
- (void)loadStoryDetailView;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@
|
|||
@synthesize isRiverView;
|
||||
@synthesize isSocialView;
|
||||
@synthesize isShowingShare;
|
||||
@synthesize isTryFeed;
|
||||
@synthesize tryFeedStoryId;
|
||||
@synthesize popoverHasFeedView;
|
||||
@synthesize inStoryDetail;
|
||||
@synthesize inFeedDetail;
|
||||
|
|
@ -407,11 +409,31 @@
|
|||
if ([[self.splitStoryDetailNavigationController viewControllers] containsObject:self.feedDashboardViewController]) {
|
||||
//[self.storyDetailViewController initStory];
|
||||
} else {
|
||||
[self.splitStoryDetailNavigationController pushViewController:self.feedDashboardViewController animated:YES];
|
||||
if (self.isTryFeed) {
|
||||
[self.splitStoryDetailNavigationController pushViewController:self.feedDashboardViewController animated:NO];
|
||||
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.splitStoryDetailNavigationController.view animated:YES];
|
||||
HUD.labelText = @"Finding Story...";
|
||||
} else {
|
||||
[self.splitStoryDetailNavigationController pushViewController:self.feedDashboardViewController animated:YES];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId {
|
||||
|
||||
NSDictionary *feed = [self.dictSocialFeeds objectForKey:feedId];
|
||||
|
||||
[self setTryFeedStoryId:@"http://techcrunch.com/?p=576238"];
|
||||
[self setIsTryFeed:YES];
|
||||
[self setIsSocialView:YES];
|
||||
[self setActiveFeed:feed];
|
||||
[self setActiveFolder:nil];
|
||||
|
||||
[self loadFeedDetailView];
|
||||
}
|
||||
|
||||
- (void)showDashboard {
|
||||
self.inStoryDetail = NO;
|
||||
self.inFeedDetail = NO;
|
||||
|
|
|
|||
|
|
@ -54,24 +54,6 @@
|
|||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([userPreferences integerForKey:@"selectedIntelligence"] == 2) {
|
||||
NSLog(@"Show FOCUS stories");
|
||||
self.viewShowingAllFeeds = NO;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:2];
|
||||
[appDelegate setSelectedIntelligence:1];
|
||||
} else if ([userPreferences integerForKey:@"selectedIntelligence"] == 1) {
|
||||
NSLog(@"Show UNREAD stories");
|
||||
self.viewShowingAllFeeds = NO;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:1];
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
} else {
|
||||
NSLog(@"Show ALL stories");
|
||||
self.viewShowingAllFeeds = YES;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:0];
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
}
|
||||
|
||||
[appDelegate showNavigationBar:NO];
|
||||
pull = [[PullToRefreshView alloc] initWithScrollView:self.feedTitlesTable];
|
||||
|
|
@ -92,6 +74,36 @@
|
|||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([userPreferences integerForKey:@"selectedIntelligence"] == 1) {
|
||||
NSLog(@"Show FOCUS stories");
|
||||
self.viewShowingAllFeeds = NO;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:2];
|
||||
[appDelegate setSelectedIntelligence:1];
|
||||
} else if ([userPreferences integerForKey:@"selectedIntelligence"] == 0) {
|
||||
NSLog(@"Show UNREAD stories");
|
||||
self.viewShowingAllFeeds = NO;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:1];
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
} else { // default state, ALL stories
|
||||
NSLog(@"Show ALL stories");
|
||||
self.viewShowingAllFeeds = YES;
|
||||
[self.intelligenceControl setSelectedSegmentIndex:0];
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
}
|
||||
|
||||
// have the selected cell deselect
|
||||
[self.feedTitlesTable deselectRowAtIndexPath:self.currentRowAtIndexPath animated:YES];
|
||||
// reset all feed detail specific data
|
||||
appDelegate.activeFeed = nil;
|
||||
appDelegate.isSocialView = NO;
|
||||
appDelegate.isRiverView = NO;
|
||||
appDelegate.isTryFeed = NO;
|
||||
[MBProgressHUD hideHUDForView:appDelegate.splitStoryDetailNavigationController.view animated:NO];
|
||||
|
||||
|
||||
// If there is an active feed or a set of feeds readin the river,
|
||||
// we need to update its table row to match the updated unread counts.
|
||||
|
||||
|
|
@ -139,13 +151,6 @@
|
|||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
// have the selected cell deselect
|
||||
[self.feedTitlesTable deselectRowAtIndexPath:self.currentRowAtIndexPath animated:YES];
|
||||
// reset all feed detail specific data
|
||||
appDelegate.activeFeed = nil;
|
||||
appDelegate.isSocialView = NO;
|
||||
appDelegate.isRiverView = NO;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
|
@ -781,31 +786,33 @@
|
|||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
if (selectedSegmentIndex == 0) {
|
||||
hud.labelText = @"All Stories";
|
||||
[userPreferences setInteger:0 forKey:@"selectedIntelligence"];
|
||||
[userPreferences setInteger:-1 forKey:@"selectedIntelligence"];
|
||||
[userPreferences synchronize];
|
||||
|
||||
if (appDelegate.selectedIntelligence == 1) {
|
||||
if (appDelegate.selectedIntelligence != 0) {
|
||||
int previousLevel = appDelegate.selectedIntelligence;
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
[self updateFeedsWithIntelligence:1 newLevel:0];
|
||||
[self updateFeedsWithIntelligence:previousLevel newLevel:0];
|
||||
[self redrawUnreadCounts];
|
||||
}
|
||||
self.viewShowingAllFeeds = YES;
|
||||
[self switchSitesUnread];
|
||||
} else if(selectedSegmentIndex == 1) {
|
||||
hud.labelText = @"Unread Stories";
|
||||
[userPreferences setInteger:1 forKey:@"selectedIntelligence"];
|
||||
[userPreferences setInteger:0 forKey:@"selectedIntelligence"];
|
||||
[userPreferences synchronize];
|
||||
|
||||
if (appDelegate.selectedIntelligence == 1) {
|
||||
if (appDelegate.selectedIntelligence != 0) {
|
||||
int previousLevel = appDelegate.selectedIntelligence;
|
||||
[appDelegate setSelectedIntelligence:0];
|
||||
[self updateFeedsWithIntelligence:1 newLevel:0];
|
||||
[self updateFeedsWithIntelligence:previousLevel newLevel:0];
|
||||
[self redrawUnreadCounts];
|
||||
}
|
||||
self.viewShowingAllFeeds = NO;
|
||||
[self switchSitesUnread];
|
||||
} else {
|
||||
hud.labelText = @"Focus Stories";
|
||||
[userPreferences setInteger:2 forKey:@"selectedIntelligence"];
|
||||
[userPreferences setInteger:1 forKey:@"selectedIntelligence"];
|
||||
[userPreferences synchronize];
|
||||
|
||||
if (self.viewShowingAllFeeds == YES) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue