| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // ChatMessageModel.h
- // AIIM
- //
- // Created by qitewei on 2025/5/14.
- //
- #import <Foundation/Foundation.h>
- #import <UIKit/UIKit.h>
- NS_ASSUME_NONNULL_BEGIN
- typedef NS_ENUM(NSUInteger, ChatMessageType) {
- ChatMessageTypeText=0, // 文字
- ChatMessageTypeImage=1, // 图片
- ChatMessageTypeFile=2, // 文件
- ChatMessageTypeVoice=3, // 语音
- ChatMessageTypeCallBack=4, // 撤回
- ChatMessageTypeVideo=5, // 视频
- ChatMessageTypeHistory=6, // 聊天记录
- ChatMessageTypeCall=7, // 通话记录
- ChatMessageTypeEvent = 9, //事件消息
- ChatMessageTypeCallBack2 = 11, // 撤回2
- ChatMessageTypeDel = 12, // 删除
- ChatMessageTypeDFBUSY = 13,// 对方正在忙
- };
- @interface ChatMessageModel : NSObject
- @property (nonatomic, assign) ChatMessageType messageType;
- @property (nonatomic, assign) NSInteger type; //0=友聊 1=群聊
- @property (nonatomic, assign) BOOL isSender; // 是否是发送方
- // 通用属性
- @property (nonatomic, copy) NSString * msgId;
- @property (nonatomic, copy) NSString * fromId;
- @property (nonatomic, copy) NSString * chatId;
- @property (nonatomic, copy) NSString *content;
- @property (nonatomic, strong) UIImage *placeholderImage;
- @property (nonatomic, assign) NSInteger timestamp;
- @property (nonatomic, assign) NSInteger localtime;
- @property (nonatomic, copy) NSString * formatterTime;
- @property (nonatomic, copy) NSString * avatar;
- @property (nonatomic, copy) NSString * nickName;
- // 已读状态
- @property (nonatomic, copy) NSString * readStatus;
- @property (nonatomic, assign) NSInteger readstate;
- //引用消息
- @property (nonatomic,strong) ChatMessageModel * quoteMessage;
- // 文件属性
- @property (nonatomic, copy) NSString * url;
- @property (nonatomic, copy) NSString * localurl;
- @property (nonatomic, copy) NSString *fileName;
- @property (nonatomic, assign) CGSize mediaSize;
- @property (nonatomic, copy) NSString *fileSize;
- @property (nonatomic, strong) UIImage *videoThumbnailImage; // 生成的缩略图缓存
- @property (nonatomic, assign) NSInteger voiceDuration;
- @property (nonatomic, assign) CGFloat voiceWidth;
- @property (nonatomic, assign) NSInteger fileError;//0 = 成功 1 = 失败
- @property (nonatomic, copy, nullable) NSString *customFileSize;
- // 通话记录属性
- @property (nonatomic, assign) NSInteger callDuration;
- @property (nonatomic, assign) BOOL isCallSuccess;
- ///是否是视频通话
- @property (nonatomic, assign) BOOL isVideo;
- //@相关
- @property (nonatomic, assign) BOOL atAll;
- @property (nonatomic, copy) NSArray * atUserIds;
- // 高度缓存
- @property (nonatomic, assign) CGFloat cellHeight;
- @property (nonatomic, assign) CGSize textLayoutSize;
- //合并转发
- @property (nonatomic, strong) NSArray * forwardMsgArray;
- @property (nonatomic, copy) NSDictionary * formerMessage;
- // 从字典初始化方法
- + (instancetype)modelWithDictionary:(NSDictionary *)dict;
- // 从字典设置属性方法
- - (void)setupWithDictionary:(NSDictionary *)dict;
- // 从模型设置属性方法
- - (void)exchangeModelWithModel:(ChatMessageModel *)model;
- // 生成缩略图的方法,同时判断是否开始下载视频
- - (void)generateThumbnailWithCompletion:(void(^)(UIImage *thumbnail))completion;
- //下载文件保存本地
- -(void)downloadFileIfNeed:(void(^)(NSInteger persent))loading;
- //上传文件
- @property (nonatomic,copy) void(^uploadPersentChange)(NSInteger index,NSInteger localtime);
- -(void)setuploadPersent:(NSInteger)persent localtime:(NSInteger)localtime;
- @end
- NS_ASSUME_NONNULL_END
|