Skip to content

Commit

Permalink
Adding River of News views to iPhone App. Still needs network calls, …
Browse files Browse the repository at this point in the history
…headers, and touch events for section headers.
  • Loading branch information
samuelclay committed Oct 25, 2011
1 parent cdd42c8 commit 4486d9d
Show file tree
Hide file tree
Showing 10 changed files with 425 additions and 44 deletions.
8 changes: 8 additions & 0 deletions media/iphone/Classes/FeedDetailTableCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@


@interface FeedDetailTableCell : UITableViewCell {
// Feed view
UILabel *storyTitle;
UILabel *storyAuthor;
UILabel *storyDate;
UIImageView *storyUnreadIndicator;

// River view
UILabel *feedTitle;
UIImageView *feedFavicon;
}

@property (nonatomic, retain) IBOutlet UILabel *storyTitle;
@property (nonatomic, retain) IBOutlet UILabel *storyAuthor;
@property (nonatomic, retain) IBOutlet UILabel *storyDate;
@property (nonatomic, retain) IBOutlet UIImageView *storyUnreadIndicator;

@property (nonatomic, retain) IBOutlet UILabel *feedTitle;
@property (nonatomic, retain) IBOutlet UIImageView *feedFavicon;

@end
4 changes: 4 additions & 0 deletions media/iphone/Classes/FeedDetailTableCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ @implementation FeedDetailTableCell
@synthesize storyAuthor;
@synthesize storyDate;
@synthesize storyUnreadIndicator;
@synthesize feedTitle;
@synthesize feedFavicon;

- (id)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
Expand All @@ -36,6 +38,8 @@ - (void)dealloc {
[storyAuthor release];
[storyDate release];
[storyUnreadIndicator release];
[feedTitle release];
[feedFavicon release];
[super dealloc];
}

Expand Down
385 changes: 353 additions & 32 deletions media/iphone/Classes/FeedDetailTableCell.xib

Large diffs are not rendered by default.

41 changes: 35 additions & 6 deletions media/iphone/Classes/FeedDetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "Utilities.h"

#define kTableViewRowHeight 65;
#define kTableViewRiverRowHeight 85;

@implementation FeedDetailViewController

Expand Down Expand Up @@ -311,16 +312,27 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *FeedDetailCellIdentifier = @"FeedDetailCellIdentifier";

FeedDetailTableCell *cell = (FeedDetailTableCell *)[tableView dequeueReusableCellWithIdentifier:FeedDetailCellIdentifier];
static NSString *cellIdentifier;

if (appDelegate.isRiverView) {
cellIdentifier = @"FeedDetailCellIdentifier";
} else {
cellIdentifier = @"FeedDetailCellIdentifier";
}

FeedDetailTableCell *cell = (FeedDetailTableCell *)[tableView
dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"FeedDetailTableCell"
owner:self
options:nil];
for (id oneObject in nib) {
if ([oneObject isKindOfClass:[FeedDetailTableCell class]]) {
cell = (FeedDetailTableCell *)oneObject;
if (([(FeedDetailTableCell *)oneObject tag] == 0 && !appDelegate.isRiverView) ||
([(FeedDetailTableCell *)oneObject tag] == 1 && appDelegate.isRiverView)) {
cell = (FeedDetailTableCell *)oneObject;
}

}
}
}
Expand Down Expand Up @@ -349,6 +361,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
cell.storyUnreadIndicator.image = [UIImage imageNamed:@"bullet_red.png"];
}

// River view
id feedId = [story objectForKey:@"story_feed_id"];
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
NSDictionary *feed = [appDelegate.dictFeeds objectForKey:feedIdStr];

cell.feedTitle.text = [feed objectForKey:@"feed_title"];
cell.feedFavicon.image = [Utilities getImage:feedIdStr];

if ([[story objectForKey:@"read_status"] intValue] != 1) {
// Unread story
cell.storyTitle.textColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:1.0];
Expand All @@ -358,7 +378,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
cell.storyDate.textColor = [UIColor colorWithRed:0.14f green:0.18f blue:0.42f alpha:1.0];
cell.storyDate.font = [UIFont fontWithName:@"Helvetica-Bold" size:10];
cell.storyUnreadIndicator.alpha = 1;

