NIMApnsManagerProtocol.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // NIMApnsManager.h
  3. // NIMLib
  4. //
  5. // Created by Netease.
  6. // Copyright (c) 2015 Netease. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @class NIMPushNotificationSetting;
  11. @class NIMPushNotificationMultiportConfig;
  12. /**
  13. * 更新推送回调
  14. *
  15. * @param error 错误信息,成功则error为nil
  16. */
  17. typedef void(^NIMApnsHandler)(NSError * __nullable error);
  18. /**
  19. * 获取 badge 回调
  20. *
  21. * @return badge 数量
  22. */
  23. typedef NSUInteger(^NIMBadgeHandler)(void);
  24. /**
  25. * 推送委托
  26. */
  27. @protocol NIMApnsManagerDelegate <NSObject>
  28. /**
  29. * 其他端修改推送配置
  30. */
  31. - (void)onOtherClientChangedPushNotificationMultiportConfig;
  32. @end
  33. /**
  34. * 推送协议
  35. */
  36. @protocol NIMApnsManager <NSObject>
  37. /**
  38. * 获取当前的推送免打扰设置
  39. *
  40. * @return 推送设置
  41. */
  42. - (nullable NIMPushNotificationSetting *)currentSetting;
  43. /**
  44. * 更新推送免打扰设置
  45. *
  46. * @param setting 推送设置
  47. * @param completion 完成的回调
  48. */
  49. - (void)updateApnsSetting:(NIMPushNotificationSetting *)setting
  50. completion:(nullable NIMApnsHandler)completion;
  51. /**
  52. * 获取当前推送自定义配置信息
  53. *
  54. * @return 推送自定义配置
  55. */
  56. - (nullable NIMPushNotificationMultiportConfig *)currentMultiportConfig;
  57. /**
  58. * 更推送自定义配置信息
  59. *
  60. * @param config 推送自定义配置
  61. * @param completion 完成的回调
  62. */
  63. - (void)updateApnsMultiportConfig:(NIMPushNotificationMultiportConfig *)config
  64. completion:(nullable NIMApnsHandler)completion;
  65. /**
  66. * 注册获取 badge 数量的回调函数
  67. *
  68. * @param handler 获取 badge 回调
  69. * @discussion 默认场景下,云信会将所有未读数量统一汇报给服务器,包括需要提醒和不需要提醒的会话未读数,上层可以通过注册该接口进行调整
  70. */
  71. - (void)registerBadgeCountHandler:(NIMBadgeHandler)handler;
  72. /**
  73. * 添加委托
  74. *
  75. * @param delegate 委托
  76. */
  77. - (void)addDelegate:(id<NIMApnsManagerDelegate>)delegate;
  78. /**
  79. * 移除委托
  80. *
  81. * @param delegate 委托
  82. */
  83. - (void)removeDelegate:(id<NIMApnsManagerDelegate>)delegate;
  84. @end
  85. NS_ASSUME_NONNULL_END