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