diff --git a/media/ios/Classes/ActivityCell.h b/media/ios/Classes/ActivityCell.h index f0efc9364..596612087 100644 --- a/media/ios/Classes/ActivityCell.h +++ b/media/ios/Classes/ActivityCell.h @@ -17,7 +17,7 @@ @property (nonatomic, strong) OHAttributedLabel *activityLabel; @property (nonatomic, strong) UIImageView *faviconView; -- (int)setActivity:(NSDictionary *)activity withUsername:(NSString *)username withWidth:(int)width; +- (int)setActivity:(NSDictionary *)activity withUserProfile:(NSDictionary *)userProfile withWidth:(int)width; - (NSString *)stripFormatting:(NSString *)str; @end diff --git a/media/ios/Classes/ActivityCell.m b/media/ios/Classes/ActivityCell.m index 859e3297f..5a1c7372d 100644 --- a/media/ios/Classes/ActivityCell.m +++ b/media/ios/Classes/ActivityCell.m @@ -58,7 +58,8 @@ self.activityLabel.frame = labelRect; } -- (int)setActivity:(NSDictionary *)activity withUsername:(NSString *)username withWidth:(int)width { +- (int)setActivity:(NSDictionary *)activity withUserProfile:(NSDictionary *)userProfile withWidth:(int)width { + // must set the height again for dynamic height in heightForRowAtIndexPath in CGRect activityLabelRect = self.activityLabel.bounds; activityLabelRect.size.width = width - leftMargin - avatarSize - leftMargin - rightMargin; @@ -71,12 +72,13 @@ NSString *title = [self stripFormatting:[NSString stringWithFormat:@"%@", [activity objectForKey:@"title"]]]; NSString *time = [[NSString stringWithFormat:@"%@ ago", [activity objectForKey:@"time_since"]] uppercaseString]; NSString *withUserUsername = @""; + NSString *username = [NSString stringWithFormat:@"%@", [userProfile objectForKey:@"username"]]; + NSString* txt; if ([category isEqualToString:@"follow"] || [category isEqualToString:@"comment_reply"] || - [category isEqualToString:@"comment_like"] || - [category isEqualToString:@"sharedstory"]) { + [category isEqualToString:@"comment_like"]) { // this is for the rare instance when the with_user doesn't return anything if ([[activity objectForKey:@"with_user"] class] == [NSNull class]) { self.faviconView.frame = CGRectZero; @@ -87,6 +89,10 @@ UIImage *placeholder = [UIImage imageNamed:@"user"]; [self.faviconView setImageWithURL:[NSURL URLWithString:[[activity objectForKey:@"with_user"] objectForKey:@"photo_url"]] placeholderImage:placeholder]; + } else if ([category isEqualToString:@"sharedstory"]) { + UIImage *placeholder = [UIImage imageNamed:@"user"]; + [self.faviconView setImageWithURL:[NSURL URLWithString:[userProfile objectForKey:@"photo_url"]] + placeholderImage:placeholder]; } else { UIImage *placeholder = [UIImage imageNamed:@"world"]; NSString *faviconUrl = [NSString stringWithFormat:@"http://%@/rss_feeds/icon/%i", @@ -98,6 +104,7 @@ self.faviconView.frame = CGRectMake(leftMargin+16, topMargin, 16, 16); } + NSLog(@"category is %@", category); if ([category isEqualToString:@"follow"]) { withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"]; txt = [NSString stringWithFormat:@"%@ followed %@", username, withUserUsername]; @@ -107,7 +114,7 @@ } else if ([category isEqualToString:@"comment_like"]) { withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"]; txt = [NSString stringWithFormat:@"%@ favorited %@'s comment on %@:\n%@", username, withUserUsername, title, comment]; - } else if ([category isEqualToString:@"sharedstory"]) { + } else if ([category isEqualToString:@"sharedstory"]) { if ([content isEqualToString:@""] || content == nil) { txt = [NSString stringWithFormat:@"%@ shared %@.", username, title]; } else { diff --git a/media/ios/Classes/ActivityModule.h b/media/ios/Classes/ActivityModule.h index 2517299f9..8f2cf1405 100644 --- a/media/ios/Classes/ActivityModule.h +++ b/media/ios/Classes/ActivityModule.h @@ -17,7 +17,6 @@ NewsBlurAppDelegate *appDelegate; UITableView *activitiesTable; NSArray *activitiesArray; - NSString *activitiesUsername; UIPopoverController *popoverController; BOOL pageFetching; @@ -28,14 +27,13 @@ @property (nonatomic) NewsBlurAppDelegate *appDelegate; @property (nonatomic, strong) UITableView *activitiesTable; @property (nonatomic) NSArray *activitiesArray; -@property (nonatomic) NSString *activitiesUsername; @property (nonatomic, strong) UIPopoverController *popoverController; @property (nonatomic, readwrite) BOOL pageFetching; @property (nonatomic, readwrite) BOOL pageFinished; @property (readwrite) int activitiesPage; -- (void)refreshWithActivities:(NSArray *)activities withUsername:(NSString *)username; +- (void)refreshWithActivities:(NSArray *)activities; - (void)fetchActivitiesDetail:(int)page; - (void)finishLoadActivities:(ASIHTTPRequest *)request; diff --git a/media/ios/Classes/ActivityModule.m b/media/ios/Classes/ActivityModule.m index 78e22bb47..87cd129c8 100644 --- a/media/ios/Classes/ActivityModule.m +++ b/media/ios/Classes/ActivityModule.m @@ -12,13 +12,13 @@ #import "UserProfileViewController.h" #import #import "ASIHTTPRequest.h" +#import "ActivityCell.h" @implementation ActivityModule @synthesize appDelegate; @synthesize activitiesTable; @synthesize activitiesArray; -@synthesize activitiesUsername; @synthesize popoverController; @synthesize pageFetching; @synthesize pageFinished; @@ -46,10 +46,9 @@ [self addSubview:self.activitiesTable]; } -- (void)refreshWithActivities:(NSArray *)activities withUsername:(NSString *)username { +- (void)refreshWithActivities:(NSArray *)activities { self.appDelegate = (NewsBlurAppDelegate *)[[UIApplication sharedApplication] delegate]; self.activitiesArray = activities; - self.activitiesUsername = username; [self.activitiesTable reloadData]; @@ -107,11 +106,6 @@ options:kNilOptions error:&error]; - self.activitiesUsername = [results objectForKey:@"username"]; - if (!self.activitiesUsername) { - self.activitiesUsername = [[results objectForKey:@"user_profile"] objectForKey:@"username"]; - } - // check for last page if (![[results objectForKey:@"has_next_page"] intValue]) { self.pageFinished = YES; @@ -139,7 +133,7 @@ appDelegate.userActivitiesArray = [appDelegate.userActivitiesArray arrayByAddingObjectsFromArray:newActivities]; } - [self refreshWithActivities:appDelegate.userActivitiesArray withUsername:self.activitiesUsername]; + [self refreshWithActivities:appDelegate.userActivitiesArray]; } - (void)requestFailed:(ASIHTTPRequest *)request { @@ -168,7 +162,14 @@ } ActivityCell *activityCell = [[ActivityCell alloc] init]; - int height = [activityCell setActivity:[self.activitiesArray objectAtIndex:(indexPath.row)] withUsername:self.activitiesUsername withWidth:self.frame.size.width] + 30; + + NSMutableDictionary *userProfile = [appDelegate.dictUserProfile mutableCopy]; + [userProfile setValue:@"You" forKey:@"username"]; + + int height = [activityCell setActivity:[self.activitiesArray + objectAtIndex:(indexPath.row)] + withUserProfile:userProfile + withWidth:self.frame.size.width] + 30; return height; @@ -188,10 +189,14 @@ return [self makeLoadingCell]; } else { + NSMutableDictionary *userProfile = [appDelegate.dictUserProfile mutableCopy]; + [userProfile setValue:@"You" forKey:@"username"]; + // update the cell information - [cell setActivity:[self.activitiesArray objectAtIndex:(indexPath.row)] - withUsername:self.activitiesUsername - withWidth:self.frame.size.width]; + [cell setActivity:[self.activitiesArray + objectAtIndex:(indexPath.row)] + withUserProfile:userProfile + withWidth:self.frame.size.width]; } return cell; } @@ -213,21 +218,21 @@ appDelegate.activeUserProfileName = username; // pass cell to the show UserProfile - ActivityCell *cell = [tableView cellForRowAtIndexPath:indexPath]; + ActivityCell *cell = (ActivityCell *)[tableView cellForRowAtIndexPath:indexPath]; [appDelegate showUserProfileModal:cell]; } else if ([category isEqualToString:@"comment_reply"] || [category isEqualToString:@"comment_like"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]]; NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]]; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]]; } else if ([category isEqualToString:@"sharedstory"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]]; NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]]; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]]; } else if ([category isEqualToString:@"feedsub"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"feed_id"]]; NSString *contentIdStr = nil; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:[activity objectForKey:@"with_user"]]; } // have the selected cell deselect diff --git a/media/ios/Classes/FeedDetailTableCell.m b/media/ios/Classes/FeedDetailTableCell.m index e986d9428..17ad55149 100644 --- a/media/ios/Classes/FeedDetailTableCell.m +++ b/media/ios/Classes/FeedDetailTableCell.m @@ -55,7 +55,7 @@ static UIFont *indicatorFont = nil; // set the background color UIColor *backgroundColor; if (self.selected || self.highlighted) { - backgroundColor = [UIColor colorWithRed:0.15 green:0.55 blue:0.95 alpha:1.0]; + backgroundColor = UIColorFromRGB(0xd2e6fd); // gradient start // CGRect fullRect = self.bounds; @@ -85,7 +85,7 @@ static UIFont *indicatorFont = nil; } if (self.selected || self.highlighted) { - textColor = UIColorFromRGB(0xffffff); //0x686868 + textColor = UIColorFromRGB(0x686868); //0x686868 } [textColor set]; @@ -105,7 +105,7 @@ static UIFont *indicatorFont = nil; font = [UIFont fontWithName:@"Helvetica-Bold" size:12]; } if (self.selected || self.highlighted) { - textColor = UIColorFromRGB(0xffffff); + textColor = UIColorFromRGB(0x686868); } [textColor set]; } @@ -125,7 +125,7 @@ static UIFont *indicatorFont = nil; font = [UIFont fontWithName:@"Helvetica-Bold" size:10]; } if (self.selected || self.highlighted) { - textColor = UIColorFromRGB(0xffffff); + textColor = UIColorFromRGB(0x686868); } [textColor set]; @@ -146,7 +146,7 @@ static UIFont *indicatorFont = nil; } if (self.selected || self.highlighted) { - textColor = UIColorFromRGB(0xffffff); + textColor = UIColorFromRGB(0x686868); } [textColor set]; @@ -163,13 +163,13 @@ static UIFont *indicatorFont = nil; CGContextSetStrokeColor(context, CGColorGetComponents([blue CGColor])); CGContextBeginPath(context); - CGContextMoveToPoint(context, 0, 0); + CGContextMoveToPoint(context, 0, 0.5f); CGContextAddLineToPoint(context, self.bounds.size.width, 0); CGContextStrokePath(context); // bottom border CGContextBeginPath(context); - CGContextMoveToPoint(context, 0, self.bounds.size.height); + CGContextMoveToPoint(context, 0, self.bounds.size.height - 0.5f); CGContextAddLineToPoint(context, self.bounds.size.width, self.bounds.size.height); CGContextStrokePath(context); } else { diff --git a/media/ios/Classes/InteractionsModule.m b/media/ios/Classes/InteractionsModule.m index 2ac06bd30..b12b206ad 100644 --- a/media/ios/Classes/InteractionsModule.m +++ b/media/ios/Classes/InteractionsModule.m @@ -223,11 +223,14 @@ [category isEqualToString:@"comment_like"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"feed_id"]]; NSString *contentIdStr = [NSString stringWithFormat:@"%@", [interaction objectForKey:@"content_id"]]; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr + withStory:contentIdStr + isSocial:YES + withUser:[interaction objectForKey:@"with_user"]]; } else if ([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 isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[interaction objectForKey:@"with_user"]]; } // have the selected cell deselect diff --git a/media/ios/Classes/NewsBlurAppDelegate.h b/media/ios/Classes/NewsBlurAppDelegate.h index 0013b8cf6..7fc057f19 100644 --- a/media/ios/Classes/NewsBlurAppDelegate.h +++ b/media/ios/Classes/NewsBlurAppDelegate.h @@ -191,10 +191,11 @@ - (void)showFindingStoryHUD; - (void)hideFindingStoryHUD; + - (void)showAddSite; - (void)showMoveSite; - (void)loadFeedDetailView; -- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social; +- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user; - (void)loadRiverFeedDetailView; - (void)loadStoryDetailView; - (void)adjustStoryDetailWebView; diff --git a/media/ios/Classes/NewsBlurAppDelegate.m b/media/ios/Classes/NewsBlurAppDelegate.m index 09953296c..6d2ab8dd7 100644 --- a/media/ios/Classes/NewsBlurAppDelegate.m +++ b/media/ios/Classes/NewsBlurAppDelegate.m @@ -23,6 +23,7 @@ #import "ShareViewController.h" #import "UserProfileViewController.h" #import "NBContainerViewController.h" +#import "AFJSONRequestOperation.h" #import "MBProgressHUD.h" #import "Utilities.h" @@ -386,16 +387,30 @@ } } -- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social { - - NSDictionary *feed; +- (void)loadTryFeedDetailView:(NSString *)feedId withStory:(NSString *)contentId isSocial:(BOOL)social withUser:(NSDictionary *)user { + NSDictionary *feed = nil; if (social) { feed = [self.dictSocialFeeds objectForKey:feedId]; [self setIsSocialView:YES]; [self setInFindingStoryMode:YES]; + + if (feed == nil) { +// NSLog(@"user is %@", user); +// NSString *newFeedId = [feedId stringByReplacingOccurrencesOfString:@"social:" withString:@""]; +// feed = [NSDictionary dictionaryWithObjectsAndKeys: +// @"TESTER", @"feed_title", +// feedId, @"id", +// newFeedId, @"user_id", +// nil]; + feed = user; + + } } else { feed = [self.dictFeeds objectForKey:feedId]; + if (feed == nil) { + NSLog(@"NO FEED FOUND!"); + } [self setIsSocialView:NO]; [self setInFindingStoryMode:NO]; } diff --git a/media/ios/Classes/ProfileBadge.m b/media/ios/Classes/ProfileBadge.m index a5976405a..51f3229ce 100644 --- a/media/ios/Classes/ProfileBadge.m +++ b/media/ios/Classes/ProfileBadge.m @@ -88,11 +88,10 @@ UIButton *follow = [UIButton buttonWithType:UIButtonTypeRoundedRect]; follow.frame = CGRectMake(20, 96, 80, 24); - NSString *currentUserId = [NSString stringWithFormat:@"%@", [self.appDelegate.dictUserProfile objectForKey:@"user_id"]]; - NSString *profileUserId = [NSString stringWithFormat:@"%@", [profile objectForKey:@"user_id"]]; + NSString *profileUsername = [NSString stringWithFormat:@"%@", [profile objectForKey:@"username"]]; // check follow button status - if ([currentUserId isEqualToString:profileUserId]) { + if ([profileUsername isEqualToString:@"You"]) { [follow setTitle:@"You" forState:UIControlStateNormal]; follow.enabled = NO; } else if ([[profile objectForKey:@"followed_by_you"] intValue]) { diff --git a/media/ios/Classes/SmallActivityCell.m b/media/ios/Classes/SmallActivityCell.m index 04e56d56c..3dbab4d9d 100644 --- a/media/ios/Classes/SmallActivityCell.m +++ b/media/ios/Classes/SmallActivityCell.m @@ -29,8 +29,6 @@ } - (void)layoutSubviews { - - [super layoutSubviews]; // determine outer bounds @@ -54,95 +52,4 @@ self.activityLabel.backgroundColor = [UIColor clearColor]; } -- (int)setActivity:(NSDictionary *)activity withUsername:(NSString *)username withWidth:(int)width { - // must set the height again for dynamic height in heightForRowAtIndexPath in - CGRect activityLabelRect = self.activityLabel.bounds; - activityLabelRect.size.width = width - leftMargin - avatarSize - leftMargin - rightMargin; - - self.activityLabel.frame = activityLabelRect; - self.faviconView.frame = CGRectMake(leftMargin, topMargin, avatarSize, avatarSize); - - NSString *category = [activity objectForKey:@"category"]; - NSString *content = [activity objectForKey:@"content"]; - NSString *comment = [NSString stringWithFormat:@"\"%@\"", content]; - NSString *title = [self stripFormatting:[NSString stringWithFormat:@"%@", [activity objectForKey:@"title"]]]; - NSString *time = [[NSString stringWithFormat:@"%@ ago", [activity objectForKey:@"time_since"]] uppercaseString]; - NSString *withUserUsername = @""; - NSString* txt; - - if ([category isEqualToString:@"follow"] || - [category isEqualToString:@"comment_reply"] || - [category isEqualToString:@"comment_like"] || - [category isEqualToString:@"sharedstory"]) { - UIImage *placeholder = [UIImage imageNamed:@"user"]; - [self.faviconView setImageWithURL:[NSURL URLWithString:[[activity objectForKey:@"with_user"] objectForKey:@"photo_url"]] - placeholderImage:placeholder]; - } else { - UIImage *placeholder = [UIImage imageNamed:@"user"]; - NSString *faviconUrl = [NSString stringWithFormat:@"http://%@/rss_feeds/icon/%i", - NEWSBLUR_URL, - [[activity objectForKey:@"feed_id"] intValue]]; - [self.faviconView setImageWithURL:[NSURL URLWithString:faviconUrl ] - placeholderImage:placeholder]; - self.faviconView.contentMode = UIViewContentModeScaleAspectFit; - self.faviconView.frame = CGRectMake(leftMargin+16, topMargin, 16, 16); - } - - - if ([category isEqualToString:@"follow"]) { - withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"]; - txt = [NSString stringWithFormat:@"%@ followed %@", username, withUserUsername]; - } else if ([category isEqualToString:@"comment_reply"]) { - withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"]; - txt = [NSString stringWithFormat:@"%@ replied to %@: \n%@", username, withUserUsername, comment]; - } else if ([category isEqualToString:@"comment_like"]) { - withUserUsername = [[activity objectForKey:@"with_user"] objectForKey:@"username"]; - txt = [NSString stringWithFormat:@"%@ favorited %@'s comment on %@:\n%@", username, withUserUsername, title, comment]; - } else if ([category isEqualToString:@"sharedstory"]) { - if ([content isEqualToString:@""] || content == nil) { - txt = [NSString stringWithFormat:@"%@ shared %@.", username, title]; - } else { - txt = [NSString stringWithFormat:@"%@ shared %@:\n%@", username, title, comment]; - } - - } else if ([category isEqualToString:@"star"]) { - txt = [NSString stringWithFormat:@"%@ saved %@:\n%@", content]; - } else if ([category isEqualToString:@"feedsub"]) { - txt = [NSString stringWithFormat:@"You subscribed to %@", content]; - } - - NSString *txtWithTime = [NSString stringWithFormat:@"%@\n%@", txt, time]; - NSMutableAttributedString* attrStr = [NSMutableAttributedString attributedStringWithString:txtWithTime]; - - // for those calls we don't specify a range so it affects the whole string - [attrStr setFont:[UIFont fontWithName:@"Helvetica" size:14]]; - [attrStr setTextColor:UIColorFromRGB(0x333333)]; - - if (![username isEqualToString:@"You"]){ - [attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txtWithTime rangeOfString:username]]; - [attrStr setTextBold:YES range:[txt rangeOfString:username]]; - } - - [attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txtWithTime rangeOfString:title]]; - - if(withUserUsername.length) { - [attrStr setTextColor:UIColorFromRGB(NEWSBLUR_ORANGE) range:[txtWithTime rangeOfString:withUserUsername]]; - [attrStr setTextBold:YES range:[txtWithTime rangeOfString:withUserUsername]]; - } - - [attrStr setTextColor:UIColorFromRGB(0x666666) range:[txtWithTime rangeOfString:comment]]; - - [attrStr setTextColor:UIColorFromRGB(0x999999) range:[txtWithTime rangeOfString:time]]; - [attrStr setFont:[UIFont fontWithName:@"Helvetica" size:10] range:[txtWithTime rangeOfString:time]]; - [attrStr setTextAlignment:kCTLeftTextAlignment lineBreakMode:kCTLineBreakByWordWrapping lineHeight:4]; - - self.activityLabel.attributedText = attrStr; - - [self.activityLabel sizeToFit]; - - int height = self.activityLabel.frame.size.height; - - return MAX(height, self.faviconView.frame.size.height); -} - @end diff --git a/media/ios/Classes/StoryDetailViewController.h b/media/ios/Classes/StoryDetailViewController.h index a7d13af7b..44fc263a9 100644 --- a/media/ios/Classes/StoryDetailViewController.h +++ b/media/ios/Classes/StoryDetailViewController.h @@ -55,7 +55,7 @@ - (void)toggleLikeComment:(BOOL)likeComment; - (void)showStory; - (void)scrolltoBottom; -- (void)showOriginalSubview:(id)sender; +- (IBAction)showOriginalSubview:(id)sender; - (IBAction)doNextUnreadStory; - (IBAction)doNextStory; - (IBAction)doPreviousStory; diff --git a/media/ios/Classes/StoryDetailViewController.m b/media/ios/Classes/StoryDetailViewController.m index 00c665725..838c9c055 100644 --- a/media/ios/Classes/StoryDetailViewController.m +++ b/media/ios/Classes/StoryDetailViewController.m @@ -79,12 +79,7 @@ // adding drag property for toolbars - UIBarButtonItem *originalButton = [[UIBarButtonItem alloc] - initWithTitle:@"Original" - style:UIBarButtonItemStyleBordered - target:self - action:@selector(showOriginalSubview:) - ]; + UIBarButtonItem *fontSettings = [[UIBarButtonItem alloc] initWithTitle:@"Aa" @@ -98,7 +93,7 @@ self.buttonBack = backButton; - self.originalStoryButton = originalButton; + self.fontSettingsButton = fontSettings; self.loadingIndicator = [[UIActivityIndicatorView alloc] @@ -117,7 +112,7 @@ UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; self.navigationItem.backBarButtonItem = back; - self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:originalButton, fontSettingsButton, nil]; + self.navigationItem.rightBarButtonItem = fontSettingsButton; } else { self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9]; self.bottomPlaceholderToolbar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9]; @@ -1239,7 +1234,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request [self.webView stringByEvaluatingJavaScriptFromString:jsString]; } -- (void)showOriginalSubview:(id)sender { +- (IBAction)showOriginalSubview:(id)sender { NSURL *url = [NSURL URLWithString:[appDelegate.activeStory objectForKey:@"story_permalink"]]; [appDelegate showOriginalStory:url]; diff --git a/media/ios/Classes/UserProfileViewController.h b/media/ios/Classes/UserProfileViewController.h index ac2cbdaa8..b20489713 100644 --- a/media/ios/Classes/UserProfileViewController.h +++ b/media/ios/Classes/UserProfileViewController.h @@ -13,7 +13,7 @@ @class ProfileBadge; @interface UserProfileViewController : UIViewController - { + { NewsBlurAppDelegate *appDelegate; UILabel *followingCount; @@ -22,6 +22,7 @@ UITableView *profileTable; NSArray *activitiesArray; NSString *activitiesUsername; + NSDictionary *userProfile; } @property (nonatomic) NewsBlurAppDelegate *appDelegate; @@ -29,6 +30,7 @@ @property (nonatomic) UITableView *profileTable; @property (nonatomic) NSArray *activitiesArray; @property (nonatomic) NSString *activitiesUsername; +@property (nonatomic) NSDictionary *userProfile; - (void)getUserProfile; - (void)requestFinished:(ASIHTTPRequest *)request; diff --git a/media/ios/Classes/UserProfileViewController.m b/media/ios/Classes/UserProfileViewController.m index 210c7f088..accd060b3 100644 --- a/media/ios/Classes/UserProfileViewController.m +++ b/media/ios/Classes/UserProfileViewController.m @@ -22,6 +22,8 @@ @synthesize profileTable; @synthesize activitiesArray; @synthesize activitiesUsername; +@synthesize userProfile; + - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { @@ -128,14 +130,10 @@ [MBProgressHUD hideHUDForView:self.view animated:YES]; - [self.profileBadge refreshWithProfile:[results objectForKey:@"user_profile"]]; - + self.userProfile = [results objectForKey:@"user_profile"]; self.activitiesArray = [results objectForKey:@"activities"]; - self.activitiesUsername = [results objectForKey:@"username"]; - - if (!self.activitiesUsername) { - self.activitiesUsername = [[results objectForKey:@"user_profile"] objectForKey:@"username"]; - } + + [self.profileBadge refreshWithProfile:self.userProfile]; [self.profileTable reloadData]; [self.view addSubview:self.profileTable]; @@ -177,8 +175,8 @@ } else { SmallActivityCell *activityCell = [[SmallActivityCell alloc] init]; int height = [activityCell setActivity:[self.activitiesArray objectAtIndex:(indexPath.row)] - withUsername:self.activitiesUsername - withWidth:self.view.frame.size.width - 20] + 20; + withUserProfile:self.userProfile + withWidth:self.view.frame.size.width - 20] + 20; return height; } } @@ -191,7 +189,6 @@ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault @@ -200,12 +197,6 @@ [[[cell contentView] subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)]; } - // check follow button status - NSString *currentUserName = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"username"]]; - if ([currentUserName isEqualToString:self.activitiesUsername]) { - self.activitiesUsername = @"You"; - } - [cell addSubview:self.profileBadge]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; @@ -221,7 +212,7 @@ } [cell setActivity:[self.activitiesArray objectAtIndex:(indexPath.row)] - withUsername:self.activitiesUsername + withUserProfile:self.userProfile withWidth:self.view.frame.size.width]; return cell; @@ -254,15 +245,15 @@ [category isEqualToString:@"comment_like"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]]; NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]]; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]]; } else if ([category isEqualToString:@"sharedstory"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [[activity objectForKey:@"with_user"] objectForKey:@"id"]]; NSString *contentIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"content_id"]]; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:YES withUser:[activity objectForKey:@"with_user"]]; } else if ([category isEqualToString:@"feedsub"]) { NSString *feedIdStr = [NSString stringWithFormat:@"%@", [activity objectForKey:@"feed_id"]]; NSString *contentIdStr = nil; - [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO]; + [appDelegate loadTryFeedDetailView:feedIdStr withStory:contentIdStr isSocial:NO withUser:[activity objectForKey:@"with_user"]]; } } diff --git a/media/ios/NewsBlur.xcodeproj/project.pbxproj b/media/ios/NewsBlur.xcodeproj/project.pbxproj index 9965611d4..30da7e3ff 100755 --- a/media/ios/NewsBlur.xcodeproj/project.pbxproj +++ b/media/ios/NewsBlur.xcodeproj/project.pbxproj @@ -170,6 +170,8 @@ 43ABBCAA15B53A1400EA3111 /* InteractionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 43ABBCA915B53A1400EA3111 /* InteractionCell.m */; }; 43AF417715C30B1600758366 /* 37x-Checkmark.png in Resources */ = {isa = PBXBuildFile; fileRef = 43AF417515C30B1600758366 /* 37x-Checkmark.png */; }; 43AF417815C30B1600758366 /* 37x-Checkmark@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 43AF417615C30B1600758366 /* 37x-Checkmark@2x.png */; }; + 43B3E32D15C4FC8200528A81 /* safari.png in Resources */ = {isa = PBXBuildFile; fileRef = 43B3E32B15C4FC8200528A81 /* safari.png */; }; + 43B3E32E15C4FC8200528A81 /* safari@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 43B3E32C15C4FC8200528A81 /* safari@2x.png */; }; 43B6A27315B6952F00CEA2E6 /* folder_2.png in Resources */ = {isa = PBXBuildFile; fileRef = 43B6A26D15B6952F00CEA2E6 /* folder_2.png */; }; 43B6A27415B6952F00CEA2E6 /* folder_2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 43B6A26E15B6952F00CEA2E6 /* folder_2@2x.png */; }; 43B6A27515B6952F00CEA2E6 /* group.png in Resources */ = {isa = PBXBuildFile; fileRef = 43B6A26F15B6952F00CEA2E6 /* group.png */; }; @@ -499,6 +501,8 @@ 43ABBCA915B53A1400EA3111 /* InteractionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InteractionCell.m; sourceTree = ""; }; 43AF417515C30B1600758366 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "37x-Checkmark.png"; sourceTree = ""; }; 43AF417615C30B1600758366 /* 37x-Checkmark@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "37x-Checkmark@2x.png"; sourceTree = ""; }; + 43B3E32B15C4FC8200528A81 /* safari.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = safari.png; sourceTree = ""; }; + 43B3E32C15C4FC8200528A81 /* safari@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "safari@2x.png"; sourceTree = ""; }; 43B6A26D15B6952F00CEA2E6 /* folder_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = folder_2.png; sourceTree = ""; }; 43B6A26E15B6952F00CEA2E6 /* folder_2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "folder_2@2x.png"; sourceTree = ""; }; 43B6A26F15B6952F00CEA2E6 /* group.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = group.png; sourceTree = ""; }; @@ -978,6 +982,8 @@ 431B857615A132B600DCE497 /* Images */ = { isa = PBXGroup; children = ( + 43B3E32B15C4FC8200528A81 /* safari.png */, + 43B3E32C15C4FC8200528A81 /* safari@2x.png */, 43AF417515C30B1600758366 /* 37x-Checkmark.png */, 43AF417615C30B1600758366 /* 37x-Checkmark@2x.png */, 432E2A0115C079770006EA51 /* folder_white.png */, @@ -1822,6 +1828,8 @@ 432E2A0415C079770006EA51 /* folder_white@2x.png in Resources */, 43AF417715C30B1600758366 /* 37x-Checkmark.png in Resources */, 43AF417815C30B1600758366 /* 37x-Checkmark@2x.png in Resources */, + 43B3E32D15C4FC8200528A81 /* safari.png in Resources */, + 43B3E32E15C4FC8200528A81 /* safari@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/media/ios/NewsBlur_Prefix.pch b/media/ios/NewsBlur_Prefix.pch index 3dfbf39bd..3569d4291 100644 --- a/media/ios/NewsBlur_Prefix.pch +++ b/media/ios/NewsBlur_Prefix.pch @@ -20,4 +20,4 @@ #define NEWSBLUR_ORANGE 0xAE5D15 -#endif +#endif \ No newline at end of file diff --git a/media/ios/Resources-iPad/Classes/StoryDetailViewController~ipad.xib b/media/ios/Resources-iPad/Classes/StoryDetailViewController~ipad.xib index c14a0a357..7586febdc 100644 --- a/media/ios/Resources-iPad/Classes/StoryDetailViewController~ipad.xib +++ b/media/ios/Resources-iPad/Classes/StoryDetailViewController~ipad.xib @@ -49,7 +49,7 @@ {{315, 455}, {139, 21}} - + _NS:9 NO YES @@ -4487,6 +4487,32 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE 1 YES + + + 266 + {{0, 936}, {768, 44}} + + + + _NS:9 + NO + NO + IBIPadFramework + + YES + + + + + 269 + {{335, 920}, {100, 77}} + + + + _NS:9 + NO + IBIPadFramework + 266 @@ -4498,7 +4524,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE {{334, 17}, {100, 11}} - + NO IBIPadFramework 0.5 @@ -4517,7 +4543,15 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE Previous IBIPadFramework - 86 + 1 + + + + + NSImage + 06-arrow-south.png + + IBIPadFramework 1 @@ -4527,6 +4561,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE 5 + Progress View IBIPadFramework 100 @@ -4552,17 +4587,14 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE NSImage - 06-arrow-south.png + safari.png IBIPadFramework - 38 - 1 - Next unread + Next Unread IBIPadFramework - 86 1 @@ -4572,32 +4604,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE MC4yNDcwNTg4Mzg2IDAuNDM5MjE1NzE5NyAwLjUzNzI1NDkyOTUAA - - - 266 - {{0, 936}, {768, 44}} - - - - _NS:9 - NO - NO - IBIPadFramework - - YES - - - - - 269 - {{335, 920}, {100, 77}} - - - - _NS:9 - NO - IBIPadFramework - {768, 980} @@ -4634,14 +4640,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE 81 - - - buttonNextStory - - - - 79 - buttonNext @@ -4690,6 +4688,22 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE 105 + + + buttonNextStory + + + + 107 + + + + originalStoryButton + + + + 109 + delegate @@ -4716,11 +4730,19 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE - doNextStory + showOriginalSubview: - 77 + 110 + + + + doNextStory + + + + 111 @@ -4741,8 +4763,8 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE YES - + @@ -4771,6 +4793,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE + @@ -4846,6 +4869,11 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE + + 106 + + + @@ -4859,6 +4887,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE 1.IBLastUsedUIStatusBarStylesToTargetRuntimesMap 1.IBPluginDependency 100.IBPluginDependency + 106.IBPluginDependency 39.IBPluginDependency 42.IBPluginDependency 43.IBPluginDependency @@ -4898,6 +4927,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -4912,7 +4942,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE - 105 + 111 @@ -6493,7 +6523,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE feedDetailViewController feedsMenuViewController feedsViewController - findFriendsNavigationController firstTimeUserAddFriendsViewController firstTimeUserAddNewsBlurViewController firstTimeUserAddSitesViewController @@ -6520,7 +6549,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE FeedDetailViewController FeedsMenuViewController NewsBlurViewController - UINavigationController FirstTimeUserAddFriendsViewController FirstTimeUserAddNewsBlurViewController FirstTimeUserAddSitesViewController @@ -6550,7 +6578,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE feedDetailViewController feedsMenuViewController feedsViewController - findFriendsNavigationController firstTimeUserAddFriendsViewController firstTimeUserAddNewsBlurViewController firstTimeUserAddSitesViewController @@ -6595,10 +6622,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE feedsViewController NewsBlurViewController - - findFriendsNavigationController - UINavigationController - firstTimeUserAddFriendsViewController FirstTimeUserAddFriendsViewController @@ -7061,6 +7084,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE doNextStory doNextUnreadStory doPreviousStory + showOriginalSubview: tapProgressBar: toggleFontSize: @@ -7071,6 +7095,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE id id id + id @@ -7080,6 +7105,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE doNextStory doNextUnreadStory doPreviousStory + showOriginalSubview: tapProgressBar: toggleFontSize: @@ -7097,6 +7123,10 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE doPreviousStory id + + showOriginalSubview: + id + tapProgressBar: id @@ -7258,8 +7288,17 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE YES 3 - 06-arrow-south.png - {10, 12} + YES + + YES + 06-arrow-south.png + safari.png + + + YES + {10, 12} + {24, 24} + 1181 diff --git a/media/ios/Resources/safari.png b/media/ios/Resources/safari.png new file mode 100644 index 000000000..642c4c409 Binary files /dev/null and b/media/ios/Resources/safari.png differ diff --git a/media/ios/Resources/safari@2x.png b/media/ios/Resources/safari@2x.png new file mode 100644 index 000000000..7978fc18a Binary files /dev/null and b/media/ios/Resources/safari@2x.png differ