Skip to content

Commit

Permalink
Unhighlight new feed entries after watching them.
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Blöte <mail@dennisbloete.de>
  • Loading branch information
priteau authored and Dennis Blöte committed Sep 20, 2009
1 parent 8d1f8ff commit de2e02f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Classes/FeedEntryController.m
Expand Up @@ -19,7 +19,8 @@ - (id)initWithFeedEntry:(GHFeedEntry *)theEntry {
}

- (void)viewDidLoad {
[super viewDidLoad];
[super viewDidLoad];
entry.read = YES;
[entry.user addObserver:self forKeyPath:kUserGravatarKeyPath options:NSKeyValueObservingOptionNew context:nil];
self.title = [entry.eventType capitalizedString];
titleLabel.text = entry.title;
Expand Down
2 changes: 2 additions & 0 deletions Classes/GHFeedEntry.h
Expand Up @@ -11,6 +11,7 @@
NSString *content;
NSString *authorName;
id eventItem;
BOOL read;
}

@property (nonatomic, retain) NSString *entryID;
Expand All @@ -22,5 +23,6 @@
@property (nonatomic, retain) NSString *authorName;
@property (nonatomic, retain) id eventItem;
@property (nonatomic, readonly) GHUser *user;
@property (nonatomic, readwrite) BOOL read;

@end
9 changes: 8 additions & 1 deletion Classes/GHFeedEntry.m
Expand Up @@ -5,7 +5,14 @@

@implementation GHFeedEntry

@synthesize entryID, eventType, eventItem, date, linkURL, title, content, authorName;
@synthesize entryID, eventType, eventItem, date, linkURL, title, content, authorName, read;

- (id)init {
if (self = [super init]) {
read = NO;
}
return self;
}

- (NSString *)description {
return [NSString stringWithFormat:@"<GHFeedEntry entryID:'%@' eventType:'%@' title:'%@' authorName:'%@'>", entryID, eventType, title, authorName];
Expand Down
9 changes: 8 additions & 1 deletion Classes/MyFeedsController.m
Expand Up @@ -88,6 +88,10 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}

- (void)viewWillAppear:(BOOL)animated {
[self.tableView reloadData];
}

- (void)feedParsingStarted {
loadCounter += 1;
reloadButton.enabled = NO;
Expand Down Expand Up @@ -123,7 +127,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}
GHFeedEntry *theEntry = [self.currentFeed.entries objectAtIndex:indexPath.row];
cell.entry = theEntry;
([theEntry.date compare:self.currentFeed.lastReadingDate] == NSOrderedDescending) ? [cell markAsNew] : [cell markAsRead];
if ((theEntry.read) || [theEntry.date compare:self.currentFeed.lastReadingDate] != NSOrderedDescending)
[cell markAsRead];
else
[cell markAsNew];
return cell;
}

Expand Down

0 comments on commit de2e02f

Please sign in to comment.