NIMSDK-iOS
载入中...
搜索中...
未找到
NIMSystemNotification.h
浏览该文件的文档.
1//
2// NIMSystemNotification.h
3// NIMLib
4//
5// Created by Netease.
6// Copyright (c) 2015 Netease. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10#import "NIMSession.h"
11#import "NIMUser.h"
13#import "NIMAntiSpamOption.h"
14
15NS_ASSUME_NONNULL_BEGIN
16
17/**
18 * 系统通知类型
19 */
20typedef NS_ENUM(NSInteger, NIMSystemNotificationType){
21 /**
22 * 申请入群
23 */
25 /**
26 * 拒绝入群
27 */
29 /**
30 * 邀请入群
31 */
33 /**
34 * 拒绝入群邀请
35 */
37
38 /**
39 * 添加好友
40 */
42 /**
43 * 删除好友
44 */
46 /**
47 * p2p消息撤回通知
48 */
50 /**
51 * team消息撤回
52 */
54 /**
55 * superteam消息撤回
56 */
58 /**
59 * p2p消息单向删除,发送方无感知,接收方消息会被清掉
60 */
62 /**
63 * team消息单向删除,发送方无感知,接收方消息会被清掉
64 */
66 /**
67 * 申请入超大群
68 */
70 /**
71 * 拒绝入超大群
72 */
74 /**
75 * 邀请入超大群
76 */
78 /**
79 * 拒绝入超大群邀请
80 */
82
83};
84
85#pragma mark - 系统通知
86/**
87 * 系统通知
88 */
89@interface NIMSystemNotification : NSObject
90
91/**
92 * 通知 ID
93 */
94@property (nonatomic,assign,readonly) int64_t notificationId;
95
96/**
97 * 通知类型
98 */
99@property (nonatomic,assign,readonly) NIMSystemNotificationType type;
100
101/**
102 * 时间戳
103 */
104@property (nonatomic,assign,readonly) NSTimeInterval timestamp;
105
106/**
107 * 操作者
108 */
109@property (nullable,nonatomic,copy,readonly) NSString *sourceID;
110
111/**
112 * 目标ID,群ID或者是用户ID
113 */
114@property (nullable,nonatomic,copy,readonly) NSString *targetID;
115
116/**
117 * 附言
118 */
119@property (nullable,nonatomic,copy,readonly) NSString *postscript;
120
121/**
122 * 是否已读
123 * @discussion 修改这个属性并不会修改 db 中的数据
124 */
125@property (nonatomic,assign) BOOL read;
126
127/**
128 * 消息处理状态
129 * @discussion 修改这个属性,后台会自动更新 db 中对应的数据,SDK 调用者可以使用这个值来持久化他们对消息的处理结果,默认为 0
130 */
131@property (nonatomic,assign) NSInteger handleStatus;
132
133
134/**
135 * 系统通知下发的自定义扩展信息
136 */
137@property (nullable,nonatomic,readonly) NSString *notifyExt;
138
139/**
140 * 附件
141 * @discussion 额外信息,只有 好友添加 这个通知有附件
142 * 好友添加的 attachment 为 NIMUserAddAttachment
143 */
144@property (nullable,nonatomic,strong,readonly) id attachment;
145
146@end
147
148
149/**
150 * 添加好友附件
151 */
152@interface NIMUserAddAttachment : NSObject
153
154/**
155 * 好友操作类型
156 */
157@property (nonatomic,assign,readonly) NIMUserOperation operationType;
158
159/**
160 * 服务器扩展字段
161 */
162@property (nullable,nonatomic,copy,readonly) NSString *serverExt;
163
164@end
165
166
167/**
168 * 系统通知过滤器
169 */
170@interface NIMSystemNotificationFilter : NSObject
171/**
172 * 类型列表,取值范围为: NIMSystemNotificationType 枚举类型
173 */
174@property (nonatomic,copy) NSArray<NSNumber *> *notificationTypes;
175@end
176
177
178#pragma mark - 自定义系统通知
179/**
180 * 自定义系统通知
181 */
182@interface NIMCustomSystemNotification : NSObject
183
184/**
185 * 通知 ID
186 * @discussion 只有收到的自定义系统通知才有通知 ID
187 */
188@property (nonatomic,assign,readonly) int64_t notificationId;
189
190/**
191 * 时间戳
192 */
193@property (nonatomic,assign,readonly) NSTimeInterval timestamp;
194
195/**
196 * 通知发起者id
197 */
198@property (nullable,nonatomic,copy,readonly) NSString *sender;
199
200/**
201 * 通知接受者id
202 */
203@property (nullable,nonatomic,copy,readonly) NSString *receiver;
204
205
206/**
207 * 通知接受者类型
208 */
209@property (nonatomic,assign,readonly) NIMSessionType receiverType;
210
211/**
212 * 透传的消息体内容
213 */
214@property (nullable,nonatomic,copy,readonly) NSString *content;
215
216/**
217 * 是否只发送给在线用户
218 * @discussion 默认为YES 如果这个值为NO,通知接受者如果在通知投递时不在线,那么他会在下次登录时收到这个通知
219 */
220@property (nonatomic,assign) BOOL sendToOnlineUsersOnly;
221
222/**
223 * apns推送文案,长度限制500字
224 * @discussion 默认为nil,用户可以设置当前通知的推送文案
225 */
226@property (nullable,nonatomic,copy) NSString *apnsContent;
227
228
229/**
230 * apns推送Payload
231 * @discussion 可以通过这个字段定义自定义通知的推送Payload,支持字段参考苹果技术文档,最多支持2K
232 */
233@property (nullable,nonatomic,copy) NSDictionary *apnsPayload;
234
235/**
236 * 自定义系统通知设置
237 * @discussion 可以通过这个字段制定当前通知的各种设置,如是否需要计入推送未读,是否需要带推送前缀等等
238 */
239@property (nullable,nonatomic,strong) NIMCustomSystemNotificationSetting *setting;
240
241
242/**
243 * 反垃圾选项
244 */
245@property (nullable,nonatomic,strong) NIMAntiSpamOption *antiSpamOption;
246
247/**
248* 环境变量,用于指向不同的抄送、第三方回调等配置
249*/
250@property (nullable,nonatomic,copy) NSString *env;
251
252/**
253 * 自定义系统通知初始化方法
254 *
255 * @param content 自定义系统通知内容
256 *
257 * @return 自定义系统通知实例
258 */
259- (instancetype)initWithContent:(NSString *)content;
260
261@end
262
263NS_ASSUME_NONNULL_END
NIMSessionType
Definition: NIMSession.h:17
NIMSystemNotificationType
Definition: NIMSystemNotification.h:20
@ NIMSystemNotificationTypeSuperTeamIviteReject
Definition: NIMSystemNotification.h:81
@ NIMSystemNotificationTypeRevokeTeamMsg
Definition: NIMSystemNotification.h:53
@ NIMSystemNotificationTypeTeamApplyReject
Definition: NIMSystemNotification.h:28
@ NIMSystemNotificationTypeDeleteP2PMsg
Definition: NIMSystemNotification.h:61
@ NIMSystemNotificationTypeRevokeSuperTeamMsg
Definition: NIMSystemNotification.h:57
@ NIMSystemNotificationTypeDeleteTeamMsg
Definition: NIMSystemNotification.h:65
@ NIMSystemNotificationTypeTeamInvite
Definition: NIMSystemNotification.h:32
@ NIMSystemNotificationTypeRevokeP2PMsg
Definition: NIMSystemNotification.h:49
@ NIMSystemNotificationTypeFriendAdd
Definition: NIMSystemNotification.h:41
@ NIMSystemNotificationTypeSuperTeamInvite
Definition: NIMSystemNotification.h:77
@ NIMSystemNotificationTypeSuperTeamApply
Definition: NIMSystemNotification.h:69
@ NIMSystemNotificationTypeSuperTeamApplyReject
Definition: NIMSystemNotification.h:73
@ NIMSystemNotificationTypeTeamApply
Definition: NIMSystemNotification.h:24
@ NIMSystemNotificationTypeTeamIviteReject
Definition: NIMSystemNotification.h:36
@ NIMSystemNotificationTypeDeleteFriend
Definition: NIMSystemNotification.h:45
NIMUserOperation
Definition: NIMUser.h:18
Definition: NIMAntiSpamOption.h:18
Definition: NIMSystemNotification.h:183
Definition: NIMCustomSystemNotificationSetting.h:16
Definition: NIMSystemNotification.h:171
Definition: NIMSystemNotification.h:90
NSInteger handleStatus
Definition: NIMSystemNotification.h:131
BOOL read
Definition: NIMSystemNotification.h:125
NSString * targetID
Definition: NIMSystemNotification.h:114
NSString * postscript
Definition: NIMSystemNotification.h:119
id attachment
Definition: NIMSystemNotification.h:144
NSString * sourceID
Definition: NIMSystemNotification.h:109
NSString * notifyExt
Definition: NIMSystemNotification.h:137
int64_t notificationId
Definition: NIMSystemNotification.h:94
NSTimeInterval timestamp
Definition: NIMSystemNotification.h:104
NIMSystemNotificationType type
Definition: NIMSystemNotification.h:99
Definition: NIMSystemNotification.h:153