summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/Model/Message.h1
-rw-r--r--Juick/Model/Message.m1
-rw-r--r--Juick/Model/User.m1
-rw-r--r--Juick/Views/MessageCell.m8
4 files changed, 11 insertions, 0 deletions
diff --git a/Juick/Model/Message.h b/Juick/Model/Message.h
index f822fdf..33d9911 100644
--- a/Juick/Model/Message.h
+++ b/Juick/Model/Message.h
@@ -25,6 +25,7 @@
@property NSNumber *repliesCount;
@property Attachment *attachment;
@property BOOL service;
+@property BOOL unread;
+(Message *) fromJSON:(NSDictionary *)jsonData;
diff --git a/Juick/Model/Message.m b/Juick/Model/Message.m
index 68cc7c9..f5c2640 100644
--- a/Juick/Model/Message.m
+++ b/Juick/Model/Message.m
@@ -22,6 +22,7 @@
message.user = [User fromJSON:jsonData[@"user"]];
message.timestamp = jsonData[@"timestamp"];
message.service = jsonData[@"service"];
+ message.unread = jsonData[@"unread"];
message.tags = jsonData[@"tags"];
NSMutableArray *entitiesArray = [NSMutableArray new];
for (NSDictionary *entityData in jsonData[@"entities"]) {
diff --git a/Juick/Model/User.m b/Juick/Model/User.m
index 5c5e553..f5b41f5 100644
--- a/Juick/Model/User.m
+++ b/Juick/Model/User.m
@@ -16,6 +16,7 @@
user.uid = jsonData[@"uid"];
user.uname = jsonData[@"uname"];
user.avatar = jsonData[@"avatar"];
+ user.unreadCount = [jsonData[@"messagesCount"] integerValue];
return user;
}
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m
index 4d53273..90d4ae2 100644
--- a/Juick/Views/MessageCell.m
+++ b/Juick/Views/MessageCell.m
@@ -18,6 +18,8 @@
@implementation MessageCell
+const NSString *unreadMarker = @"●";
+
- (void)awakeFromNib {
[super awakeFromNib];
self.text.textColor = [UIColor colorNamed:@"Text"];
@@ -90,6 +92,12 @@
} else {
self.summary.text = nil;
}
+ if (msg.unread) {
+ self.summary.text = [NSString stringWithFormat:@"%@ %@", unreadMarker, self.summary.text];
+ self.summary.textColor = [UIColor colorNamed:@"Funny"];
+ } else {
+ self.summary.textColor = [UIColor colorNamed:@"Muted"];
+ }
self.text.attributedText = nil;
if (msg.text) {
[self.text setHidden:NO];