NIMSDKHeader.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. //
  2. // NIMSDKHeaders.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 NIMSDKOption;
  11. @class NIMServerSetting;
  12. /**
  13. * 压缩日志回调
  14. *
  15. * @param error 执行结果,如果成功 error 为 nil
  16. * @param path 压缩包的路径,只有当执行成功才有值,否则为 nil
  17. */
  18. typedef void(^NIMArchiveLogsHandler)(NSError *error, NSString *path);
  19. typedef void(^NIMUploadLogsHandler)(NSError *error, NSString *path);
  20. /**
  21. * NIMSDK
  22. */
  23. @interface NIMSDK : NSObject
  24. /**
  25. * 获取SDK实例
  26. *
  27. * @return NIMSDK实例
  28. */
  29. + (instancetype)sharedSDK;
  30. /**
  31. * 获取SDK版本号
  32. *
  33. * @return SDK版本号
  34. */
  35. - (NSString *)sdkVersion;
  36. /**
  37. * 初始化SDK
  38. *
  39. * @param appKey 申请的appKey
  40. * @param cerName 推送证书名
  41. * @discussion 如果需要更多注册选项,推荐使用 registerWithOption:
  42. */
  43. - (void)registerWithAppID:(NSString *)appKey
  44. cerName:(nullable NSString *)cerName;
  45. /**
  46. * 初始化SDK
  47. *
  48. * @param option 注册选项
  49. */
  50. - (void)registerWithOption:(NIMSDKOption *)option;
  51. /**
  52. * 获取AppKey
  53. *
  54. * @return 返回当前注册的AppKey
  55. */
  56. - (nullable NSString *)appKey;
  57. /**
  58. * 是否正在使用Demo AppKey
  59. *
  60. * @return 返回是否正在使用Demo AppKey
  61. */
  62. - (BOOL)isUsingDemoAppKey;
  63. /**
  64. * 更新APNS Token
  65. *
  66. * @param token APNS Token
  67. * @return 格式化后的APNS Token
  68. */
  69. - (NSString *)updateApnsToken:(NSData *)token;
  70. /**
  71. * 更新APNS Token
  72. *
  73. * @param token APNS Token
  74. * @param key 自定义本端推送内容, 设置key可对应业务服务器自定义推送文案; 传@"" 清空配置, nil 则不更改
  75. * @return 格式化后的APNS Token
  76. */
  77. - (NSString *)updateApnsToken:(NSData *)token
  78. customContentKey:(nullable NSString *)key;
  79. /**
  80. * 更新 PushKit Token
  81. *
  82. * @param token PushKit token
  83. * @discussion 目前仅支持 PKPushTypeVoIP
  84. */
  85. - (void)updatePushKitToken:(NSData *)token;
  86. /**
  87. * 获得SDK Log路径
  88. *
  89. * @return SDK当天log路径
  90. * @discussion 这个接口会返回当前最新的一个 log 文件路径,SDK 会每天生成一个 log 文件方便开发者定位和反馈问题
  91. */
  92. - (NSString *)currentLogFilepath;
  93. /**
  94. * 打包当前的日志集合
  95. *
  96. * @param completion 打包后的压缩包路径
  97. * @discussion 这个接口会压缩当前所有的日志为 Zip 文件,并输出 Zip 路径,上层可以根据这个文件进行上传反馈
  98. */
  99. - (void)archiveLogs:(NIMArchiveLogsHandler)completion;
  100. /**
  101. * 打包并上传当前的日志集合
  102. *
  103. * @param completion 打包后的压缩包路径
  104. *
  105. * @discussion 这个接口会压缩当前所有的日志为 Zip 文件,并输出 Zip 路径,上层可以根据这个文件进行上传反馈
  106. */
  107. - (void)uploadLogs:(NIMUploadLogsHandler _Nullable)completion;
  108. /**
  109. * 打包并上传当前的日志集合
  110. *
  111. * @param attach 附言,可为空
  112. * @param roomId 聊天室ID,可为空
  113. * @param completion 打包后的压缩包路径
  114. *
  115. * @discussion 这个接口会压缩当前所有的日志为 Zip 文件,并输出 Zip 路径,上层可以根据这个文件进行上传反馈
  116. */
  117. - (void)uploadLogsWithAttach:(nullable NSString *)attach
  118. roomId:(nullable NSString *)roomId
  119. completion:(NIMUploadLogsHandler _Nullable)completion;
  120. /**
  121. * 开启控制台Log
  122. */
  123. - (void)enableConsoleLog;
  124. /**
  125. * 当前服务器配置
  126. * @discussion 私有化需要进行自定义设置,必须在注册 appkey 完成之前设置
  127. */
  128. @property (nonatomic,strong) NIMServerSetting *serverSetting;
  129. /**
  130. * 资源场景配置
  131. * @discussion nos 预设场景和自定义场景规则
  132. * 可以覆盖设置,如果预设场景不设置,为系统默认设置
  133. * sceneDict key-value,系统默认预设场景为3种,自定义场景不超过10种
  134. * key 是场景,nsstring类型;value 是资源存活时间,nsnumber类型,精确到天,0为永久存活
  135. * 例如:@{@"nim_icon":@0,@"nim_msg":@0,@"nim_system":@0,@"nim_custom":@30}
  136. */
  137. @property (nonatomic,strong) NSMutableDictionary *sceneDict;
  138. /**
  139. * 登录管理类 负责登录,注销和相关操作的通知收发
  140. */
  141. @property (nonatomic,strong,readonly) id<NIMLoginManager> loginManager;
  142. /**
  143. * 聊天管理类,负责消息的收发
  144. */
  145. @property (nonatomic,strong,readonly) id<NIMChatManager> chatManager;
  146. /**
  147. * 会话管理类,负责消息,最近会话的读写和管理
  148. */
  149. @property (nonatomic,strong,readonly) id<NIMConversationManager> conversationManager;
  150. /**
  151. * 媒体管理类,负责多媒体相关的接口 (录音等)
  152. */
  153. @property (nonatomic,strong,readonly) id<NIMMediaManager> mediaManager;
  154. /**
  155. * 群组管理类,负责群组的操作:创建,拉人,踢人,同步等
  156. */
  157. @property (nonatomic,strong,readonly) id<NIMTeamManager> teamManager;
  158. /**
  159. * 超大群,负责超大群的相关操作
  160. */
  161. @property (nonatomic,strong,readonly) id<NIMSuperTeamManager> superTeamManager;
  162. /**
  163. * 好友管理类
  164. */
  165. @property (nonatomic,strong,readonly) id<NIMUserManager> userManager;
  166. /**
  167. * 系统通知管理类
  168. */
  169. @property (nonatomic,strong,readonly) id<NIMSystemNotificationManager> systemNotificationManager;
  170. /**
  171. * APNS推送管理类
  172. */
  173. @property (nonatomic,strong,readonly) id<NIMApnsManager> apnsManager;
  174. /**
  175. * 资源管理器,负责文件上传和下载
  176. */
  177. @property (nonatomic,strong,readonly) id<NIMResourceManager> resourceManager;
  178. /**
  179. * 聊天室管理类
  180. */
  181. @property (nonatomic,strong,readonly) id<NIMChatroomManager> chatroomManager;
  182. /**
  183. * 文档转码管理类
  184. */
  185. @property (nonatomic,strong,readonly) id<NIMDocTranscodingManager> docTranscodingManager;
  186. /**
  187. * 事件订阅管理类
  188. */
  189. @property (nonatomic,strong,readonly) id<NIMEventSubscribeManager> subscribeManager;
  190. /**
  191. * 智能机器人管理类
  192. */
  193. @property (nonatomic,strong,readonly) id<NIMRobotManager> robotManager;
  194. /**
  195. * 红包管理类
  196. */
  197. @property (nonatomic,strong,readonly) id<NIMRedPacketManager> redPacketManager;
  198. /**
  199. * 广播消息管理类
  200. */
  201. @property (nonatomic,strong,readonly) id<NIMBroadcastManager> broadcastManager;
  202. /**
  203. * 反垃圾管理类
  204. */
  205. @property (nonatomic,strong,readonly) id<NIMAntispamManager> antispamManager;
  206. /**
  207. * 通用音视频信令管理类
  208. */
  209. @property (nonatomic,strong,readonly) id<NIMSignalManager> signalManager;
  210. /**
  211. * 透传代理管理类
  212. */
  213. @property (nonatomic,strong,readonly) id<NIMPassThroughManager> passThroughManager;
  214. /**
  215. * Thread Talk管理类
  216. */
  217. @property (nonatomic,strong,readonly) id<NIMChatExtendManager> chatExtendManager;
  218. @end
  219. NS_ASSUME_NONNULL_END