summaryrefslogtreecommitdiff
path: root/Juick/Views/MessageCell.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-10-15 23:47:11 +0300
committerGravatar Vitaly Takmazov2017-10-15 23:47:11 +0300
commit8ae952ec8df2a713afeaef5960a88888e050c6fc (patch)
treeb7b09deed573336e5d274eed790c30ba57e4a910 /Juick/Views/MessageCell.m
parent6499148cb3f62e20534b62c181125ebeacfa3438 (diff)
WIP
Diffstat (limited to 'Juick/Views/MessageCell.m')
-rw-r--r--Juick/Views/MessageCell.m26
1 files changed, 20 insertions, 6 deletions
diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m
index cc35446..1cfe304 100644
--- a/Juick/Views/MessageCell.m
+++ b/Juick/Views/MessageCell.m
@@ -6,11 +6,14 @@
// Copyright © 2016 com.juick. All rights reserved.
//
+
#import "MessageCell.h"
-@import YYWebImage;
+#import "ColorScheme.h"
+#import "UIImage+Utils.h"
+
@import DateTools;
@import MWFeedParser;
-#import "ColorScheme.h"
+@import YYWebImage;
@implementation MessageCell
@@ -20,11 +23,22 @@
self.text.delegate = self;
self.text.linkAttributes = @{ (id)kCTForegroundColorAttributeName: [ColorScheme linkColor],
(id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] };
+ self.title.textColor = [ColorScheme linkColor];
+ self.timestamp.textColor = [UIColor grayColor];
+ self.summary.textColor = [UIColor grayColor];
+ self.tags.textFont = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote];
}
-- (void) setMessage:(Message *)msg {
- _message = msg;
- self.avatar.yy_imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [msg.user.uid intValue]]];
+- (void) configureWithMessage:(Message *)msg {
+ [self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [msg.user.uid intValue]]]];
+ if ([msg.attach length] > 0) {
+ CGFloat imageHeight = [msg.attachment.small.height floatValue] / [[UIScreen mainScreen] scale];
+ self.attachmentHeight.constant = imageHeight;
+ [self.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] options:YYWebImageOptionProgressiveBlur|YYWebImageOptionSetImageWithFadeAnimation];
+ } else {
+ self.attachmentHeight.constant = 0;
+ self.attach.image = nil;
+ }
self.title.text = msg.user.uname;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
@@ -51,7 +65,7 @@
}
-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
- [[UIApplication sharedApplication] openURL:url];
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}
@end