cell.feedTitle.textColor = [UIColor colorWithRed:0.58f green:0.58f blue:0.58f alpha:1.0];
cell.feedTitle.font = [UIFont fontWithName:@"Helvetica-Bold" size:11];
cell.feedFavicon.alpha = 1;
} else {
// Read story
cell.storyTitle.textColor = [UIColor colorWithRed:0.15f green:0.25f blue:0.25f alpha:0.9];
Expand All @@ -368,6 +390,9 @@ - (UITableViewCell *)tableView:(UITableView *)tableView
cell.storyDate.textColor = [UIColor colorWithRed:0.14f green:0.18f blue:0.42f alpha:0.5];
cell.storyDate.font = [UIFont fontWithName:@"Helvetica" size:10];
cell.storyUnreadIndicator.alpha = 0.15f;
cell.feedTitle.textColor = [UIColor colorWithRed:0.4f green:0.4f blue:0.4f alpha:0.7];
cell.feedTitle.font = [UIFont fontWithName:@"Helvetica" size:11];
cell.feedFavicon.alpha = 0.5f;
}

return cell;
Expand All @@ -387,7 +412,11 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
if (self.pageFinished) return 16;
else return kTableViewRowHeight;
} else {
return kTableViewRowHeight;
if (appDelegate.isRiverView) {
return kTableViewRiverRowHeight;
} else {
return kTableViewRowHeight;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions media/iphone/Classes/NewsBlurAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
OriginalStoryViewController *originalStoryViewController;

NSString * activeUsername;
BOOL isRiverView;
NSDictionary * activeFeed;
NSString * activeFolder;
NSArray * activeFeedStories;
Expand Down Expand Up @@ -54,6 +55,7 @@
@property (nonatomic, retain) IBOutlet OriginalStoryViewController *originalStoryViewController;

@property (readwrite, retain) NSString * activeUsername;
@property (nonatomic, readwrite) BOOL isRiverView;
@property (readwrite, retain) NSDictionary * activeFeed;
@property (readwrite, retain) NSString * activeFolder;
@property (readwrite, retain) NSArray * activeFeedStories;
Expand Down
1 change: 1 addition & 0 deletions media/iphone/Classes/NewsBlurAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ @implementation NewsBlurAppDelegate
@synthesize originalStoryViewController;

@synthesize activeUsername;
@synthesize isRiverView;
@synthesize activeFeed;
@synthesize activeFolder;
@synthesize activeFeedStories;
Expand Down
1 change: 1 addition & 0 deletions media/iphone/Classes/NewsBlurViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- (void)finishLoadingFeedList:(ASIHTTPRequest *)request;

- (IBAction)doLogoutButton;
- (void)didSelectSectionHeader;
- (IBAction)selectIntelligence;
- (void)updateFeedsWithIntelligence:(int)previousLevel newLevel:(int)newLevel;
- (void)calculateFeedLocations:(BOOL)markVisible;
Expand Down
11 changes: 11 additions & 0 deletions media/iphone/Classes/NewsBlurViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ - (void)tableView:(UITableView *)tableView
[appDelegate setActiveFeed:feed];
[appDelegate setActiveFolder:folderName];
appDelegate.readStories = [NSMutableArray array];
appDelegate.isRiverView = NO;

[appDelegate loadFeedDetailView];
}
Expand Down Expand Up @@ -485,6 +486,12 @@ - (UIView *)tableView:(UITableView *)tableView
[customView addSubview:folderImageView];
[folderImageView release];

UIButton *invisibleHeaderButton = [UIButton buttonWithType:UIButtonTypeCustom];
invisibleHeaderButton.frame = CGRectMake(0, 0, customView.frame.size.width, customView.frame.size.height);
invisibleHeaderButton.alpha = .1;
[invisibleHeaderButton addTarget:self action:@selector(didSelectSectionHeader) forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:invisibleHeaderButton];

return customView;
}

Expand All @@ -496,6 +503,10 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege
return 21;
}

- (void)didSelectSectionHeader {
NSLog(@"Touched");
}

- (IBAction)selectIntelligence {
NSInteger newLevel = [self.intelligenceControl selectedSegmentIndex] - 1;
NSInteger previousLevel = [appDelegate selectedIntelligence];
Expand Down
12 changes: 8 additions & 4 deletions media/iphone/NewsBlur.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = (
armv6,
"$(ARCHS_STANDARD_32_BIT)",
);
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -641,17 +644,19 @@
);
PRODUCT_NAME = NewsBlur;
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
};
name = Debug;
};
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = (
armv6,
"$(ARCHS_STANDARD_32_BIT)",
);
CODE_SIGN_ENTITLEMENTS = Entitlements.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = NewsBlur_Prefix.pch;
Expand All @@ -668,7 +673,6 @@
);
PRODUCT_NAME = NewsBlur;
PROVISIONING_PROFILE = "";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
4 changes: 2 additions & 2 deletions media/iphone/NewsBlur_Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// #define BACKGROUND_REFRESH_SECONDS -5
#define BACKGROUND_REFRESH_SECONDS -10*60

// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.host:8000"]
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]

#endif

0 comments on commit 4486d9d

Please sign in to comment.