EMOptions constructor

EMOptions({
  1. required String appKey,
  2. bool autoLogin = true,
  3. bool debugMode = false,
  4. bool acceptInvitationAlways = false,
  5. bool autoAcceptGroupInvitation = false,
  6. bool requireAck = true,
  7. bool requireDeliveryAck = false,
  8. bool deleteMessagesAsExitGroup = true,
  9. bool deleteMessagesAsExitChatRoom = true,
  10. bool isChatRoomOwnerLeaveAllowed = true,
  11. bool sortMessageByServerTime = true,
  12. bool usingHttpsOnly = true,
  13. bool serverTransfer = true,
  14. bool isAutoDownloadThumbnail = true,
  15. bool enableDNSConfig = true,
  16. String? dnsUrl,
  17. String? restServer,
  18. int? imPort,
  19. String? imServer,
  20. int chatAreaCode = ChatAreaCode.GLOB,
  21. bool enableEmptyConversation = false,
  22. String? deviceName,
  23. int? osType,
  24. bool useReplacedMessageContents = false,
  25. bool enableTLS = false,
  26. bool messagesReceiveCallbackIncludeSend = false,
  27. bool regardImportMessagesAsRead = false,
})

~english Sets the app options.

Param appKey The app key that you get from the console when creating an app.

Param autoLogin Whether to enable automatic login.

Param debugMode Whether to output the debug information. Make sure to call the method after the EMClient is initialized. See EMClient.init.

Param acceptInvitationAlways Whether to accept friend invitations from other users automatically.

Param autoAcceptGroupInvitation Whether to accept group invitations automatically.

Param requireAck Whether the read receipt is required.

Param requireDeliveryAck Whether the delivery receipt is required.

Param deleteMessagesAsExitGroup Whether to delete the related group messages when leaving a group.

Param deleteMessagesAsExitChatRoom Whether to delete the related chat room messages when leaving the chat room.

Param isChatRoomOwnerLeaveAllowed Whether to allow the chat room owner to leave the chat room.

Param sortMessageByServerTime Whether to sort the messages by the time the server receives messages.

Param usingHttpsOnly Whether only HTTPS is used for REST operations.

Param serverTransfer Whether to upload the message attachments automatically to the chat server.

Param isAutoDownloadThumbnail Whether to automatically download the thumbnail.

Param enableDNSConfig Whether to enable DNS.

Param dnsUrl The DNS url.

Param restServer The REST server for private deployments.

Param imPort The IM server port for private deployments.

Param imServer The IM server URL for private deployment.

Param chatAreaCode The area code.

Param enableEmptyConversation Whether to include empty conversations when the SDK loads conversations from the local database.

Param deviceName Custom device name.

Param osType Custom system type.

Param useReplacedMessageContents Whether the server returns the sender the text message with the content replaced during text moderation, the default is false.

Param enableTLS Whether to enable TLS connection, which takes effect during initialization and is false by default.

Param messagesReceiveCallbackIncludeSend Whether the sent message is included in EMChatEventHandler.onMessagesReceived, default is false.

Param regardImportMessagesAsRead Whether to regard import messages as read, default is false.

~end

~chinese 设置 SDK Param appKey 创建 app 时在 console 后台上注册的 app 唯一识别符。

Param autoLogin 是否开启自动登录。

  • (默认)true:是;
  • false:否。

Param debugMode 是否输出调试信息,在 EMClient 初始化完成后调用,详见 EMClient.init

  • true:SDK 会在 log 里输出调试信息;
  • (默认)false:不会输出调试信息。

Param acceptInvitationAlways 是否自动接受加好友邀请。

  • (默认)true:是;
  • false:否。

Param autoAcceptGroupInvitation 是否自动接受群组邀请。

  • true:是;
  • (默认)false:否。

Param requireAck 是否发送已读回执。

  • (默认)true:是;
  • false:否。

Param requireDeliveryAck 是否发送已送达回执。

  • (默认)true:是;
  • false:否。

Param deleteMessagesAsExitGroup 是否在离开群组时删除群组历史消息。

  • (默认)true:是;
  • false:否。

Param deleteMessagesAsExitChatRoom 是否在离开聊天室时删除聊天历史消息。

  • (默认)true:是;
  • false:否。

Param isChatRoomOwnerLeaveAllowed 是否允许聊天室所有者离开聊天室。

  • (默认)true:是;
  • false:否。

Param sortMessageByServerTime 是否根据服务器收到消息的时间对消息进行排序。

  • (默认)true:是;
  • false:否。

Param usingHttpsOnly 是否只使用 HTTPS。

  • (默认)true:是;
  • false:否。

Param serverTransfer 是否自动将消息附件上传到聊天服务器。

  • (默认)true:是;
  • false:否。

Param isAutoDownloadThumbnail 是否自动下载缩略图。

  • (默认)true:是;
  • false:否。

Param enableDNSConfig 设置是否开启 DNS。

  • (默认)true:是;
  • false:否。

Param dnsUrl DNS 地址。

Param restServer 私有部署时的 REST 服务器地址。

Param imPort 私有部署时的 IM 服务器端口。

Param imServer 私有部署时的 IM 服务器地址。

Param chatAreaCode server 区域码.

Param enableEmptyConversation 从本地数据库加载会话时是否包括空会话。

Param deviceName 自定义设备名称。

Param osType 自定义系统类型。

Param useReplacedMessageContents 是否在文本审核时,返回给发送者被替换内容的文本消息, 默认为 false。

Param enableTLS 是否开启 TLS 连接,初始化时生效,默认为 false。

Param messagesReceiveCallbackIncludeSend 发送的消息是会执行 EMChatEventHandler.onMessagesReceived 回调, 默认为 false。

Param regardImportMessagesAsRead 是否将导入的消息视为已读, 默认为 false。

~end

Implementation

EMOptions({
  required this.appKey,
  this.autoLogin = true,
  this.debugMode = false,
  this.acceptInvitationAlways = false,
  this.autoAcceptGroupInvitation = false,
  this.requireAck = true,
  this.requireDeliveryAck = false,
  this.deleteMessagesAsExitGroup = true,
  this.deleteMessagesAsExitChatRoom = true,
  this.isChatRoomOwnerLeaveAllowed = true,
  this.sortMessageByServerTime = true,
  this.usingHttpsOnly = true,
  this.serverTransfer = true,
  this.isAutoDownloadThumbnail = true,
  this.enableDNSConfig = true,
  this.dnsUrl,
  this.restServer,
  this.imPort,
  this.imServer,
  this.chatAreaCode = ChatAreaCode.GLOB,
  this.enableEmptyConversation = false,
  this.deviceName,
  this.osType,
  this.useReplacedMessageContents = false,
  this.enableTLS = false,
  this.messagesReceiveCallbackIncludeSend = false,
  this.regardImportMessagesAsRead = false,
});