NIMSDK-iOS
载入中...
搜索中...
未找到
NIMSystemNotificationManagerProtocol.h
浏览该文件的文档.
1//
2// NIMSystemNotificationManager.h
3// NIMLib
4//
5// Created by Netease.
6// Copyright (c) 2015 Netease. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10
11NS_ASSUME_NONNULL_BEGIN
12
13@class NIMSession;
17
18/**
19 * 系统通知block
20 *
21 * @param error 错误,如果成功则error为nil
22 */
23typedef void(^NIMSystemNotificationHandler)(NSError * __nullable error);
24
25/**
26 * 系统通知委托
27 */
28@protocol NIMSystemNotificationManagerDelegate <NSObject>
29@optional
30
31#pragma mark - 系统通知
32/**
33 * 收到系统通知回调
34 *
35 * @param notification 系统通知
36 */
37- (void)onReceiveSystemNotification:(NIMSystemNotification *)notification;
38
39
40/**
41 * 系统通知数量变化
42 *
43 * @param unreadCount 总系统通知未读数目
44 */
45- (void)onSystemNotificationCountChanged:(NSInteger)unreadCount;
46
47
48#pragma mark - 自定义系统通知
49
50/**
51 * 收到自定义通知回调
52 * @param notification 自定义通知
53* @discussion 这个通知是由开发者服务端/客户端发出,由我们的服务器进行透传的通知,SDK 不负责这个信息的存储,如果需要上层需要存储,需要在这个方法返回前进行存储
54 */
55- (void)onReceiveCustomSystemNotification:(NIMCustomSystemNotification *)notification;
56
57
58@end
59
60/**
61 * 系统通知协议
62 */
63@protocol NIMSystemNotificationManager <NSObject>
64/**
65 * 获取本地存储的系统通知
66 *
67 * @param notification 当前最早系统消息,没有则传入nil
68 * @param limit 最大获取数
69 *
70 * @return 系统消息列表
71 */
72- (nullable NSArray<NIMSystemNotification *> *)fetchSystemNotifications:(nullable NIMSystemNotification *)notification
73 limit:(NSInteger)limit;
74
75
76/**
77 * 获取本地存储的系统通知
78 *
79 * @param notification 当前最早系统消息,没有则传入nil
80 * @param limit 最大获取数
81 * @param filter 过滤器
82 *
83 * @return 系统消息列表
84 */
85- (nullable NSArray<NIMSystemNotification *> *)fetchSystemNotifications:(nullable NIMSystemNotification *)notification
86 limit:(NSInteger)limit
87 filter:(nullable NIMSystemNotificationFilter *)filter;
88
89/**
90 * 未读系统消息数
91 *
92 * @return 未读系统消息数
93 */
94- (NSInteger)allUnreadCount;
95
96/**
97 * 未读系统消息数
98 *
99 * @param filter 过滤器
100 *
101 * @return 未读系统消息数
102 */
103- (NSInteger)allUnreadCount:(nullable NIMSystemNotificationFilter *)filter;
104
105/**
106 * 删除单条系统消息
107 *
108 * @param notification 系统消息
109 */
110- (void)deleteNotification:(NIMSystemNotification *)notification;
111
112/**
113 * 删除所有系统消息
114 */
115- (void)deleteAllNotifications;
116
117
118/**
119 * 删除所有命中过滤器的系统消息
120 *
121 * @param filter 过滤器
122 */
123- (void)deleteAllNotifications:(nullable NIMSystemNotificationFilter *)filter;
124
125/**
126 * 标记单条系统消息为已读
127 *
128 * @param notification 系统消息
129 */
130- (void)markNotificationsAsRead:(NIMSystemNotification *)notification;
131
132/**
133 * 标记所有系统消息为已读
134 */
135- (void)markAllNotificationsAsRead;
136
137/**
138 * 标记所有命中过滤器的系统消息为已读
139 *
140 * @param filter 过滤器
141 */
142- (void)markAllNotificationsAsRead:(nullable NIMSystemNotificationFilter *)filter;
143
144
145/**
146 * 发送自定义系统通知
147 *
148 * @param notification 系统通知
149 * @param session 接收方
150 * @param completion 发送结果回调
151 * @discussion 仅支持个人和群。聊天室不支持
152 */
153- (void)sendCustomNotification:(NIMCustomSystemNotification *)notification
154 toSession:(NIMSession *)session
155 completion:(nullable NIMSystemNotificationHandler)completion;
156
157/**
158 * 添加系统消息通知委托
159 *
160 * @param delegate 系统通知回调
161 */
162- (void)addDelegate:(id<NIMSystemNotificationManagerDelegate>)delegate;
163
164/**
165 * 移除系统消息通知委托
166 *
167 * @param delegate 系统通知回调
168 */
169- (void)removeDelegate:(id<NIMSystemNotificationManagerDelegate>)delegate;
170@end
171
172NS_ASSUME_NONNULL_END
void(^ NIMSystemNotificationHandler)(NSError *__nullable error)
Definition: NIMSystemNotificationManagerProtocol.h:23
Definition: NIMSystemNotification.h:183
Definition: NIMSession.h:49
Definition: NIMSystemNotification.h:171
Definition: NIMSystemNotification.h:90