rewriting the activity modules and getting the right data from the api

This commit is contained in:
Roy Yang 2012-07-28 23:31:12 -07:00
parent f6286fa333
commit 1d203cdb47
19 changed files with 191 additions and 221 deletions

View file

@ -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

View file

@ -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 {

View file

@ -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;

View file

@ -12,13 +12,13 @@
#import "UserProfileViewController.h"
#import <QuartzCore/QuartzCore.h>
#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

View file

@ -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 {

View file

@ -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

View file

@ -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;

View file

@ -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];
}

View file

@ -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]) {

View file

@ -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

View file

@ -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;

View file

@ -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];

View file

@ -13,7 +13,7 @@
@class ProfileBadge;
@interface UserProfileViewController : UIViewController
<UITableViewDataSource, UITableViewDelegate, ASIHTTPRequestDelegate> {
<UITableViewDataSource, UITableViewDelegate, ASIHTTPRequestDelegate> {
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;

View file

@ -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"]];
}
}

View file

@ -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 = "<group>"; };
43AF417515C30B1600758366 /* 37x-Checkmark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "37x-Checkmark.png"; sourceTree = "<group>"; };
43AF417615C30B1600758366 /* 37x-Checkmark@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "37x-Checkmark@2x.png"; sourceTree = "<group>"; };
43B3E32B15C4FC8200528A81 /* safari.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = safari.png; sourceTree = "<group>"; };
43B3E32C15C4FC8200528A81 /* safari@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "safari@2x.png"; sourceTree = "<group>"; };
43B6A26D15B6952F00CEA2E6 /* folder_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = folder_2.png; sourceTree = "<group>"; };
43B6A26E15B6952F00CEA2E6 /* folder_2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "folder_2@2x.png"; sourceTree = "<group>"; };
43B6A26F15B6952F00CEA2E6 /* group.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = group.png; sourceTree = "<group>"; };
@ -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;
};

View file

@ -20,4 +20,4 @@
#define NEWSBLUR_ORANGE 0xAE5D15
#endif
#endif

View file

@ -49,7 +49,7 @@
<string key="NSFrame">{{315, 455}, {139, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="155973878"/>
<reference key="NSNextKeyView" ref="88679899"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
@ -4487,6 +4487,32 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<int key="IBUIDataDetectorTypes">1</int>
<bool key="IBUIDetectsPhoneNumbers">YES</bool>
</object>
<object class="IBUIToolbar" id="88679899">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{0, 936}, {768, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="155973878"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableArray" key="IBUIItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="IBUIView" id="125226722">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">269</int>
<string key="NSFrame">{{335, 920}, {100, 77}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIToolbar" id="155973878">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">266</int>
@ -4498,7 +4524,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string key="NSFrame">{{334, 17}, {100, 11}}</string>
<reference key="NSSuperview" ref="155973878"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="88679899"/>
<reference key="NSNextKeyView" ref="125226722"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIProgress">0.5</float>
@ -4517,7 +4543,15 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<object class="IBUIBarButtonItem" id="542821156">
<string key="IBUITitle">Previous</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIWidth">86</float>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
<object class="IBUIBarButtonItem" id="1067612777">
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">06-arrow-south.png</string>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
@ -4527,6 +4561,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<int key="IBUISystemItemIdentifier">5</int>
</object>
<object class="IBUIBarButtonItem" id="812131495">
<string key="IBUITitle">Progress View</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIWidth">100</float>
<reference key="IBUICustomView" ref="484194819"/>
@ -4552,17 +4587,14 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<object class="IBUIBarButtonItem" id="672699755">
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">06-arrow-south.png</string>
<string key="NSResourceName">safari.png</string>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIWidth">38</float>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
<object class="IBUIBarButtonItem" id="1065495688">
<string key="IBUITitle">Next unread</string>
<string key="IBUITitle">Next Unread</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<float key="IBUIWidth">86</float>
<int key="IBUIStyle">1</int>
<reference key="IBUIToolbar" ref="155973878"/>
</object>
@ -4572,32 +4604,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<bytes key="NSRGB">MC4yNDcwNTg4Mzg2IDAuNDM5MjE1NzE5NyAwLjUzNzI1NDkyOTUAA</bytes>
</object>
</object>
<object class="IBUIToolbar" id="88679899">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{0, 936}, {768, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="125226722"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableArray" key="IBUIItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="IBUIView" id="125226722">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">269</int>
<string key="NSFrame">{{335, 920}, {100, 77}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</object>
<string key="NSFrameSize">{768, 980}</string>
<reference key="NSSuperview"/>
@ -4634,14 +4640,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
</object>
<int key="connectionID">81</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">buttonNextStory</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="672699755"/>
</object>
<int key="connectionID">79</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">buttonNext</string>
@ -4690,6 +4688,22 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
</object>
<int key="connectionID">105</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">buttonNextStory</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="1067612777"/>
</object>
<int key="connectionID">107</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">originalStoryButton</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="672699755"/>
</object>
<int key="connectionID">109</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
@ -4716,11 +4730,19 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">doNextStory</string>
<string key="label">showOriginalSubview:</string>
<reference key="source" ref="672699755"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">77</int>
<int key="connectionID">110</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">doNextStory</string>
<reference key="source" ref="1067612777"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">111</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@ -4741,8 +4763,8 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="155973878"/>
<reference ref="506862915"/>
<reference ref="88679899"/>
<reference ref="409639211"/>
<reference ref="88679899"/>
<reference ref="125226722"/>
</object>
<reference key="parent" ref="0"/>
@ -4771,6 +4793,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference ref="1036122720"/>
<reference ref="284060761"/>
<reference ref="812131495"/>
<reference ref="1067612777"/>
</object>
<reference key="parent" ref="191373211"/>
</object>
@ -4846,6 +4869,11 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference key="object" ref="125226722"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">106</int>
<reference key="object" ref="1067612777"/>
<reference key="parent" ref="155973878"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -4859,6 +4887,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>1.IBLastUsedUIStatusBarStylesToTargetRuntimesMap</string>
<string>1.IBPluginDependency</string>
<string>100.IBPluginDependency</string>
<string>106.IBPluginDependency</string>
<string>39.IBPluginDependency</string>
<string>42.IBPluginDependency</string>
<string>43.IBPluginDependency</string>
@ -4898,6 +4927,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@ -4912,7 +4942,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">105</int>
<int key="maxID">111</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -6493,7 +6523,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>feedDetailViewController</string>
<string>feedsMenuViewController</string>
<string>feedsViewController</string>
<string>findFriendsNavigationController</string>
<string>firstTimeUserAddFriendsViewController</string>
<string>firstTimeUserAddNewsBlurViewController</string>
<string>firstTimeUserAddSitesViewController</string>
@ -6520,7 +6549,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>FeedDetailViewController</string>
<string>FeedsMenuViewController</string>
<string>NewsBlurViewController</string>
<string>UINavigationController</string>
<string>FirstTimeUserAddFriendsViewController</string>
<string>FirstTimeUserAddNewsBlurViewController</string>
<string>FirstTimeUserAddSitesViewController</string>
@ -6550,7 +6578,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>feedDetailViewController</string>
<string>feedsMenuViewController</string>
<string>feedsViewController</string>
<string>findFriendsNavigationController</string>
<string>firstTimeUserAddFriendsViewController</string>
<string>firstTimeUserAddNewsBlurViewController</string>
<string>firstTimeUserAddSitesViewController</string>
@ -6595,10 +6622,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string key="name">feedsViewController</string>
<string key="candidateClassName">NewsBlurViewController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">findFriendsNavigationController</string>
<string key="candidateClassName">UINavigationController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">firstTimeUserAddFriendsViewController</string>
<string key="candidateClassName">FirstTimeUserAddFriendsViewController</string>
@ -7061,6 +7084,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>doNextStory</string>
<string>doNextUnreadStory</string>
<string>doPreviousStory</string>
<string>showOriginalSubview:</string>
<string>tapProgressBar:</string>
<string>toggleFontSize:</string>
</object>
@ -7071,6 +7095,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@ -7080,6 +7105,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string>doNextStory</string>
<string>doNextUnreadStory</string>
<string>doPreviousStory</string>
<string>showOriginalSubview:</string>
<string>tapProgressBar:</string>
<string>toggleFontSize:</string>
</object>
@ -7097,6 +7123,10 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<string key="name">doPreviousStory</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">showOriginalSubview:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">tapProgressBar:</string>
<string key="candidateClassName">id</string>
@ -7258,8 +7288,17 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">06-arrow-south.png</string>
<string key="NS.object.0">{10, 12}</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>06-arrow-south.png</string>
<string>safari.png</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{10, 12}</string>
<string>{24, 24}</string>
</object>
</object>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB