diff options
author | Vitaly Takmazov | 2019-10-02 11:19:23 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-10-02 11:19:23 +0300 |
commit | 0d0fa77e02a22bd7b70069c34f8b9f7308c03efd (patch) | |
tree | 74f0507a86bfb3de289cf0b5cfb75984be931a33 | |
parent | 0242688672c1c2e34e14471767a98ee108cd6bad (diff) |
Unread markers
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 12 | ||||
-rw-r--r-- | Juick/Model/Message.h | 1 | ||||
-rw-r--r-- | Juick/Model/Message.m | 1 | ||||
-rw-r--r-- | Juick/Model/User.m | 1 | ||||
-rw-r--r-- | Juick/Views/MessageCell.m | 8 |
5 files changed, 17 insertions, 6 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index a9a3312..3245679 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -734,7 +734,7 @@ CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEVELOPMENT_TEAM = KH4MX79ZK7; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch"; @@ -755,7 +755,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch"; INFOPLIST_FILE = "Juick/Supporting Files/Juick-Info.plist"; @@ -780,7 +780,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = KH4MX79ZK7; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -809,7 +809,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; @@ -889,7 +889,7 @@ CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEVELOPMENT_TEAM = KH4MX79ZK7; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Supporting Files/Juick-Prefix.pch"; @@ -915,7 +915,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 123; + CURRENT_PROJECT_VERSION = 124; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = KH4MX79ZK7; GCC_C_LANGUAGE_STANDARD = gnu11; 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]; |