Files
peko-ios/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/MessageOpenLiveModel.m
2023-07-14 18:50:55 +08:00

38 lines
1.1 KiB
Objective-C

//
// MessageOpenLiveModel.m
// YUMI
//
// Created by YUMI on 2023/1/30.
//
#import "MessageOpenLiveModel.h"
#import "AttachmentModel.h"
#import "ContentOpenLiveInfoModel.h"
#import "NSObject+MJExtension.h"
@implementation MessageOpenLiveModel
- (instancetype)initWithMessage:(NIMMessage *)message {
if (self = [super initWithMessage:message]) {
self.messageType = SessionMessageType_Custom;
self.contentSize = CGSizeMake(200, 50);
self.height = (50 + CONTENT_PADDING_V_TOTAL + MESSAGE_PADDING * 2);
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
AttachmentModel * attach = obj.attachment;
ContentOpenLiveInfoModel *info = [ContentOpenLiveInfoModel modelWithDictionary:attach.data];
self.userInfo = info;
self.uid = info.uid;
if (info.userVo.avatar.length > 0 && info.userVo.nick.length > 0) {
self.avatar = info.userVo.avatar;
self.nick = [NSString stringWithFormat:YMLocalizedString(@"MessageOpenLiveModel0"), info.userVo.nick];
}
}
return self;
}
- (NSString *)cellContent:(MessageBaseModel *)model {
return @"MessageContentOpenLiveView";
}
@end