EMGroupManagerDelegate.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. /**
  2. * \~chinese
  3. * @header EMGroupManagerDelegate.h
  4. * @abstract 群组相关的管理协议类。
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMGroupManagerDelegate.h
  10. * @abstract This protocol defined the callbacks of group.
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. /**
  16. * \~chinese
  17. * 离开群组原因。
  18. *
  19. * \~english
  20. * The reasons for a group member leaving the group.
  21. */
  22. typedef NS_ENUM(NSInteger, EMGroupLeaveReason) {
  23. EMGroupLeaveReasonBeRemoved = 0, /** \~chinese 成员被群主移除。 \~english The member is removed by the group owner. */
  24. EMGroupLeaveReasonUserLeave, /** \~chinese 成员主动离开群组。 \~english The member leaves the group.*/
  25. EMGroupLeaveReasonDestroyed, /** \~chinese 群组被销毁。 \~english The group is destroyed.*/
  26. };
  27. @class EMGroup;
  28. @class EMGroupSharedFile;
  29. /**
  30. * \~chinese
  31. * 群组相关的管理协议类。
  32. *
  33. * \~english
  34. * The group manager delegates.
  35. */
  36. @protocol EMGroupManagerDelegate <NSObject>
  37. @optional
  38. /**
  39. * \~chinese
  40. * 收到群组邀请回调。
  41. *
  42. * 该回调是由远端用户发送群组邀请触发的。如,用户 A 邀请用户 B 入群,则用户 B 会收到该回调。
  43. *
  44. * @param aGroupId 群组 ID。
  45. * @param aGroupName 群组名称。
  46. * @param aInviter 发送群组邀请的用户。
  47. * @param aMessage 群组邀请的信息。
  48. *
  49. * \~english
  50. * Occurs when the user receives a group invitation.
  51. *
  52. * This callback is triggered by a peer user sending a group invitation. For example, after user A sends user B a group invitation, user B receives this callback.
  53. *
  54. * @param aGroupId The group ID.
  55. * @param aGroupName The group name.
  56. * @param aInviter The user sending the group invitation.
  57. * @param aMessage The invitation message.
  58. */
  59. - (void)groupInvitationDidReceive:(NSString *_Nonnull)aGroupId
  60. groupName:(NSString *_Nonnull)aGroupName
  61. inviter:(NSString *_Nonnull)aInviter
  62. message:(NSString *_Nullable)aMessage;
  63. /**
  64. * \~chinese
  65. * 远端用户接受群组邀请回调。
  66. *
  67. * 该回调是由远端用户接受本地用户发送的群组邀请触发的。如,用户 B 接受用户 A 的群组邀请后,用户 A 会收到该回调。
  68. *
  69. * @param aGroup 群组实例。
  70. * @param aInvitee 被邀请者。
  71. *
  72. * \~english
  73. * This callback is triggered when the peer user accepts the group invitation sent by the local user. For example, user B accepts the invitation of user A, user A receives this callback.
  74. *
  75. * @param aGroup The group instance.
  76. * @param aInvitee The user that accepts the invitation.
  77. */
  78. - (void)groupInvitationDidAccept:(EMGroup *_Nonnull)aGroup
  79. invitee:(NSString *_Nonnull)aInvitee;
  80. /**
  81. * \~chinese
  82. * 远端用户拒绝群组邀请回调。
  83. *
  84. * 该回调是由远端用户拒绝本地用户发送的群组邀请触发的。如,用户 B 拒绝用户 A 的群组邀请后,用户 A 会收到该回调。
  85. *
  86. * @param aGroup 群组。
  87. * @param aInvitee 被邀请者。
  88. * @param aReason 拒绝理由。
  89. *
  90. * \~english
  91. * Occurs when the group invitation is declined.
  92. *
  93. * This callback is triggered when a peer user declines the group invitation sent by the local user. For example, user B declines the group invitation sent by user A, user A receives this callback.
  94. *
  95. * @param aGroup The group instance.
  96. * @param aInvitee The invitee.
  97. * @param aReason The reason for declining the group invitation.
  98. */
  99. - (void)groupInvitationDidDecline:(EMGroup *_Nonnull)aGroup
  100. invitee:(NSString *_Nonnull)aInvitee
  101. reason:(NSString *_Nullable)aReason;
  102. /**
  103. * \~chinese
  104. * 自动加入群组回调。
  105. *
  106. * 如果你在 EMOptions 中将 isAutoAcceptGroupInvitation 设为 YES,则在收到其他用户的群组邀请后,SDK 会自动进群,并触发该回调。
  107. *
  108. *
  109. * @param aGroup 群组实例。
  110. * @param aInviter 邀请者。
  111. * @param aMessage 邀请消息。
  112. *
  113. * \~english
  114. * Occurs when the SDK automatically joins the group.
  115. *
  116. * If isAutoAcceptGroupInvitation in EMOptions is set as YES, when you receive a group invitation, the SDK automatically accepts the invitation and joins the group.
  117. *
  118. * Needs to set the EMOptions's isAutoAcceptGroupInvitation property as YES.
  119. *
  120. * @param aGroup The group instance.
  121. * @param aInviter The inviter.
  122. * @param aMessage The invite message.
  123. */
  124. - (void)didJoinGroup:(EMGroup *_Nonnull)aGroup
  125. inviter:(NSString *_Nonnull)aInviter
  126. message:(NSString *_Nullable)aMessage;
  127. /**
  128. * \~chinese
  129. * 离开群组回调。
  130. *
  131. * @param aGroup 群组实例。
  132. * @param aReason 离开原因。
  133. *
  134. * \~english
  135. * Occurs when the user leaves a group.
  136. *
  137. * @param aGroup The group instance.
  138. * @param aReason The reason for leaving the group.
  139. */
  140. - (void)didLeaveGroup:(EMGroup *_Nonnull)aGroup
  141. reason:(EMGroupLeaveReason)aReason;
  142. /**
  143. * \~chinese
  144. * 群主收到用户入群申请回调。
  145. *
  146. * 如果你将群组类型设置为 EMGroupStylePublicJoinNeedApproval,则用户申请入群时,群主会收到该回调。
  147. *
  148. * @param aGroup 群组实例。
  149. * @param aApplicant 申请者。
  150. * @param aReason 申请者的附属信息。
  151. *
  152. * \~english
  153. * Occurs when the group owner receives a join request.
  154. *
  155. * If you set the group type as EMGroupStylePublicJoinNeedApproval, when a user requests to join the group, the group owner receives this callback.
  156. *
  157. * @param aGroup The group instance.
  158. * @param aUsername The user that sends the join request.
  159. * @param aReason The extra information for joining the group.
  160. */
  161. - (void)joinGroupRequestDidReceive:(EMGroup *_Nonnull)aGroup
  162. user:(NSString *_Nonnull)aUsername
  163. reason:(NSString *_Nullable)aReason;
  164. /**
  165. * \~chinese
  166. * 群主拒绝入群申请回调。
  167. *
  168. * 如果你将群组类型设为 EMGroupStylePublicJoinNeedApproval,则群主拒绝用户的入群申请后,该用户会收到该回调。
  169. *
  170. * @param aGroupId 群组 ID。
  171. * @param aReason 拒绝理由。
  172. *
  173. * \~english
  174. * If you set the group type as EMGroupStylePublicJoinNeedApproval, when the group owner declines a join request, the user that sends the request receives this callback.
  175. *
  176. * @param aGroupId The group ID.
  177. * @param aReason The reason for declining the join request.
  178. */
  179. - (void)joinGroupRequestDidDecline:(NSString *_Nonnull)aGroupId
  180. reason:(NSString *_Nullable)aReason;
  181. /**
  182. * \~chinese
  183. * 加入群组申请已同意回调。
  184. *
  185. * 如果你将群组类型设为 EMGroupStylePublicJoinNeedApproval,则群主同意用户的入群申请后,该用户会收到该回调。
  186. *
  187. * @param aGroup 通过申请的群组。
  188. *
  189. * \~english
  190. * If you set the group type as EMGroupStylePublicJoinNeedApproval, when the group owner approves the join request, the user that sends the request receives this callback.
  191. *
  192. * @param aGroup The group instance.
  193. */
  194. - (void)joinGroupRequestDidApprove:(EMGroup *_Nonnull)aGroup;
  195. /**
  196. * \~chinese
  197. * 群组列表发生变化回调。
  198. *
  199. * @param aGroupList 群组列表,详见 <EMGroup>。
  200. *
  201. * \~english
  202. * Occurs when the group list updates.
  203. *
  204. * @param aGroupList The group NSArray. See <EMGroup>.
  205. */
  206. - (void)groupListDidUpdate:(NSArray<EMGroup *> *_Nonnull)aGroupList;
  207. /**
  208. * \~chinese
  209. * 群成员加入群禁言列表回调。
  210. *
  211. * @param aGroup 群组实例。
  212. * @param aMutedMembers 被禁言的成员。
  213. * @param aMuteExpire 禁言失效时间,当前不可用。禁言后是永久禁言,直到被取消禁言。
  214. *
  215. * \~english
  216. * Occurs when the group members are added to the group mute list.
  217. *
  218. * @param aGroup The group instance.
  219. * @param aMutedMembers The group members that are added to the mute list.
  220. * @param aMuteExpire The time when the mute state expires. This parameter is not available at the moment.
  221. */
  222. - (void)groupMuteListDidUpdate:(EMGroup *_Nonnull)aGroup
  223. addedMutedMembers:(NSArray<NSString *> *_Nonnull)aMutedMembers
  224. muteExpire:(NSInteger)aMuteExpire;
  225. /**
  226. * \~chinese
  227. * 成员被移出禁言列表回调。
  228. *
  229. * @param aGroup 群组实例。
  230. * @param aMutedMembers 移出禁言列表的成员。
  231. *
  232. * \~english
  233. * Occurs when the group members are removed from the mute list.
  234. *
  235. * @param aGroup The group instance.
  236. * @param aMutedMembers The group members removed from the mute list.
  237. */
  238. - (void)groupMuteListDidUpdate:(EMGroup *_Nonnull)aGroup
  239. removedMutedMembers:(NSArray<NSString *> *_Nonnull)aMutedMembers;
  240. /**
  241. * \~chinese
  242. * 用户加入白名单回调。
  243. *
  244. * @param aGroup 群组实例。
  245. * @param aMembers 被加入白名单的成员。
  246. *
  247. * \~english
  248. * Occurs when the group members are added to the allowlist.
  249. *
  250. * @param aGroup The group instance.
  251. * @param aMembers The group members added to the allowlist.
  252. */
  253. - (void)groupWhiteListDidUpdate:(EMGroup *_Nonnull)aGroup
  254. addedWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers;
  255. /**
  256. * \~chinese
  257. * 用户被移出白名单回调。
  258. *
  259. * @param aGroup 群组实例。
  260. * @param aMembers 被移出白名单的成员。
  261. *
  262. * \~english
  263. * Occurs when the group members are removed from the allowlist.
  264. *
  265. * @param aGroup The group instance.
  266. * @param aMembers The group members removed from the allowlist.
  267. */
  268. - (void)groupWhiteListDidUpdate:(EMGroup *_Nonnull)aGroup
  269. removedWhiteListMembers:(NSArray<NSString *> *_Nonnull)aMembers;
  270. /**
  271. * \~chinese
  272. * 群组全部成员禁言状态发生变化回调。
  273. *
  274. * @param aGroup 群组实例。
  275. * @param aMuted 是否被全部禁言。
  276. *
  277. * \~english
  278. * Occurs when the mute state of all group members changes.
  279. *
  280. * @param aGroup The group instance.
  281. * @param aMuted Whether all the group members are muted.
  282. */
  283. - (void)groupAllMemberMuteChanged:(EMGroup *_Nonnull)aGroup
  284. isAllMemberMuted:(BOOL)aMuted;
  285. /**
  286. * \~chinese
  287. * 成员被加入管理员列表回调。
  288. *
  289. * @param aGroup 群组实例。
  290. * @param aAdmin 加入管理员列表的成员。
  291. *
  292. * \~english
  293. * Occurs when a group member is added to the admin list.
  294. *
  295. * @param aGroup The group instance.
  296. * @param aAdmin The group member added to the admin list.
  297. */
  298. - (void)groupAdminListDidUpdate:(EMGroup *_Nonnull)aGroup
  299. addedAdmin:(NSString *_Nonnull)aAdmin;
  300. /**
  301. * \~chinese
  302. * 成员被移出管理员列表回调。
  303. *
  304. * @param aGroup 群组实例。
  305. * @param aAdmin 移出管理员列表的成员。
  306. *
  307. * \~english
  308. * Occurs when a groupmember is removed from the admin list.
  309. *
  310. * @param aGroup The group instance.
  311. * @param aAdmin The group member removed from the admin list.
  312. */
  313. - (void)groupAdminListDidUpdate:(EMGroup *_Nonnull)aGroup
  314. removedAdmin:(NSString *_Nonnull)aAdmin;
  315. /**
  316. * \~chinese
  317. * 群组所有者有更新回调。
  318. *
  319. * @param aGroup 群组实例。
  320. * @param aNewOwner 新群主。
  321. * @param aOldOwner 旧群主。
  322. *
  323. * \~english
  324. * Occurs when the group owner changes.
  325. *
  326. * @param aGroup The group instance.
  327. * @param aNewOwner The new owner.
  328. * @param aOldOwner The old owner.
  329. */
  330. - (void)groupOwnerDidUpdate:(EMGroup *_Nonnull)aGroup
  331. newOwner:(NSString *_Nonnull)aNewOwner
  332. oldOwner:(NSString *_Nonnull)aOldOwner;
  333. /**
  334. * \~chinese
  335. * 用户加入群组回调。
  336. *
  337. * @param aGroup 加入的群组。
  338. * @param aUsername 加入群组的用户名。
  339. *
  340. * \~english
  341. * Occurs when a user joins a group.
  342. *
  343. * @param aGroup The group instance.
  344. * @param aUsername The user that joins the group.
  345. */
  346. - (void)userDidJoinGroup:(EMGroup *_Nonnull)aGroup
  347. user:(NSString *_Nonnull)aUsername;
  348. /**
  349. * \~chinese
  350. * 用户离开群组回调。
  351. *
  352. * @param aGroup 离开的群组。
  353. * @param aUsername 离开群组的用户名。
  354. *
  355. * \~english
  356. * Occurs when a user leaves the group.
  357. *
  358. * @param aGroup The group instance.
  359. * @param aUsername The user that leaves the group.
  360. */
  361. - (void)userDidLeaveGroup:(EMGroup *_Nonnull)aGroup
  362. user:(NSString *_Nonnull)aUsername;
  363. /**
  364. * \~chinese
  365. * 群公告更新回调。
  366. *
  367. * @param aGroup 群组实例。
  368. * @param aAnnouncement 群公告。
  369. *
  370. * \~english
  371. * Occurs when the group announcement updates.
  372. *
  373. * @param aGroup The group instance.
  374. * @param aAnnouncement The group announcement.
  375. */
  376. - (void)groupAnnouncementDidUpdate:(EMGroup *_Nonnull)aGroup
  377. announcement:(NSString *_Nullable)aAnnouncement;
  378. /**
  379. * \~chinese
  380. * 上传群共享文件回调。
  381. *
  382. * @param aGroup 群组实例。
  383. * @param aSharedFile 共享文件。
  384. *
  385. * \~english
  386. * Occurs when the group shared file is uploaded.
  387. *
  388. * @param aGroup The group instance.
  389. * @param aSharedFile The shared file.
  390. */
  391. - (void)groupFileListDidUpdate:(EMGroup *_Nonnull)aGroup
  392. addedSharedFile:(EMGroupSharedFile *_Nonnull)aSharedFile;
  393. /**
  394. * \~chinese
  395. * 群共享文件被删除回调。
  396. *
  397. * @param aGroup 群组实例。
  398. * @param aFileId 共享文件 ID。
  399. *
  400. * \~english
  401. * Occurs when the shared file of the group is removed.
  402. *
  403. * @param aGroup The group instance.
  404. * @param aFileId The ID of the shared file.
  405. */
  406. - (void)groupFileListDidUpdate:(EMGroup *_Nonnull)aGroup
  407. removedSharedFile:(NSString *_Nonnull)aFileId;
  408. /**
  409. * \~chinese
  410. * 群组禁用状态发生变化回调。
  411. *
  412. * @param aGroup 群组实例。
  413. * @param aDisabled 是否禁用。
  414. *
  415. * \~english
  416. * Occurs when the disabled state of group changes.
  417. *
  418. * @param aGroup The group instance.
  419. * @param aDisabled Whether the group is disabled.
  420. */
  421. - (void)groupStateChanged:(EMGroup *)aGroup
  422. isDisabled:(BOOL)aDisabled;
  423. /**
  424. * \~chinese
  425. * 群详情已有改动,需调用获取群详情api(IEMGroupManager.h : getGroupSpecificationFromServerWithId)得到最新群信息
  426. *
  427. * @param aGroup 群组实例。
  428. *
  429. * \~english
  430. * Occurs when the group specification update,Need to call for details of the API (IEMGroupManager.h : getGroupSpecificationFromServerWithId) to get the latest information
  431. *
  432. * @param aGroup The group instance.
  433. */
  434. - (void)groupSpecificationDidUpdate:(EMGroup *)aGroup;
  435. /**
  436. * \~chinese
  437. * 群组成员自定义属性有变更。
  438. *
  439. * @param groupId 群组 ID。
  440. * @param userId 自定义属性变更的群成员的用户 ID。
  441. * @param attributes 修改后的自定义属性,key-value 格式。
  442. * @param operatorId 操作者的用户 ID。
  443. * \~english
  444. * Occurs when a custom attribute(s) of a group member is/are changed.
  445. *
  446. * @param groupId The group ID.
  447. * @param userId The user ID of the group member whose custom attributes are changed.
  448. * @param attributes The modified custom attributes, in key-value format.
  449. * @param operatorId The user ID of the operator.
  450. */
  451. - (void)onAttributesChangedOfGroupMember:(NSString *_Nonnull)groupId userId:(NSString *_Nonnull)userId attributes:(NSDictionary <NSString*,NSString*>*_Nullable)attributes operatorId:(NSString *_Nonnull)operatorId;
  452. #pragma mark - Deprecated methods
  453. /**
  454. * \~chinese
  455. * 收到群组邀请回调。
  456. *
  457. * 该回调是由远端用户发送群组邀请触发的。如,用户 A 邀请用户 B 入群,则用户 B 会收到该回调。
  458. *
  459. * 已废弃,请用 {@link groupInvitationDidReceive:groupName:inviter:message: } 代替。
  460. * @param aGroupId 群组 ID。
  461. * @param aInviter 发送群组邀请的用户。
  462. * @param aMessage 群组邀请的信息。
  463. *
  464. * \~english
  465. * Occurs when the user receives a group invitation.
  466. *
  467. * This callback is triggered by a peer user sending a group invitation. For example, after user A sends user B a group invitation, user B receives this callback.
  468. *
  469. * Deprecated. Please use {@link groupInvitationDidReceive:groupName:inviter:message: } instead.
  470. *
  471. * @param aGroupId The group ID.
  472. * @param aInviter The user sending the group invitation.
  473. * @param aMessage The invitation message.
  474. */
  475. - (void)groupInvitationDidReceive:(NSString *)aGroupId
  476. inviter:(NSString *)aInviter
  477. message:(NSString *)aMessage
  478. __deprecated_msg("Use -groupInvitationDidReceive:groupName:inviter:message: instead");
  479. @end