DKMessage.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // DKMessage.h
  3. // chatandvideotestframework
  4. //
  5. // Created by Dongke on 15/11/18.
  6. // Copyright © 2015年 dongke. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "DKMessageModel.h"
  11. @interface DKMessage : NSObject<DKMessageModel,NSCoding,NSCopying>
  12. @property (nonatomic, copy) NSString *text;
  13. @property (nonatomic, strong) UIImage *photo;
  14. @property (nonatomic, copy) NSString *thumbnailUrl;
  15. @property (nonatomic, copy) NSString *originPhotoUrl;
  16. @property (nonatomic, strong) UIImage *videoConverPhoto;
  17. @property (nonatomic, copy) NSString *videoPath;
  18. @property (nonatomic, copy) NSString *videoUrl;
  19. @property (nonatomic, copy) NSString *voicePath;
  20. @property (nonatomic, copy) NSString *voiceUrl;
  21. @property (nonatomic, copy) NSString *voiceDuration;
  22. @property (nonatomic, copy) NSString *emotionPath;
  23. @property (nonatomic, strong) UIImage *localPositionPhoto;
  24. @property (nonatomic, copy) NSString *geolocations;
  25. @property (nonatomic, strong) CLLocation *location;
  26. @property (nonatomic, strong) UIImage *avatar;
  27. @property (nonatomic, copy) NSString *avatarUrl;
  28. @property (nonatomic, copy) NSString *sender;
  29. @property (nonatomic, strong) NSDate *timestamp;
  30. @property (nonatomic, assign) BOOL shouldShowUserName;
  31. @property (nonatomic, assign) BOOL sended;
  32. @property (nonatomic, assign) DKBubbleMessageMediaType messageMediaType;
  33. @property (nonatomic, assign) DKBubbleMessageType bubbleMessageType;
  34. @property (nonatomic) BOOL isRead;
  35. /**
  36. * 初始化文本消息
  37. *
  38. * @param text 发送的目标文本
  39. * @param sender 发送者的名称
  40. * @param date 发送的时间
  41. *
  42. * @return 返回Message model 对象
  43. */
  44. - (instancetype)initWithText:(NSString *)text
  45. sender:(NSString *)sender
  46. timestamp:(NSDate *)timestamp;
  47. /**
  48. * 初始化图片类型的消息
  49. *
  50. * @param photo 目标图片
  51. * @param thumbnailUrl 目标图片在服务器的缩略图地址
  52. * @param originPhotoUrl 目标图片在服务器的原图地址
  53. * @param sender 发送者
  54. * @param date 发送时间
  55. *
  56. * @return 返回Message model 对象
  57. */
  58. - (instancetype)initWithPhoto:(UIImage *)photo
  59. thumbnailUrl:(NSString *)thumbnailUrl
  60. originPhotoUrl:(NSString *)originPhotoUrl
  61. sender:(NSString *)sender
  62. timestamp:(NSDate *)timestamp;
  63. /**
  64. * 初始化视频类型的消息
  65. *
  66. * @param videoConverPhoto 目标视频的封面图
  67. * @param videoPath 目标视频的本地路径,如果是下载过,或者是从本地发送的时候,会存在
  68. * @param videoUrl 目标视频在服务器上的地址
  69. * @param sender 发送者
  70. * @param date 发送时间
  71. *
  72. * @return 返回Message model 对象
  73. */
  74. - (instancetype)initWithVideoConverPhoto:(UIImage *)videoConverPhoto
  75. videoPath:(NSString *)videoPath
  76. videoUrl:(NSString *)videoUrl
  77. sender:(NSString *)sender
  78. timestamp:(NSDate *)timestamp;
  79. /**
  80. * 初始化语音类型的消息
  81. *
  82. * @param voicePath 目标语音的本地路径
  83. * @param voiceUrl 目标语音在服务器的地址
  84. * @param voiceDuration 目标语音的时长
  85. * @param sender 发送者
  86. * @param date 发送时间
  87. *
  88. * @return 返回Message model 对象
  89. */
  90. - (instancetype)initWithVoicePath:(NSString *)voicePath
  91. voiceUrl:(NSString *)voiceUrl
  92. voiceDuration:(NSString *)voiceDuration
  93. sender:(NSString *)sender
  94. timestamp:(NSDate *)timestamp;
  95. /**
  96. * 初始化语音类型的消息。增加已读未读标记
  97. *
  98. * @param voicePath 目标语音的本地路径
  99. * @param voiceUrl 目标语音在服务器的地址
  100. * @param voiceDuration 目标语音的时长
  101. * @param sender 发送者
  102. * @param date 发送时间
  103. * @param isRead 已读未读标记
  104. *
  105. * @return 返回Message model 对象
  106. */
  107. - (instancetype)initWithVoicePath:(NSString *)voicePath
  108. voiceUrl:(NSString *)voiceUrl
  109. voiceDuration:(NSString *)voiceDuration
  110. sender:(NSString *)sender
  111. timestamp:(NSDate *)timestamp
  112. isRead:(BOOL)isRead;
  113. /**
  114. * 初始化gif表情类型的消息
  115. *
  116. * @param emotionPath 表情的路径
  117. * @param sender 发送者
  118. * @param timestamp 发送时间
  119. *
  120. * @return 返回Message model 对象
  121. */
  122. - (instancetype)initWithEmotionPath:(NSString *)emotionPath
  123. sender:(NSString *)sender
  124. timestamp:(NSDate *)timestamp;
  125. /**
  126. * 初始化地理位置的消息
  127. *
  128. * @param localPositionPhoto 地理位置默认显示的图
  129. * @param geolocations 地理位置的信息
  130. * @param location 地理位置的经纬度
  131. * @param sender 发送者
  132. * @param timestamp 发送时间
  133. *
  134. * @return 返回Message model 对象
  135. */
  136. - (instancetype)initWithLocalPositionPhoto:(UIImage *)localPositionPhoto
  137. geolocations:(NSString *)geolocations
  138. location:(CLLocation *)location
  139. sender:(NSString *)sender
  140. timestamp:(NSDate *)timestamp;
  141. @end