EMOptions.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. /**
  2. * \~chinese
  3. * @header EMOptions.h
  4. * @abstract SDK的设置选项
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMOptions.h
  10. * @abstract SDK setting options
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMCommonDefs.h"
  16. /**
  17. * \~chinese
  18. * 日志输出级别。
  19. *
  20. * \~english
  21. * Log output level types.
  22. */
  23. typedef NS_ENUM(NSInteger, EMLogLevel)
  24. {
  25. EMLogLevelDebug = 0, /** \~chinese 输出所有日志。 \~english Output all logs. */
  26. EMLogLevelWarning, /** \~chinese 输出警告及错误。 \~english Output warnings and errors. */
  27. EMLogLevelError /** \~chinese 只输出错误。 \~english Output errors only. */
  28. } ;
  29. typedef NS_ENUM(NSInteger, AreaCode)
  30. {
  31. AreaCodeCN = 1 << 0,
  32. AreaCodeNA = 1 << 1,
  33. AreaCodeEU = 1 << 2,
  34. AreaCodeAS = 1 << 3,
  35. AreaCodeJP = 1 << 4,
  36. AreaCodeIN = 1 << 5,
  37. AreaCodeGLOB = -1
  38. };
  39. /**
  40. * \~chinese
  41. * SDK 的设置选项。
  42. *
  43. * \~english
  44. * The SDK setting options.
  45. */
  46. @interface EMOptions : NSObject
  47. /**
  48. * \~chinese
  49. * app key,是项目的唯一标识。
  50. *
  51. * \~english
  52. * The app key, which is the unique identifier of the project.
  53. */
  54. @property(nonatomic, copy, readonly) NSString *appkey;
  55. /**
  56. * \~chinese
  57. * 控制台是否输出日志。默认值为 `NO`。
  58. *
  59. * \~english
  60. * Whether to print logs on Console. The default value is `NO`.
  61. */
  62. @property(nonatomic, assign) BOOL enableConsoleLog;
  63. /**
  64. * \~chinese
  65. * 默认值为 `EMLogLevelDebug`,表示所有等级的日志。
  66. *
  67. * \~english
  68. * The log output level. The default value is EMLogLevelDebug, which means all log levels.
  69. */
  70. @property(nonatomic, assign) EMLogLevel logLevel;
  71. /**
  72. * \~chinese
  73. * 是否只使用 HTTPS 协议。默认值为 `NO`。
  74. *
  75. * \~english
  76. * Whether to only use the HTTPS protocol. The default value is `NO`.
  77. */
  78. @property(nonatomic, assign) BOOL usingHttpsOnly;
  79. /**
  80. * \~chinese
  81. * 是否自动登录,默认为 `YES`。
  82. *
  83. * 该参数需要在 SDK 初始化前设置,否则不生效。
  84. *
  85. * \~english
  86. * Whether to enable automatic login. The default value is `YES`.
  87. *
  88. * You need to set this parameter before the SDK is initialized.
  89. */
  90. @property(nonatomic, assign) BOOL isAutoLogin;
  91. /**
  92. * \~chinese
  93. * 离开群组时是否删除该群所有消息,默认为 `YES`。
  94. *
  95. * \~english
  96. * Whether to delete all the group messages when leaving the group. The default value is YES.
  97. */
  98. @property(nonatomic, assign) BOOL deleteMessagesOnLeaveGroup;
  99. /**
  100. * \~chinese
  101. * 离开聊天室时是否删除所有消息,默认为 `YES`。
  102. *
  103. * \~english
  104. * Whether to delete all the chat room messages when leaving the chat room. The default value is YES.
  105. */
  106. @property(nonatomic, assign) BOOL deleteMessagesOnLeaveChatroom;
  107. /**
  108. * \~chinese
  109. * 是否允许聊天室所有者离开,默认为 `YES`。
  110. *
  111. * \~english
  112. * Whether to allow the chatroom owner leave the room. The default value is YES.
  113. */
  114. @property(nonatomic, assign) BOOL canChatroomOwnerLeave;
  115. /**
  116. * \~chinese
  117. * 是否自动接受群邀请。默认值为 `YES`。
  118. *
  119. * \~english
  120. * Whether to automatically accept group invitation. The default value is `YES`.
  121. */
  122. @property(nonatomic, assign) BOOL autoAcceptGroupInvitation;
  123. /**
  124. * \~chinese
  125. * 是否自动同意好友邀请。默认值为 `NO`。
  126. *
  127. * \~english
  128. * Whether to automatically approve contact request. The default value is `NO`.
  129. */
  130. @property(nonatomic, assign) BOOL autoAcceptFriendInvitation;
  131. /**
  132. * \~chinese
  133. * 是否自动下载图片和视频缩略图及语音消息,默认为 `YES`。
  134. *
  135. * \~english
  136. * Whether to automatically download image or video thumbnails and voice messages. The default value is `YES`.
  137. */
  138. @property(nonatomic, assign) BOOL autoDownloadThumbnail;
  139. /**
  140. * \~chinese
  141. * 是否需要接收信息接收方已读回执。默认值为 `YES`。
  142. *
  143. * \~english
  144. * Whether need to receive the message read receipt. The default value is `YES`.
  145. */
  146. @property(nonatomic, assign) BOOL enableRequireReadAck;
  147. /**
  148. * \~chinese
  149. * 是否发送消息送达回执,默认为 `NO`,如果设置为 `YES`,SDK 收到单聊消息时会自动发送送达回执。
  150. *
  151. * \~english
  152. * Whether to send the message delivery receipt. The default value is `NO`. If you set it to `YES`, the SDK automatically send a delivery receipt when you receive a chat message.
  153. */
  154. @property(nonatomic, assign) BOOL enableDeliveryAck;
  155. /**
  156. * \~chinese
  157. * 从数据库加载消息时是否按服务器时间排序,默认值为 `YES`,表示按按服务器时间排序。
  158. *
  159. * \~english
  160. * Whether to sort messages by server received time when loading message from database. The default value is `YES`.
  161. */
  162. @property(nonatomic, assign) BOOL sortMessageByServerTime;
  163. /**
  164. * \~chinese
  165. * 是否自动上传或者下载消息中的附件,默认值为 `YES`。
  166. *
  167. * \~english
  168. * Whether to automatically upload or download the attachment in the message. The default value is `YES`.
  169. */
  170. @property(nonatomic, assign) BOOL isAutoTransferMessageAttachments;
  171. /**
  172. * \~chinese
  173. * 是否打开FPA加速功能,默认关闭
  174. *
  175. * \~english
  176. * Whether to enable fpa feature. The default value is `NO`.
  177. */
  178. @property(nonatomic, assign) BOOL enableFpa;
  179. /**
  180. * \~chinese
  181. * iOS 特有属性,推送证书的名称。
  182. *
  183. * 消息推送的证书名称。该参数只能在调用 `initializeSDKWithOptions` 时设置,且 app 运行过程中不可以修改。
  184. *
  185. * \~english
  186. * The certificate name of Apple Push Notification Service.
  187. *
  188. * Ensure that you set this parameter when calling `initializeSDKWithOptions`. During the app runtime, you can not change the settings.
  189. */
  190. @property(nonatomic, copy) NSString *apnsCertName;
  191. /**
  192. * \~chinese
  193. * iOS 特有属性,PushKit 的证书名称。
  194. *
  195. * 该参数只能在调用 `initializeSDKWithOptions` 时设置,且 app 运行过程中不可以修改。
  196. *
  197. * \~english
  198. * The certificate name of Apple PushKit Service.
  199. *
  200. * Ensure that you set this parameter when calling `initializeSDKWithOptions`. During the app runtime, you can not change the settings.
  201. */
  202. @property(nonatomic, copy) NSString *pushKitCertName;
  203. /**
  204. * \~chinese
  205. * 区域代号。
  206. *
  207. * 该属性用于限制连接边缘节点的范围,默认为 AreaCodeGLOB。
  208. *
  209. * 该参数只能在调用 `initializeSDKWithOptions` 时设置,且 app 运行过程中不能修改。
  210. *
  211. * \~english
  212. * The area code.
  213. * This attribute is used to restrict the scope of accessible edge nodes. The default value is `AreaCodeGLOB`.
  214. *
  215. * This attribute can be set only when you call `initializeSDKWithOptions`. The attribute setting cannot be changed during the app runtime.
  216. */
  217. @property(nonatomic) AreaCode area;
  218. /**
  219. * \~chinese
  220. * 是否开启消息流量统计,默认不开启。
  221. *
  222. * 该参数只能在调用 `initializeSDKWithOptions` 时设置,且 app 运行过程中不能修改。
  223. *
  224. * \~english
  225. * Whether to enable message statistics. The default value is `NO`.
  226. *
  227. * This attribute can be set only when you call `initializeSDKWithOptions`. The attribute setting cannot be changed during the app runtime.
  228. */
  229. @property(nonatomic) BOOL enableStatistics;
  230. /**
  231. * \~chinese
  232. * 从本地数据库加载会话时是否包括空会话。
  233. *
  234. * - YES:包含。
  235. * - (默认)NO:不包含。
  236. *
  237. * 该属性只能在调用 `initializeSDKWithOptions` 时设置,而且 app 运行过程中不能修改该参数的设置。
  238. *
  239. * \~english
  240. * Whether to include empty conversations when the SDK loads conversations from the local database:
  241. * - YES: Empty conversations are included.
  242. * - (Default) NO: Empty conversations are excluded.
  243. *
  244. * This attribute can be set only when you call the `initializeSDKWithOptions` method. The attribute setting cannot be changed during the app runtime.
  245. */
  246. @property(nonatomic) BOOL loadEmptyConversations;
  247. /**
  248. * \~chinese
  249. * 获取实例。
  250. *
  251. * @param aAppkey app key。
  252. *
  253. * @result SDK 设置项实例。
  254. *
  255. * \~english
  256. * Gets a SDK setting options instance.
  257. *
  258. * @param aAppkey The app key.
  259. *
  260. * @result The SDK setting options instance.
  261. */
  262. + (instancetype _Nonnull)optionsWithAppkey:(NSString * _Nonnull)aAppkey;
  263. #pragma mark - EM_DEPRECATED_IOS 3.8.8
  264. /**
  265. * \~chinese
  266. * 离开群组时是否删除该群所有消息, 默认为 YES。
  267. *
  268. * \~english
  269. * Whether to delete all the group messages when leaving the group. The default value is YES.
  270. */
  271. @property(nonatomic, assign) BOOL isDeleteMessagesWhenExitGroup __deprecated_msg("Use deleteMessagesOnLeaveGroup instead");
  272. /**
  273. * \~chinese
  274. * 离开聊天室时是否删除所有消息, 默认为 YES。
  275. *
  276. * \~english
  277. * Whether to delete all the chat room messages when leaving the chat room. The default value is YES.
  278. */
  279. @property(nonatomic, assign) BOOL isDeleteMessagesWhenExitChatRoom
  280. __deprecated_msg("Use deleteMessagesOnLeaveChatroom instead");
  281. /**
  282. * \~chinese
  283. * 是否允许聊天室所有者离开, 默认为 YES。
  284. *
  285. * \~english
  286. * if allow chat room's owner can leave the chat room. The default value is YES.
  287. */
  288. @property(nonatomic, assign) BOOL isChatroomOwnerLeaveAllowed
  289. __deprecated_msg("Use canChatroomOwnerLeave instead");
  290. /**
  291. * \~chinese
  292. * 用户自动同意群邀请, 默认为 YES。
  293. *
  294. * \~english
  295. * Whether to automatically accept group invitation. The default value is YES.
  296. */
  297. @property(nonatomic, assign) BOOL isAutoAcceptGroupInvitation
  298. __deprecated_msg("Use autoAcceptGroupInvitation instead");
  299. /**
  300. * \~chinese
  301. * 自动同意好友申请, 默认为 NO。
  302. *
  303. * \~english
  304. * Whether to automatically approve friend request. The default value is NO.
  305. */
  306. @property(nonatomic, assign) BOOL isAutoAcceptFriendInvitation
  307. __deprecated_msg("Use autoAcceptFriendInvitation instead");
  308. /**
  309. * \~chinese
  310. * 是否自动下载图片和视频缩略图及语音消息, 默认为 YES。
  311. *
  312. * \~english
  313. * Whether to automatically download thumbnail of image&video and audio. The default value is YES.
  314. */
  315. @property(nonatomic, assign) BOOL isAutoDownloadThumbnail
  316. __deprecated_msg("Use autoDownloadThumbnail instead");
  317. @end