// // BubbleMessageCell.m // Juick // // Created by Vitaly Takmazov on 04/03/2018. // Copyright © 2018 com.juick. All rights reserved. // #import "BubbleMessageCell.h" #import "ColorScheme.h" @implementation BubbleMessageCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe { self.message.backgroundColor = isMe ? [ColorScheme secondaryBackground] : [ColorScheme mainBackground]; self.message.textColor = isMe ? [UIColor whiteColor] : [ColorScheme textColor]; self.message.dataDetectorTypes = UIDataDetectorTypeAll; self.message.tintColor = isMe? [UIColor whiteColor] : [ColorScheme linkColor]; self.name.text = message.user.uname; self.message.text = message.text; self.unreadMarker.text = @""; __weak UIImageView *weakAvatar = self.avatarView; [self.avatarView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:message.user.avatar]] placeholderImage:nil success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { [UIView transitionWithView:weakAvatar duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ weakAvatar.image = image; } completion:nil]; } failure:nil]; } @end