EMGroup.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. /**
  2. * \~chinese
  3. * @header EMGroup.h
  4. * @abstract 群组模型类。
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMGroup.h
  10. * @abstract The group model.
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMCommonDefs.h"
  16. #import "EMGroupOptions.h"
  17. @class EMGroupSharedFile;
  18. /**
  19. * \~chinese
  20. * 群组权限类型。
  21. *
  22. * \~english
  23. * The group permission type.
  24. */
  25. typedef NS_ENUM(NSInteger, EMGroupPermissionType) {
  26. EMGroupPermissionTypeNone = -1, /** \~chinese 未知类型。 \~english The unknown type.*/
  27. EMGroupPermissionTypeMember = 0, /** \~chinese 普通成员。 \~english The group member.*/
  28. EMGroupPermissionTypeAdmin, /** \~chinese 群组管理员。 \~english The group admin.*/
  29. EMGroupPermissionTypeOwner, /** \~chinese 群主。 \~english The group owner.*/
  30. };
  31. /**
  32. * \~chinese
  33. * 群组。
  34. *
  35. * \~english
  36. * The group.
  37. */
  38. @interface EMGroup : NSObject
  39. /**
  40. * \~chinese
  41. * 群组 ID。
  42. *
  43. * \~english
  44. * The group ID.
  45. */
  46. @property (nonatomic, copy, readonly) NSString *groupId;
  47. /**
  48. * \~chinese
  49. * 群组的名称,需要先通过 `getGroupSpecificationFromServerWithId` 方法获取群详情。
  50. *
  51. * \~english
  52. * The subject of the group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` to get the group details first.
  53. */
  54. @property (nonatomic, copy, readonly) NSString *groupName;
  55. /**
  56. * \~chinese
  57. * 群组的描述,需要先通过 `getGroupSpecificationFromServerWithId` 获取群组详情。
  58. *
  59. * \~english
  60. * The description of the group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  61. */
  62. @property (nonatomic, copy, readonly) NSString *description;
  63. /**
  64. * \~chinese
  65. * 群组的公告,需要先通过 getGroupAnnouncementWithId 方法获取群公告。
  66. *
  67. * \~english
  68. * The announcement of the group. To get the value of this member, you need to call `getGroupAnnouncementWithId` first.
  69. */
  70. @property (nonatomic, copy, readonly) NSString *announcement;
  71. /**
  72. * \~chinese
  73. * 群组属性配置,需要先通过 getGroupSpecificationFromServerWithId 获取群组详情。
  74. *
  75. * \~english
  76. * The setting options of group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  77. */
  78. @property (nonatomic, strong, readonly) EMGroupOptions *settings;
  79. /**
  80. * \~chinese
  81. * 群组的所有者,拥有群的最高权限,需要先通过 `getGroupSpecificationFromServerWithId` 获取群组详情。
  82. *
  83. * 群组的所有者只有一人。
  84. *
  85. * \~english
  86. * The owner of the group who has the highest privilege of the group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  87. *
  88. * Each chat group has only one owner.
  89. */
  90. @property (nonatomic, copy, readonly) NSString *owner;
  91. /**
  92. * \~chinese
  93. * 群组的管理者,拥有群的管理权限,需要先通过 getGroupSpecificationFromServerWithId 获取群组详情。
  94. *
  95. *
  96. * \~english
  97. * The admins of the group who have the group management authority. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  98. *
  99. */
  100. @property (nonatomic, copy, readonly) NSArray<NSString *> *adminList;
  101. /**
  102. * \~chinese
  103. * 群组的成员列表,需要先通过 getGroupSpecificationFromServerWithId 获取群组详情。
  104. *
  105. * \~english
  106. * The member list of the group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  107. */
  108. @property (nonatomic, copy, readonly) NSArray<NSString *> *memberList;
  109. /**
  110. * \~chinese
  111. * 群组的黑名单,需要先调用 getGroupSpecificationFromServerWithId 方法获取群详情。
  112. *
  113. * 该方法只有群主才有权限调用。否则 SDK 返回空值 nil 。
  114. *
  115. * \~english
  116. * The blocklist of the chat group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  117. *
  118. * Only the group owner can call this method. Otherwise, the SDK returns nil.
  119. */
  120. @property (nonatomic, strong, readonly) NSArray<NSString *> *blacklist;
  121. /**
  122. * \~chinese
  123. * 群组的被禁言列表。
  124. *
  125. * 该方法只有管理员或者群主才有权限调用。否则 SDK 返回空值 nil 。
  126. *
  127. * \~english
  128. * The list of muted members.
  129. *
  130. * Only the group owner or admin can call this method. Otherwise, the SDK returns nil.
  131. */
  132. @property (nonatomic, strong, readonly) NSArray<NSString *> *muteList;
  133. /**
  134. * \~chinese
  135. * 聊天室的白名单列表。
  136. *
  137. * 该方法只有群主才能调用,否则 SDK 返回空值 nil。
  138. *
  139. * \~english
  140. * The allowlist of the chat group.
  141. *
  142. * Only the group owner can call this method. Otherwise, the SDK returns nil.
  143. */
  144. @property (nonatomic, strong, readonly) NSArray<NSString *> *whiteList;
  145. /**
  146. * \~chinese
  147. * 群共享文件列表。
  148. *
  149. * \~english
  150. * The list of group shared files.
  151. */
  152. @property (nonatomic, strong, readonly) NSArray<EMGroupSharedFile *> *sharedFileList;
  153. /**
  154. * \~chinese
  155. * 群组是否接收消息推送通知。
  156. *
  157. * \~english
  158. * Whether to enable the push notification service for the group.
  159. */
  160. @property (nonatomic, readonly) BOOL isPushNotificationEnabled;
  161. /**
  162. * \~chinese
  163. * 此群是否为公开群,需要先通过 `getGroupSpecificationFromServerWithId` 获取群组详情。
  164. *
  165. * \~english
  166. * Whether the group is a public group. To get the value of this member, you need to call `getGroupSpecificationFromServerWithId` first.
  167. */
  168. @property (nonatomic, readonly) BOOL isPublic;
  169. /**
  170. * \~chinese
  171. * 是否屏蔽群消息。
  172. *
  173. * \~english
  174. * Whether to block the current group‘s messages.
  175. */
  176. @property (nonatomic, readonly) BOOL isBlocked;
  177. /**
  178. * \~chinese
  179. * 当前登录账号的群成员类型。
  180. *
  181. * \~english
  182. * The group membership type of the current login account.
  183. */
  184. @property (nonatomic, readonly) EMGroupPermissionType permissionType;
  185. /**
  186. * \~chinese
  187. * 群组的所有成员(包含群主、管理员和普通成员)。
  188. *
  189. * \~english
  190. * All occupants of the group, including the group owner, admins, and all other group members.
  191. */
  192. @property (nonatomic, strong, readonly) NSArray<NSString *> *users;
  193. /**
  194. * \~chinese
  195. * 群组当前的成员数量,包括群主、群管理员和普通成员。该方法需要先通过 getGroupSpecificationFromServerWithId 获取群组详情。
  196. *
  197. * \~english
  198. * The total number of group occupants, including the owner, admins, and all other group members. To get the value of this member, you need to call getGroupSpecificationFromServerWithId first.
  199. */
  200. @property (nonatomic, readonly) NSInteger occupantsCount;
  201. /**
  202. * \~chinese
  203. * 群组成员是否全部被禁言。
  204. *
  205. * \~english
  206. * Whether all the group members are muted.
  207. */
  208. @property (nonatomic, readonly) BOOL isMuteAllMembers;
  209. /**
  210. * \~chinese
  211. * 群组是否禁用。(本地数据库不存储,从数据库读取或拉取漫游消息默认值是 NO)
  212. *
  213. * \~english
  214. * Whether the group is disabled. The default value for reading or pulling roaming messages from the database is NO
  215. */
  216. @property (nonatomic, readonly) BOOL isDisabled;
  217. /**
  218. * \~chinese
  219. * 获取群组实例,如果不存在则创建。
  220. *
  221. * @param aGroupId 群组 ID。
  222. *
  223. * @result 群组实例。
  224. *
  225. * \~english
  226. * Gets the group instance. Creates an instance if it does not exist.
  227. *
  228. * @param aGroupId The group ID.
  229. *
  230. * @result The group instance.
  231. */
  232. + (instancetype)groupWithId:(NSString *)aGroupId;
  233. #pragma mark - EM_DEPRECATED_IOS 3.8.8
  234. /**
  235. * \~chinese
  236. * 群组属性配置,需要先通过 getGroupSpecificationFromServerWithId 获取群组详情。
  237. *
  238. * 已废弃,请用 {@link settings} 代替。
  239. *
  240. * \~english
  241. * Setting options of group, require fetch group's detail first.
  242. *
  243. * Deprecated. Please use {@link settings} instead.
  244. */
  245. @property (nonatomic, strong, readonly) EMGroupOptions *setting __deprecated_msg("Use settings instead");
  246. /**
  247. * \~chinese
  248. * 群组的所有成员(包含owner、admins和members)。
  249. *
  250. * 已废弃,请用 {@link users} 代替。
  251. *
  252. * \~english
  253. * All occupants of the group, includes the group owner and admins and all other group members.
  254. *
  255. * Deprecated. Please use {@link users} instead.
  256. */
  257. @property (nonatomic, strong, readonly) NSArray *occupants
  258. __deprecated_msg("Use users instead");
  259. @end