NIMMessageModel.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // NIMMessageModel.h
  3. // NIMKit
  4. //
  5. // Created by NetEase.
  6. // Copyright (c) 2015年 NetEase. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "NIMSessionConfig.h"
  10. @interface NIMMessageModel : NSObject
  11. /**
  12. * 消息数据
  13. */
  14. @property (nonatomic,strong) NIMMessage *message;
  15. /**
  16. * 时间戳
  17. *
  18. * @discussion 这个时间戳为缓存的界面显示的时间戳,消息发出的时候记录下的本地时间,
  19. * 由于 NIMMessage 在服务器确认收到后会将自身发送时间 timestamp 字段修正为服务器时间,所以缓存当前发送的本地时间避免刷新时由于发送时间修
  20. * 改导致的消息界面位置跳跃。
  21. * messageTime 和 message.timestamp 会有一定的误差。
  22. */
  23. @property (nonatomic,readonly) NSTimeInterval messageTime;
  24. @property (nonatomic, readonly) UIEdgeInsets contentViewInsets;
  25. @property (nonatomic, readonly) UIEdgeInsets bubbleViewInsets;
  26. @property (nonatomic, readonly) CGPoint avatarMargin;
  27. @property (nonatomic, readonly) CGPoint nickNameMargin;
  28. @property(nonatomic, readonly) CGSize avatarSize;
  29. @property (nonatomic, readonly) BOOL shouldShowAvatar;
  30. @property (nonatomic, readonly) BOOL shouldShowNickName;
  31. @property (nonatomic, readonly) BOOL shouldShowLeft;
  32. @property (nonatomic) BOOL shouldShowReadLabel;
  33. /**
  34. * NIMMessage封装成NIMMessageModel的方法
  35. *
  36. * @param message 消息体
  37. *
  38. * @return NIMMessageModel实例
  39. */
  40. - (instancetype)initWithMessage:(NIMMessage*)message;
  41. /**
  42. * 清楚缓存的排版数据
  43. */
  44. - (void)cleanCache;
  45. /**
  46. * 计算内容大小
  47. */
  48. - (CGSize)contentSize:(CGFloat)width;
  49. @end