EMChatManagerDelegate.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /**
  2. * \~chinese
  3. * @header EMChatManagerDelegate.h
  4. * @abstract 聊天相关代理协议类。
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMChatManagerDelegate.h
  10. * @abstract This protocol defines chat related callbacks.
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMRecallMessageInfo.h"
  16. @class EMChatMessage;
  17. @class EMError;
  18. @class EMMessageReactionChange;
  19. @class EMGroupMessageAck;
  20. @class EMConversation;
  21. /**
  22. * \~chinese
  23. * 聊天相关回调的协议类。
  24. *
  25. * \~english
  26. * The chat related callbacks.
  27. */
  28. @protocol EMChatManagerDelegate <NSObject>
  29. @optional
  30. #pragma mark - Conversation
  31. /**
  32. * \~chinese
  33. * 会话列表发生变化的回调。
  34. *
  35. * @param aConversationList 会话列表。 <EMConversation>
  36. *
  37. * \~english
  38. * Occurs when the conversation list changes.
  39. *
  40. * @param aConversationList The conversation NSArray. <EMConversation>
  41. */
  42. - (void)conversationListDidUpdate:(NSArray<EMConversation *> * _Nonnull)aConversationList;
  43. #pragma mark - Message
  44. /**
  45. * \~chinese
  46. * 收到消息的回调。
  47. *
  48. * @param aMessages 消息列表。
  49. *
  50. * \~english
  51. * Occurs when the SDK receives new messages.
  52. *
  53. * @param aMessages The received messages. An NSArray of the <EMChatMessage> objects.
  54. */
  55. - (void)messagesDidReceive:(NSArray<EMChatMessage *> * _Nonnull)aMessages;
  56. /**
  57. * \~chinese
  58. * 收到 CMD 消息代理。
  59. *
  60. * @param aCmdMessages CMD 消息列表。
  61. *
  62. * \~english
  63. * Occurs when receiving command messages.
  64. *
  65. * @param aCmdMessages The command message NSArray.
  66. */
  67. - (void)cmdMessagesDidReceive:(NSArray<EMChatMessage *> * _Nonnull)aCmdMessages;
  68. /**
  69. * \~chinese
  70. * 收到已读回执代理。
  71. *
  72. * @param aMessages 已读消息列表。
  73. *
  74. * \~english
  75. * Occurs when receiving read acknowledgement in message list.
  76. *
  77. * @param aMessages The read messages.
  78. */
  79. - (void)messagesDidRead:(NSArray<EMChatMessage *> * _Nonnull)aMessages;
  80. /**
  81. * \~chinese
  82. * 收到群消息已读回执代理。
  83. *
  84. * @param aMessages 已读消息列表。
  85. *
  86. * \~english
  87. * Occurs when the SDK receives read receipts for group messages.
  88. *
  89. * @param aMessages The acknowledged message NSArray.
  90. *
  91. *
  92. */
  93. - (void)groupMessageDidRead:(EMChatMessage * _Nonnull)aMessage
  94. groupAcks:(NSArray<EMGroupMessageAck *> * _Nonnull)aGroupAcks;
  95. /**
  96. * \~chinese
  97. * 当前用户所在群已读消息数量发生变化的回调。
  98. *
  99. * \~english
  100. * Occurs when the current group read messages count changed.
  101. *
  102. */
  103. - (void)groupMessageAckHasChanged;
  104. /**
  105. * \~chinese
  106. * 收到会话已读回调代理。
  107. *
  108. * @param from 会话已读回执的发送方。
  109. * @param to CHANNEL_ACK 接收方。
  110. *
  111. * 发送会话已读的是我方多设备:
  112. * 则 from 参数值是“我方登录” ID,to 参数值是“会话方”会话 ID,此会话“会话方”发送的消息会全部置为已读 isRead 为 YES。
  113. * 发送会话已读的是会话方:
  114. * 则 from 参数值是“会话方”会话 ID,to 参数值是“我方登录” ID,此会话“我方”发送的消息的 isReadAck 会全部置为 YES。
  115. * 注:此会话既会话方 ID 所代表的会话。
  116. *
  117. * \~english
  118. * Occurs when a conversation read receipt is received.
  119. * @param from The username who send channel_ack.
  120. * @param to The username who receive channel_ack.
  121. *
  122. * If the conversaion readack is from the current login ID's multiple devices:
  123. * The value of the "FROM" parameter is current login ID, and the value of the "to" parameter is the conversation ID. All the messages sent by the conversation are set to read: "isRead" is set to YES.
  124. * If the send conversation readack is from the conversation ID's device:
  125. * The value of the "FROM" parameter is the conversation ID, and the value of the "to" parameter is current login ID. The "isReaAck" of messages sent by login ID in this session will all be set to YES.
  126. * Note: This conversation is the conversation represented by the conversation ID.
  127. *
  128. *
  129. */
  130. - (void)onConversationRead:(NSString * _Nonnull)from to:(NSString * _Nonnull)to;
  131. /**
  132. * \~chinese
  133. * 发送方收到消息已送达的回调。
  134. *
  135. * @param aMessages 送达消息列表。
  136. *
  137. * \~english
  138. * Occurs when receiving delivered acknowledgement in message list.
  139. *
  140. * @param aMessages The acknowledged message NSArray.
  141. */
  142. - (void)messagesDidDeliver:(NSArray<EMChatMessage *> * _Nonnull)aMessages;
  143. /**
  144. * \~chinese
  145. * 收到消息撤回代理。
  146. *
  147. * @param aMessages 撤回消息列表。
  148. *
  149. * \~english
  150. * Occurs when a message is recalled.
  151. *
  152. * @param aMessages The list of recalled messages.
  153. */
  154. - (void)messagesInfoDidRecall:(NSArray<EMRecallMessageInfo *> * _Nonnull)aRecallMessagesInfo;
  155. /**
  156. * \~chinese
  157. * 消息状态发生变化的回调。消息状态包括消息创建,发送,发送成功,发送失败。
  158. *
  159. * 需要给发送消息的 callback 参数传入 nil,此回调才会生效。
  160. *
  161. * @param aMessage 状态发生变化的消息。
  162. * @param aError 出错信息。
  163. *
  164. * \~english
  165. * Occurs when message status has changed. You need to set the parameter as nil.
  166. *
  167. * @param aMessage The message whose status has changed.
  168. * @param aError The error information.
  169. */
  170. - (void)messageStatusDidChange:(EMChatMessage * _Nonnull)aMessage
  171. error:(EMError * _Nullable)aError;
  172. /**
  173. * \~chinese
  174. * 消息附件状态发生改变代理。
  175. *
  176. * @param aMessage 附件状态发生变化的消息。
  177. * @param aError 错误信息。
  178. *
  179. * \~english
  180. * Occurs when the message attachment status changed.
  181. *
  182. * @param aMessage The message whose attachment status has changed.
  183. * @param aError The error information.
  184. */
  185. - (void)messageAttachmentStatusDidChange:(EMChatMessage * _Nonnull)aMessage
  186. error:(EMError * _Nullable)aError;
  187. #pragma mark - Deprecated methods
  188. /**
  189. * \~chinese
  190. * 收到消息撤回代理。
  191. *
  192. * @param aMessages 撤回消息列表。
  193. *
  194. * 已废弃,请用 {@link messagesInfoDidRecall:} 代替。
  195. *
  196. * \~english
  197. * Occurs when a received message is recalled.
  198. *
  199. * @param aMessages The list of recalled messages.
  200. *
  201. * Deprecated. Please use {@link messagesInfoDidRecall:} instead.
  202. */
  203. - (void)messagesDidRecall:(NSArray *)aMessages __deprecated_msg("Use -messagesInfoDidRecall: instead");
  204. /*!
  205. * \~chinese
  206. * Reaction 数据发生改变事件回调。
  207. *
  208. * @param changes 发生改变的 Reaction。
  209. *
  210. * \~english
  211. * Occurs when the Reaction data changes.
  212. *
  213. * @param changes The Reaction which is changed.
  214. */
  215. - (void)messageReactionDidChange:(NSArray<EMMessageReactionChange *>* _Nonnull)changes;
  216. @end