/************************************************************ * * Hyphenate CONFIDENTIAL * __________________ * Copyright (C) 2016 Hyphenate Inc. All rights reserved. * * NOTICE: All information contained herein is, and remains * the property of Hyphenate Technologies. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Hyphenate Inc. */ #import "EaseCustomMessageCell.h" #import "EaseBubbleView+Gif.h" #import "UIImageView+WebCache.h" #import "UIImage+GIF.h" #import "IMessageModel.h" @interface EaseCustomMessageCell () @end @implementation EaseCustomMessageCell + (void)initialize { // UIAppearance Proxy Defaults } #pragma mark - IModelCell - (BOOL)isCustomBubbleView:(id)model { return YES; } - (void)setCustomModel:(id)model { UIImage *image = model.image; if (!image) { [self.bubbleView.imageView sd_setImageWithURL:[NSURL URLWithString:model.fileURLPath] placeholderImage:[UIImage imageNamed:model.failImageName]]; } else { _bubbleView.imageView.image = image; } if (model.avatarURLPath) { [self.avatarView sd_setImageWithURL:[NSURL URLWithString:model.avatarURLPath] placeholderImage:model.avatarImage]; } else { self.avatarView.image = model.avatarImage; } } - (void)setCustomBubbleView:(id)model { [_bubbleView setupGifBubbleView]; _bubbleView.imageView.image = [UIImage imageNamed:@"imageDownloadFail"]; } - (void)updateCustomBubbleViewMargin:(UIEdgeInsets)bubbleMargin model:(id)model { [_bubbleView updateGifMargin:bubbleMargin]; } /*! @method @brief 获取cell的重用标识 @discussion @param model 消息model @return 返回cell的重用标识 */ + (NSString *)cellIdentifierWithModel:(id)model { return model.isSender?@"EaseMessageCellSendGif":@"EaseMessageCellRecvGif"; } /*! @method @brief 获取cell的高度 @discussion @param model 消息model @return 返回cell的高度 */ + (CGFloat)cellHeightWithModel:(id)model { return 100; } @end