summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/AppDelegate.m5
-rw-r--r--Juick/Message.h3
-rw-r--r--Juick/Message.m5
-rw-r--r--Juick/MessageCell.h2
-rw-r--r--Juick/MessageCell.m43
-rw-r--r--Juick/MessagesViewController.m12
6 files changed, 65 insertions, 5 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index 2853cfd..b47e710 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -20,9 +20,10 @@
// style the navigation bar
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
[[UINavigationBar appearance] setBarTintColor:[ColorsAndButtons navbarBackground]];
- [[UINavigationBar appearance] setTintColor:[ColorsAndButtons navbarFont]];
- [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorsAndButtons navbarFont]}];
}
+ [[UINavigationBar appearance] setTintColor:[ColorsAndButtons navbarFont]];
+ [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorsAndButtons navbarFont]}];
+
// make the status bar white
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
diff --git a/Juick/Message.h b/Juick/Message.h
index 233f5ba..927d9f0 100644
--- a/Juick/Message.h
+++ b/Juick/Message.h
@@ -17,6 +17,9 @@
@property(nonatomic, copy) NSDecimalNumber *userID;
@property(nonatomic, copy) NSString *text;
@property(nonatomic, copy) NSArray *tags;
+@property(nonatomic, copy) NSString *timestamp;
+@property(nonatomic, copy) NSString *repliesBy;
+@property(nonatomic, copy) NSDecimalNumber *repliesCount;
+(void) pullNextFromURL:(NSURL *)url callback:(void(^)(NSArray *))callback;
diff --git a/Juick/Message.m b/Juick/Message.m
index f6fae85..7d805b4 100644
--- a/Juick/Message.m
+++ b/Juick/Message.m
@@ -20,7 +20,10 @@
@"body" : @"text",
@"mid" : @"MID",
@"rid" : @"RID",
- @"tags" : @"tags"
+ @"tags" : @"tags",
+ @"timestamp" : @"timestamp",
+ @"replies" : @"repliesCount",
+ @"repliesby": @"repliesBy"
}];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:mapping method:RKRequestMethodAny pathPattern:nil keyPath:nil statusCodes:nil];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
diff --git a/Juick/MessageCell.h b/Juick/MessageCell.h
index f6b7cc3..342aecc 100644
--- a/Juick/MessageCell.h
+++ b/Juick/MessageCell.h
@@ -15,8 +15,10 @@
@interface MessageCell : UITableViewCell<TTTAttributedLabelDelegate>
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
+@property (strong, nonatomic) IBOutlet UILabel *timestampLabel;
@property (strong, nonatomic) IBOutlet UIImageView *avatar;
@property (strong, nonatomic) IBOutlet TTTAttributedLabel *bodyLabel;
+@property (strong, nonatomic) IBOutlet UILabel *summaryLabel;
- (void)updateFonts;
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m
index c37a3bd..cf2e134 100644
--- a/Juick/MessageCell.m
+++ b/Juick/MessageCell.m
@@ -7,6 +7,7 @@
//
#import "MessageCell.h"
+#import "ColorsAndButtons.h"
#import "Masonry.h"
@interface MessageCell ()
@@ -21,6 +22,7 @@
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
+ self.selectionStyle = UITableViewCellSelectionStyleNone;
self.avatar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
[self.avatar setBackgroundColor:[UIColor clearColor]];
@@ -32,6 +34,14 @@
[self.titleLabel setTextColor:[UIColor blackColor]];
[self.titleLabel setBackgroundColor:[UIColor clearColor]];
+ self.timestampLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ [self.timestampLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
+ [self.timestampLabel setLineBreakMode:NSLineBreakByTruncatingTail];
+ [self.timestampLabel setNumberOfLines:1];
+ [self.timestampLabel setTextAlignment:NSTextAlignmentLeft];
+ [self.timestampLabel setTextColor:[UIColor grayColor]];
+ [self.timestampLabel setBackgroundColor:[UIColor clearColor]];
+
self.bodyLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
self.bodyLabel.dataDetectorTypes = NSTextCheckingTypeLink;
self.bodyLabel.delegate = self;
@@ -42,9 +52,21 @@
[self.bodyLabel setTextAlignment:NSTextAlignmentLeft];
[self.bodyLabel setTextColor:[UIColor darkGrayColor]];
[self.bodyLabel setBackgroundColor:[UIColor clearColor]];
+
+
+ self.summaryLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
+ [self.summaryLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
+ [self.summaryLabel setLineBreakMode:NSLineBreakByTruncatingTail];
+ [self.summaryLabel setNumberOfLines:1];
+ [self.summaryLabel setTextAlignment:NSTextAlignmentLeft];
+ [self.summaryLabel setTextColor:[UIColor grayColor]];
+ [self.summaryLabel setBackgroundColor:[UIColor clearColor]];
+
[self.contentView addSubview:self.avatar];
[self.contentView addSubview:self.titleLabel];
+ [self.contentView addSubview:self.timestampLabel];
[self.contentView addSubview:self.bodyLabel];
+ [self.contentView addSubview:self.summaryLabel];
[self updateFonts];
}
@@ -77,14 +99,29 @@
make.top.equalTo(self.contentView.top).with.offset(padding.top);
make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
}];
+ [self.timestampLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.leading.equalTo(self.avatar.trailing).with.offset(padding.left);
+ make.top.equalTo(self.titleLabel.bottom).with.offset(padding.top /2);
+ make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ }];
+
[self.bodyLabel makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentView).with.insets(padding).priorityLow();
make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
- make.top.equalTo(self.avatar.bottom).with.offset(padding.top);
+ make.top.equalTo(self.timestampLabel.bottom).with.offset(padding.top);
make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+ make.bottom.equalTo(self.summaryLabel.top).with.offset(-padding.bottom);
}];
+ [self.summaryLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.leading.equalTo(self.contentView.leading).with.offset(padding.left);
+ make.bottom.equalTo(self.contentView.bottom).with.offset(-padding.bottom);
+ make.trailing.equalTo(self.contentView.trailing).with.offset(-padding.right);
+
+ }];
+
+
+
self.didSetupConstraints = YES;
}
@@ -94,6 +131,8 @@
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
self.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
self.bodyLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
+ self.timestampLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote];
+ self.summaryLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote];
}
}
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 68c70cb..2e27d43 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -163,6 +163,12 @@ static NSString *CellIdentifier = @"MessageCell";
}];
cell.titleLabel.text = msg.user;
cell.titleLabel.textColor = [ColorsAndButtons linkColor];
+ cell.timestampLabel.text = msg.timestamp;
+ if (msg.repliesCount > 0) {
+ cell.summaryLabel.text = [NSString stringWithFormat:@"%@ replies by %@", msg.repliesCount, msg.repliesBy];
+ } else {
+ cell.summaryLabel.text = nil;
+ }
cell.bodyLabel.text = [msg.text stringByDecodingHTMLEntities];
if ([msg.tags count] > 0) {
cell.bodyLabel.text = [[NSString alloc] initWithFormat:@"%@\n%@", [msg.tags componentsJoinedByString:@", "],
@@ -187,6 +193,12 @@ static NSString *CellIdentifier = @"MessageCell";
}];
cell.titleLabel.text = msg.user;
+ cell.timestampLabel.text = msg.timestamp;
+ if (msg.repliesCount > 0) {
+ cell.summaryLabel.text = [NSString stringWithFormat:@"%@ replies by %@", msg.repliesCount, msg.repliesBy];
+ } else {
+ cell.summaryLabel.text = nil;
+ }
cell.bodyLabel.text = [msg.text stringByDecodingHTMLEntities];
if ([msg.tags count] > 0) {
cell.bodyLabel.text = [[NSString alloc] initWithFormat:@"%@\n%@", [msg.tags componentsJoinedByString:@", "],