summaryrefslogtreecommitdiff
path: root/Juick/Views/ConversationCell.m
blob: 4c1e71ccea81b0acecbca36b2c2979ef33229eb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
//  ConversationCell.m
//  Juick
//
//  Created by Vitaly Takmazov on 04/03/2018.
//  Copyright © 2018 com.juick. All rights reserved.
//

#import "ConversationCell.h"

@implementation ConversationCell

-(void) configureWithChat:(Chat *)chat {
    self.chatName.textColor = [UIColor colorNamed:@"Title"];
    self.chatName.text = chat.uname;
    self.lastMessage.text = chat.lastMessageText;
    self.unreadMarker.hidden = true;
    __weak UIImageView *weakAvatar = self.avatar;
    [[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:chat.avatar] callback:^(NSData *data) {
        [UIView transitionWithView:weakAvatar
                          duration:0.3
                           options:UIViewAnimationOptionTransitionCrossDissolve
                        animations:^{
                            weakAvatar.image = [UIImage imageWithData:data];
                        }
                        completion:nil];
    }];
}

@end