NIMSystemNotification.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. //
  2. // NIMSystemNotification.h
  3. // NIMLib
  4. //
  5. // Created by Netease.
  6. // Copyright (c) 2015 Netease. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "NIMSession.h"
  10. #import "NIMUser.h"
  11. #import "NIMCustomSystemNotificationSetting.h"
  12. #import "NIMAntiSpamOption.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. /**
  15. * 系统通知类型
  16. */
  17. typedef NS_ENUM(NSInteger, NIMSystemNotificationType){
  18. /**
  19. * 申请入群
  20. */
  21. NIMSystemNotificationTypeTeamApply = 0,
  22. /**
  23. * 拒绝入群
  24. */
  25. NIMSystemNotificationTypeTeamApplyReject = 1,
  26. /**
  27. * 邀请入群
  28. */
  29. NIMSystemNotificationTypeTeamInvite = 2,
  30. /**
  31. * 拒绝入群邀请
  32. */
  33. NIMSystemNotificationTypeTeamIviteReject = 3,
  34. /**
  35. * 添加好友
  36. */
  37. NIMSystemNotificationTypeFriendAdd = 5,
  38. /**
  39. * 申请入超大群
  40. */
  41. NIMSystemNotificationTypeSuperTeamApply = 15,
  42. /**
  43. * 拒绝入超大群
  44. */
  45. NIMSystemNotificationTypeSuperTeamApplyReject = 16,
  46. /**
  47. * 邀请入超大群
  48. */
  49. NIMSystemNotificationTypeSuperTeamInvite = 17,
  50. /**
  51. * 拒绝入超大群邀请
  52. */
  53. NIMSystemNotificationTypeSuperTeamIviteReject = 18,
  54. };
  55. #pragma mark - 系统通知
  56. /**
  57. * 系统通知
  58. */
  59. @interface NIMSystemNotification : NSObject
  60. /**
  61. * 通知 ID
  62. */
  63. @property (nonatomic,assign,readonly) int64_t notificationId;
  64. /**
  65. * 通知类型
  66. */
  67. @property (nonatomic,assign,readonly) NIMSystemNotificationType type;
  68. /**
  69. * 时间戳
  70. */
  71. @property (nonatomic,assign,readonly) NSTimeInterval timestamp;
  72. /**
  73. * 操作者
  74. */
  75. @property (nullable,nonatomic,copy,readonly) NSString *sourceID;
  76. /**
  77. * 目标ID,群ID或者是用户ID
  78. */
  79. @property (nullable,nonatomic,copy,readonly) NSString *targetID;
  80. /**
  81. * 附言
  82. */
  83. @property (nullable,nonatomic,copy,readonly) NSString *postscript;
  84. /**
  85. * 是否已读
  86. * @discussion 修改这个属性并不会修改 db 中的数据
  87. */
  88. @property (nonatomic,assign) BOOL read;
  89. /**
  90. * 消息处理状态
  91. * @discussion 修改这个属性,后台会自动更新 db 中对应的数据,SDK 调用者可以使用这个值来持久化他们对消息的处理结果,默认为 0
  92. */
  93. @property (nonatomic,assign) NSInteger handleStatus;
  94. /**
  95. * 系统通知下发的自定义扩展信息
  96. */
  97. @property (nullable,nonatomic,readonly) NSString *notifyExt;
  98. /**
  99. * 附件
  100. * @discussion 额外信息,只有 好友添加 这个通知有附件
  101. * 好友添加的 attachment 为 NIMUserAddAttachment
  102. */
  103. @property (nullable,nonatomic,strong,readonly) id attachment;
  104. @end
  105. /**
  106. * 添加好友附件
  107. */
  108. @interface NIMUserAddAttachment : NSObject
  109. /**
  110. * 好友操作类型
  111. */
  112. @property (nonatomic,assign,readonly) NIMUserOperation operationType;
  113. @end
  114. /**
  115. * 系统通知过滤器
  116. */
  117. @interface NIMSystemNotificationFilter : NSObject
  118. /**
  119. * 类型列表,取值范围为: NIMSystemNotificationType 枚举类型
  120. */
  121. @property (nonatomic,copy) NSArray<NSNumber *> *notificationTypes;
  122. @end
  123. #pragma mark - 自定义系统通知
  124. /**
  125. * 自定义系统通知
  126. */
  127. @interface NIMCustomSystemNotification : NSObject
  128. /**
  129. * 通知 ID
  130. * @discussion 只有收到的自定义系统通知才有通知 ID
  131. */
  132. @property (nonatomic,assign,readonly) int64_t notificationId;
  133. /**
  134. * 时间戳
  135. */
  136. @property (nonatomic,assign,readonly) NSTimeInterval timestamp;
  137. /**
  138. * 通知发起者id
  139. */
  140. @property (nullable,nonatomic,copy,readonly) NSString *sender;
  141. /**
  142. * 通知接受者id
  143. */
  144. @property (nullable,nonatomic,copy,readonly) NSString *receiver;
  145. /**
  146. * 通知接受者类型
  147. */
  148. @property (nonatomic,assign,readonly) NIMSessionType receiverType;
  149. /**
  150. * 透传的消息体内容
  151. */
  152. @property (nullable,nonatomic,copy,readonly) NSString *content;
  153. /**
  154. * 是否只发送给在线用户
  155. * @discussion 默认为YES 如果这个值为NO,通知接受者如果在通知投递时不在线,那么他会在下次登录时收到这个通知
  156. */
  157. @property (nonatomic,assign) BOOL sendToOnlineUsersOnly;
  158. /**
  159. * apns推送文案,长度限制500字
  160. * @discussion 默认为nil,用户可以设置当前通知的推送文案
  161. */
  162. @property (nullable,nonatomic,copy) NSString *apnsContent;
  163. /**
  164. * apns推送Payload
  165. * @discussion 可以通过这个字段定义自定义通知的推送Payload,支持字段参考苹果技术文档,最多支持2K
  166. */
  167. @property (nullable,nonatomic,copy) NSDictionary *apnsPayload;
  168. /**
  169. * 自定义系统通知设置
  170. * @discussion 可以通过这个字段制定当前通知的各种设置,如是否需要计入推送未读,是否需要带推送前缀等等
  171. */
  172. @property (nullable,nonatomic,strong) NIMCustomSystemNotificationSetting *setting;
  173. /**
  174. * 反垃圾选项
  175. */
  176. @property (nullable,nonatomic,strong) NIMAntiSpamOption *antiSpamOption;
  177. /**
  178. * 自定义系统通知初始化方法
  179. *
  180. * @param content 自定义系统通知内容
  181. *
  182. * @return 自定义系统通知实例
  183. */
  184. - (instancetype)initWithContent:(NSString *)content;
  185. @end
  186. NS_ASSUME_NONNULL_END