IEMPushManager.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. //
  2. // IEMPushManager.h
  3. // HyphenateSDK
  4. //
  5. // Created by 杜洁鹏 on 2020/10/26.
  6. // Copyright © 2020 easemob.com. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "EMCommonDefs.h"
  10. #import "EMPushOptions.h"
  11. #import "EMError.h"
  12. #import "EMCursorResult.h"
  13. #import "EMSilentModeResult.h"
  14. NS_ASSUME_NONNULL_BEGIN
  15. /**
  16. * \~chinese
  17. * @header IEMPushManager.h
  18. * @abstract 推送相关的管理协议类。
  19. * @author Hyphenate
  20. * @version 3.00
  21. *
  22. * \~english
  23. * @header IEMPushManager.h
  24. * @abstract The push related management protocol class.
  25. * @author Hyphenate
  26. * @version 3.00
  27. */
  28. @protocol IEMPushManager <NSObject>
  29. /**
  30. * \~chinese
  31. * 消息推送配置选项。
  32. *
  33. * \~english
  34. * The message push configuration options.
  35. *
  36. */
  37. @property (nonatomic, strong, readonly) EMPushOptions *_Nullable pushOptions;
  38. /**
  39. * \~chinese
  40. * 从内存中获取屏蔽了推送的用户 ID 列表。
  41. * 已废弃,使用getSilentModeForConversations:completion:精确批量获取代替。
  42. *
  43. * \~english
  44. * Gets the list of user ID which have blocked the push notification.
  45. * Deprecated. Please use -getSilentModeForConversations:completion: instead.
  46. */
  47. @property (nonatomic, strong, readonly) NSArray *noPushUIds
  48. EM_DEPRECATED_IOS(3_8_4, 3_9_1, "Use -getSilentModeForConversations:completion: instead");
  49. /**
  50. * \~chinese
  51. * 从内存中获取屏蔽了推送的群组 ID 列表。
  52. * 已废弃,使用getSilentModeForConversations:completion:精确获取批量会话推送设置。
  53. *
  54. *
  55. * \~english
  56. * Gets the list of groups which have blocked the push notification.
  57. * Deprecated. Please use -getSilentModeForConversations:completion: instead.
  58. */
  59. @property (nonatomic, strong, readonly) NSArray *noPushGroups
  60. EM_DEPRECATED_IOS(3_7_4, 3_9_1, "Use -getSilentModeForConversations:completion: instead");
  61. /**
  62. * \~chinese
  63. * 开启离线推送。
  64. * 已废弃,使用 -setSilentModeForAll:completion: 代替。
  65. *
  66. * 同步方法,会阻塞当前线程。
  67. *
  68. * @result 错误信息,详见 EMError。
  69. *
  70. * \~english
  71. * Turns on the push notification.
  72. * Deprecated. Please use -setSilentModeForAll:completion: instead.
  73. *
  74. * This is a synchronous method and blocks the current thread.
  75. *
  76. * @result The error information if the method fails: Error.
  77. */
  78. - (EMError *)enableOfflinePush
  79. EM_DEPRECATED_IOS(3_7_3, 3_9_1, "Use -setSilentModeForAll:completion: instead");
  80. /**
  81. * \~chinese
  82. * 关闭离线推送。
  83. * 已废弃,使用 -setSilentModeForAll:completion: 代替。
  84. *
  85. * 同步方法,会阻塞当前线程。
  86. *
  87. * @param aStartHour 开始时间。
  88. * @param aEndHour 结束时间。
  89. *
  90. * @result 错误信息,详见 EMError。
  91. *
  92. * \~english
  93. * Turns off the push notification.
  94. * Deprecated. Please use -setSilentModeForAll:completion: instead.
  95. *
  96. * This is a synchronous method and blocks the current thread.
  97. *
  98. * @param aStartHour The begin time.
  99. * @param aEndHour The end time.
  100. *
  101. * @result The error information if the method fails: Error.
  102. */
  103. - (EMError *)disableOfflinePushStart:(int)aStartHour end:(int)aEndHour
  104. EM_DEPRECATED_IOS(3_7_3, 3_9_1, "Use -setSilentModeForAll:completion: instead");
  105. /**
  106. * \~chinese
  107. * 设置群组是否接收推送。
  108. * 已废弃,使用 -setSilentModeForConversation:conversationType: params:completion:代替。
  109. *
  110. * 同步方法,会阻塞当前线程。
  111. *
  112. * @param aGroupIds 群组 ID。
  113. * @param disable 是否接收推送。
  114. *
  115. * @result 错误信息,详见 EMError。
  116. *
  117. * \~english
  118. * Sets wether to turn on or turn off the push notification.
  119. * Deprecated. Please use -setSilentModeForConversation:conversationType: params:completion: instead.
  120. *
  121. * This is a synchronous method and blocks the current thread.
  122. *
  123. * @param aGroupIds The group IDs.
  124. * @param disable Turn off.
  125. *
  126. * @result The error information if the method fails: Error.
  127. */
  128. - (EMError *)updatePushServiceForGroups:(NSArray *)aGroupIds
  129. disablePush:(BOOL)disable
  130. EM_DEPRECATED_IOS(3_7_4, 3_9_1, "Use -setSilentModeForConversation:conversationType:params:completion: instead");
  131. /**
  132. * \~chinese
  133. * 设置群组是否接收推送。
  134. * 已废弃,使用 -setSilentModeForConversation:conversationType: params:completion:代替。
  135. *
  136. * 异步方法。
  137. *
  138. * @param aGroupIds 群组 ID。
  139. * @param disable 是否接收推送。
  140. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  141. *
  142. * \~english
  143. * Sets the display style for the push notification.
  144. * Deprecated. Please use -setSilentModeForConversation:conversationType: params:completion: instead.
  145. *
  146. * This is an asynchronous method.
  147. *
  148. * @param aGroupIds The group IDs.
  149. * @param disable Turn off.
  150. * @param aCompletionBlock The completion block, which contains the error message if the method fails..
  151. */
  152. - (void)updatePushServiceForGroups:(NSArray *)aGroupIds
  153. disablePush:(BOOL)disable
  154. completion:(nonnull void (^)(EMError * aError))aCompletionBlock
  155. EM_DEPRECATED_IOS(3_7_4, 3_9_1, "Use -setSilentModeForConversation:conversationType: params:completion: instead");
  156. /**
  157. * \~chinese
  158. * 设置是否接收联系人消息推送。
  159. * 已废弃,使用 -setSilentModeForConversation:conversationType: params:completion:代替。
  160. *
  161. * 同步方法,会阻塞当前线程。
  162. *
  163. * @param aUIds 用户 ID。
  164. * @param disable 是否不接收推送。默认值是 NO,表示接收推送;设置 YES,表示不接收推送。
  165. *
  166. * @result 错误信息。
  167. *
  168. * \~english
  169. * Sets whether to receive push notification of the specific contacts.
  170. * Deprecated. Please use -setSilentModeForConversation:conversationType: params:completion: instead.
  171. *
  172. * This is a synchronous method and blocks the current thread.
  173. *
  174. * @param aUIds The user IDs of the contacts.
  175. * @param disable Whether to receive the push notification.// to do
  176. *
  177. * @result The error information if the method fails: Error.
  178. */
  179. - (EMError *)updatePushServiceForUsers:(NSArray *)aUIds
  180. disablePush:(BOOL)disable
  181. EM_DEPRECATED_IOS(3_8_4, 3_9_1, "Use -setSilentModeForConversation:conversationType: params:completion: instead");
  182. /**
  183. * \~chinese
  184. * 设置是否接收联系人消息推送。
  185. * 已废弃,使用 -setSilentModeForConversation:conversationType: params:completion:代替。
  186. *
  187. * 异步方法。
  188. *
  189. * @param aUIds 用户 ID。
  190. * @param disable 是否不接收推送。默认值是 NO,表示接收推送;设置 YES,表示不接收推送。
  191. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  192. *
  193. * \~english
  194. * Sets whether to receive the push notification of the contacts.
  195. * Deprecated. Please use -setSilentModeForConversation:conversationType: params:completion: instead.
  196. *
  197. * This is an asynchronous method.
  198. *
  199. * @param aUIds The user IDs of the contacts.
  200. * @param disable Whether to receive the push notification.
  201. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  202. */
  203. - (void)updatePushServiceForUsers:(NSArray *)aUIds
  204. disablePush:(BOOL)disable
  205. completion:(nonnull void (^)(EMError * aError))aCompletionBlock
  206. EM_DEPRECATED_IOS(3_8_4, 3_9_1, "Use -setSilentModeForConversation:conversationType: params:completion: instead");
  207. /**
  208. * \~chinese
  209. * 设置推送消息显示的样式。
  210. *
  211. * 同步方法,会阻塞当前线程。
  212. *
  213. * @param pushDisplayStyle 要设置的推送样式。
  214. *
  215. * @result 错误信息,详见 EMError。
  216. *
  217. * \~english
  218. * Sets the display style for the push notification.
  219. *
  220. * This is a synchronous method and blocks the current thread.
  221. *
  222. * @param pushDisplayStyle The display style of the push notification.
  223. *
  224. * @result The error information if the method fails: Error.
  225. */
  226. - (EMError *)updatePushDisplayStyle:(EMPushDisplayStyle)pushDisplayStyle;
  227. /**
  228. * \~chinese
  229. * 设置推送的显示名。
  230. *
  231. * 异步方法。
  232. *
  233. * @param pushDisplayStyle 推送显示样式。
  234. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  235. *
  236. * \~english
  237. * Sets the display style for the push notification.
  238. *
  239. * This is an asynchronous method.
  240. *
  241. * @param pushDisplayStyle The display style of the push notification.
  242. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  243. */
  244. - (void)updatePushDisplayStyle:(EMPushDisplayStyle)pushDisplayStyle
  245. completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
  246. /**
  247. * \~chinese
  248. * 设置推送消息显示的昵称。
  249. *
  250. * 同步方法,会阻塞当前线程。
  251. *
  252. * @param aNickname 要设置的昵称。
  253. *
  254. * @result 错误信息,详见 EMError。
  255. *
  256. * \~english
  257. * Sets the display name of the push notification.
  258. *
  259. * This is a synchronous method and blocks the current thread.
  260. *
  261. * @param aNickname The display name of the push notification.
  262. *
  263. * @result The error information if the method fails: Error.
  264. */
  265. - (EMError *_Nullable )updatePushDisplayName:(NSString * _Nonnull)aDisplayName;
  266. /**
  267. * \~chinese
  268. * 设置推送的显示的昵称。
  269. *
  270. * 异步方法。
  271. *
  272. * @param aDisplayName 推送显示的昵称。
  273. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  274. *
  275. * \~english
  276. * Sets the display name of the push notification.
  277. *
  278. * This is an asynchronous method.
  279. *
  280. * @param aDisplayName The display name of the push notification.
  281. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  282. *
  283. */
  284. - (void)updatePushDisplayName:(NSString * _Nonnull)aDisplayName
  285. completion:(void (^_Nullable)(NSString * _Nullable aDisplayName, EMError * _Nullable aError))aCompletionBlock;
  286. /**
  287. * \~chinese
  288. * 从服务器获取推送属性。
  289. *
  290. * 同步方法,会阻塞当前线程。
  291. *
  292. * @param pError 错误信息。
  293. *
  294. * @result 推送属性,详见 EMPushOptions。
  295. *
  296. * \~english
  297. * Gets the push options from the server.
  298. *
  299. * This is a synchronous method and blocks the current thread.
  300. *
  301. * @param pError The error information if the method fails: Error.
  302. *
  303. * @result The push options. See EMPushOptions.
  304. */
  305. - (EMPushOptions *_Nullable )getPushOptionsFromServerWithError:(EMError *_Nullable *_Nullable)pError;
  306. /**
  307. * \~chinese
  308. * 从服务器获取推送属性。
  309. *
  310. * 异步方法。
  311. *
  312. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  313. *
  314. * \~english
  315. * Gets the push options from the server.
  316. *
  317. * This is an asynchronous method.
  318. *
  319. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  320. */
  321. - (void)getPushNotificationOptionsFromServerWithCompletion:(void (^_Nullable )(EMPushOptions *_Nullable aOptions, EMError *_Nullable aError))aCompletionBlock;
  322. /**
  323. * \~chinese
  324. * 设置全局消息免打扰数据。
  325. *
  326. * @param aParam 免打扰数据参数模型,详见EMSilentModeParam。
  327. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  328. *
  329. * \~english
  330. * Set global silent mode message data.
  331. *
  332. * @param aParam Silent mode data parameter model ,See EMSilentModeParam.
  333. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  334. *
  335. */
  336. - (void)setSilentModeForAll:(EMSilentModeParam*_Nullable )aParam completion:(void (^_Nullable )(EMSilentModeResult *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  337. /**
  338. * \~chinese
  339. * 获取全局消息免打扰数据。
  340. *
  341. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  342. *
  343. * \~english
  344. * Get global silent mode message data.
  345. *
  346. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  347. */
  348. -(void)getSilentModeForAllWithCompletion:(void (^_Nullable )(EMSilentModeResult *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  349. /**
  350. * \~chinese
  351. * 设置会话消息免打扰数据。
  352. *
  353. * @param aConversationId 会话Id。
  354. * @param aConversationType 会话类型。
  355. * @param aParam 免打扰数据参数模型,详见EMSilentModeParam。
  356. * @param aCompletionBlock
  357. * 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  358. *
  359. * \~english
  360. * Set conversation silent mode message data.
  361. *
  362. * @param aConversationId The conversation Id.
  363. * @param aConversationType The conversation type.
  364. * @param aParam Silent mode data parameter model ,See EMSilentModeParam.
  365. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  366. *
  367. */
  368. - (void)setSilentModeForConversation:(NSString*_Nonnull)aConversationId
  369. conversationType:(EMConversationType)aConversationType
  370. params:(EMSilentModeParam*_Nullable )aParam
  371. completion:(void (^_Nullable )(EMSilentModeResult *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  372. /**
  373. * \~chinese
  374. * 获取会话消息免打扰数据。
  375. *
  376. * @param aConversationId 会话Id。
  377. * @param aConversationType 会话类型。
  378. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  379. *
  380. * \~english
  381. * Get conversation silent mode message data.
  382. *
  383. * @param aConversationId The conversation Id.
  384. * @param aConversationType The conversation type.
  385. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  386. *
  387. *
  388. */
  389. - (void)getSilentModeForConversation:(NSString*_Nonnull)aConversationId
  390. conversationType:(EMConversationType)aConversationType
  391. completion:(void (^_Nullable )(EMSilentModeResult *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  392. /**
  393. * \~chinese
  394. * 清除会话离线推送消息提醒类型设置。
  395. *
  396. * @param aConversationId 会话Id。
  397. * @param aConversationType 会话类型。
  398. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  399. *
  400. * \~english
  401. * Clear conversation remind type for push messages.
  402. *
  403. * @param aConversationId The conversation Id.
  404. * @param aConversationType The conversation type.
  405. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  406. *
  407. *
  408. */
  409. - (void)clearRemindTypeForConversation:(NSString*_Nonnull)aConversationId
  410. conversationType:(EMConversationType)aConversationType
  411. completion:(void (^_Nullable )(EMSilentModeResult *_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  412. /**
  413. * \~chinese
  414. * 获取多个会话免打扰数据设置。
  415. * 注意:一次最多20条数据。如果没设置过或者设置失效,则结果字典中不会返回该条数据
  416. *
  417. * @param aConversationArray 会话数组。
  418. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  419. *
  420. * \~english
  421. * Gets the silent mode data setting for multiple sessions.
  422. * Notice:A maximum of 20 pieces of data at a time.If it is not set or set to expire , it will not be returned in the result dictionary
  423. *
  424. * @param aConversationArray The conversations array。
  425. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  426. *
  427. */
  428. - (void)getSilentModeForConversations:(NSArray<EMConversation *>*_Nonnull)aConversationArray
  429. completion:(void (^_Nullable )(NSDictionary<NSString*,EMSilentModeResult*>*_Nullable aResult, EMError *_Nullable aError))aCompletionBlock;
  430. /**
  431. * \~chinese
  432. * 设置推送消息的翻译语言。
  433. *
  434. * @param aLaguangeCode 翻译语言代码。
  435. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  436. *
  437. * \~english
  438. * Set the translation language for push messages.
  439. *
  440. * @param aLaguangeCode Translation language code.
  441. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  442. *
  443. *
  444. */
  445. - (void)setPreferredNotificationLanguage:(NSString*_Nullable)aLaguangeCode
  446. completion:(void (^_Nullable )(EMError *_Nullable aError))aCompletionBlock;
  447. /**
  448. * \~chinese
  449. * 获取推送消息的翻译语言。
  450. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  451. *
  452. * \~english
  453. * Get the translation language for push messages.
  454. *
  455. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  456. *
  457. *
  458. */
  459. - (void)getPreferredNotificationLanguageCompletion:(void (^_Nullable )(NSString *_Nullable aLaguangeCode,EMError *_Nullable aError))aCompletionBlock;
  460. /**
  461. * \~chinese
  462. * 设置离线推送的推送模版。
  463. *
  464. * @param aPushTemplateName 推送模版名称。
  465. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  466. *
  467. * \~english
  468. * Set the push template for offline push.
  469. *
  470. * @param aPushTemplateName push template name.
  471. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  472. *
  473. *
  474. */
  475. - (void)setPushTemplate:(NSString* _Nullable)aPushTemplateName
  476. completion:(void (^ _Nullable)(EMError *_Nullable aError))aCompletionBlock;
  477. /**
  478. * \~chinese
  479. * 获取设置的离线推送模版。
  480. * @param aCompletionBlock 该方法完成调用的回调。如果该方法调用失败,会包含调用失败的原因。
  481. *
  482. * \~english
  483. * Gets the offline push template for Settings.
  484. *
  485. * @param aCompletionBlock The completion block, which contains the error message if the method fails.
  486. *
  487. *
  488. */
  489. - (void)getPushTemplate:(void (^ _Nullable)(NSString *_Nullable aPushTemplateName, EMError *_Nullable aError))aCompletionBlock;
  490. @end
  491. NS_ASSUME_NONNULL_END