EMOptions constructor
- @Deprecated('Use [EMOptions.withAppKey] instead.')
- required String appKey,
- bool autoLogin = true,
- bool debugMode = false,
- bool acceptInvitationAlways = false,
- bool autoAcceptGroupInvitation = false,
- bool requireAck = true,
- bool requireDeliveryAck = false,
- bool deleteMessagesAsExitGroup = true,
- bool deleteMessagesAsExitChatRoom = true,
- bool isChatRoomOwnerLeaveAllowed = true,
- bool sortMessageByServerTime = true,
- bool usingHttpsOnly = true,
- bool serverTransfer = true,
- bool isAutoDownloadThumbnail = true,
- bool enableDNSConfig = true,
- String? dnsUrl,
- String? restServer,
- int? imPort,
- String? imServer,
- int? chatAreaCode,
- bool enableEmptyConversation = false,
- String? deviceName,
- int? osType,
- bool useReplacedMessageContents = false,
- bool enableTLS = false,
- bool messagesReceiveCallbackIncludeSend = false,
- bool regardImportMessagesAsRead = false,
- bool workPathCopiable = false,
- String? loginExtension,
~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.
- (Default)
true
: Enables automatic login. false
: Disables automatic login.
Param debugMode
Whether to output the debug information. Make sure to call the method after the EMClient is initialized.
true
: Yes.- (Default)
false
: No. ParamacceptInvitationAlways
Whether to accept friend invitations from other users automatically. true
: Yes.- (Default)
false
: No.
Param autoAcceptGroupInvitation
Whether to accept group invitations automatically.
true
: Yes.- (Default)
false
: No.
Param requireAck
Whether to require the message read receipt from the recipient.
- (Default)
true
: Yes. false
: No.
Param requireDeliveryAck
Whether the delivery receipt is required.
true
: Yes.
(Default) false
: No.
Param deleteMessagesAsExitGroup
Whether to delete the related group messages when leaving a group.
- (Default)
true
: Yes. false
: No.
Param deleteMessagesAsExitChatRoom
Whether to delete the related chat room messages when leaving the chat room.
- (Default)
true
: Yes. false
: No.
Param isChatRoomOwnerLeaveAllowed
Whether to allow the chat room owner to leave the chat room.
- (Default)
true
: Yes. Even if the chat room owner leaves the chat room, the owner still has all privileges, except for receiving messages in the chat room. false
: No.
Param sortMessageByServerTime
Whether to sort the messages in the reverse chronological order of the time when they are received by the server.
- (Default)
true
: Yes; false
: No. Messages are sorted in the reverse chronological order of the time when they are created. ParamusingHttpsOnly
Whether only HTTPS is used for REST operations.- (Default)
true
: Only HTTPS is supported. false
: Both HTTP and HTTPS are allowed.
Param serverTransfer
Whether to upload the message attachments automatically to the chat server.
- (Default)
true
: Yes. false
: No. A custom path is used.
Param isAutoDownloadThumbnail
Whether to automatically download the thumbnail.
- (Default)
true
: Yes. false
: No.
Param enableDNSConfig
Whether to enable DNS.
- (Default)
true
: Yes. false
: No. DNS needs to be disabled for private deployment.
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.
true
: Yes. Empty conversations are included.- (Default)
false
: No. Empty conversations are excluded.
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.
true
: Yes.- (Default)
false
: No. The server returns the original message to the sender.
Param enableTLS
Whether to enable TLS connection, which takes effect during initialization and is false by default.
Param messagesReceiveCallbackIncludeSend
Whether to include the sent message in EMChatEventHandler.onMessagesReceived.
true
: Yes. Besides the received message, the sent message is also included in EMChatEventHandler.onMessagesReceived.- (Default)
false
: No. Only the received message is included in EMChatEventHandler.onMessagesReceived.
Param regardImportMessagesAsRead
Whether to regard import messages as read:
true
: Yes.- (Default)
false
: No.
Param workPathCopiable
Whether the SDK work path is copiable, only valid for iOS, 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
从本地数据库加载会话时是否包括空会话。
true
:包含空会话;- (默认)
false
:不包含空会话。
Param deviceName
自定义设备名称。
Param osType
自定义系统类型。
Param useReplacedMessageContents
是否在文本审核时,返回给发送者被替换内容的文本消息。
true
:将内容替换后的消息返回给发送方。- (默认)
false
:将原消息返回给发送方。
Param enableTLS
是否开启 TLS 连接,初始化时生效,默认为 false。
Param messagesReceiveCallbackIncludeSend
发送的消息是会执行 EMChatEventHandler.onMessagesReceived 回调。
true
:是。接收消息通知中包含发送成功的消息。- (默认)
false
:否。接收消息通知中只包含接收的消息。
Param regardImportMessagesAsRead
是否将导入的消息视为已读, 默认为 false。
Param workPathCopiable
是否允许复制工作路径到其他地方,只有ios生效,默认为 false。
~end
Implementation
@Deprecated('Use [EMOptions.withAppKey] instead.')
/// ~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.
/// - (Default) `true`: Enables automatic login.
/// - `false`: Disables automatic login.
///
/// Param [debugMode] Whether to output the debug information. Make sure to call the method after the EMClient is initialized.
/// - `true`: Yes.
/// - (Default) `false`: No.
/// Param [acceptInvitationAlways] Whether to accept friend invitations from other users automatically.
/// - `true`: Yes.
/// - (Default) `false`: No.
///
/// Param [autoAcceptGroupInvitation] Whether to accept group invitations automatically.
/// - `true`: Yes.
/// - (Default) `false`: No.
///
/// Param [requireAck] Whether to require the message read receipt from the recipient.
/// - (Default) `true`: Yes.
/// - `false`: No.
///
/// Param [requireDeliveryAck] Whether the delivery receipt is required.
/// `true`: Yes.
/// (Default) `false`: No.
///
/// Param [deleteMessagesAsExitGroup] Whether to delete the related group messages when leaving a group.
/// - (Default) `true`: Yes.
/// - `false`: No.
///
/// Param [deleteMessagesAsExitChatRoom] Whether to delete the related chat room messages when leaving the chat room.
/// - (Default) `true`: Yes.
/// - `false`: No.
///
/// Param [isChatRoomOwnerLeaveAllowed] Whether to allow the chat room owner to leave the chat room.
/// - (Default) `true`: Yes. Even if the chat room owner leaves the chat room, the owner still has all privileges, except for receiving messages in the chat room.
/// - `false`: No.
///
/// Param [sortMessageByServerTime] Whether to sort the messages in the reverse chronological order of the time when they are received by the server.
/// - (Default) `true`: Yes;
/// - `false`: No. Messages are sorted in the reverse chronological order of the time when they are created.
/// Param [usingHttpsOnly] Whether only HTTPS is used for REST operations.
/// - (Default) `true`: Only HTTPS is supported.
/// - `false`: Both HTTP and HTTPS are allowed.
///
/// Param [serverTransfer] Whether to upload the message attachments automatically to the chat server.
/// - (Default) `true`: Yes.
/// - `false`: No. A custom path is used.
///
/// Param [isAutoDownloadThumbnail] Whether to automatically download the thumbnail.
/// - (Default) `true`: Yes.
/// - `false`: No.
///
/// Param [enableDNSConfig] Whether to enable DNS.
/// - (Default) `true`: Yes.
/// - `false`: No. DNS needs to be disabled for private deployment.
///
/// 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.
/// - `true`: Yes. Empty conversations are included.
/// - (Default) `false`: No. Empty conversations are excluded.
///
/// 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.
/// - `true`: Yes.
/// - (Default) `false`: No. The server returns the original message to the sender.
///
/// Param [enableTLS] Whether to enable TLS connection, which takes effect during initialization and is false by default.
///
/// Param [messagesReceiveCallbackIncludeSend] Whether to include the sent message in [EMChatEventHandler.onMessagesReceived].
/// - `true`: Yes. Besides the received message, the sent message is also included in [EMChatEventHandler.onMessagesReceived].
/// - (Default)`false`: No. Only the received message is included in [EMChatEventHandler.onMessagesReceived].
///
/// Param [regardImportMessagesAsRead] Whether to regard import messages as read:
/// - `true`: Yes.
/// - (Default) `false`: No.
///
/// Param [workPathCopiable] Whether the SDK work path is copiable, only valid for iOS, 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] 从本地数据库加载会话时是否包括空会话。
/// - `true`:包含空会话;
/// - (默认)`false`:不包含空会话。
///
/// Param [deviceName] 自定义设备名称。
///
/// Param [osType] 自定义系统类型。
///
/// Param [useReplacedMessageContents] 是否在文本审核时,返回给发送者被替换内容的文本消息。
/// - `true`:将内容替换后的消息返回给发送方。
/// - (默认)`false`:将原消息返回给发送方。
///
/// Param [enableTLS] 是否开启 TLS 连接,初始化时生效,默认为 false。
///
/// Param [messagesReceiveCallbackIncludeSend] 发送的消息是会执行 [EMChatEventHandler.onMessagesReceived] 回调。
/// - `true`:是。接收消息通知中包含发送成功的消息。
/// - (默认)`false`:否。接收消息通知中只包含接收的消息。
///
/// Param [regardImportMessagesAsRead] 是否将导入的消息视为已读, 默认为 false。
///
///
/// Param [workPathCopiable] 是否允许复制工作路径到其他地方,只有ios生效,默认为 false。
///
/// ~end
EMOptions({
required String appKey,
bool autoLogin = true,
bool debugMode = false,
bool acceptInvitationAlways = false,
bool autoAcceptGroupInvitation = false,
bool requireAck = true,
bool requireDeliveryAck = false,
bool deleteMessagesAsExitGroup = true,
bool deleteMessagesAsExitChatRoom = true,
bool isChatRoomOwnerLeaveAllowed = true,
bool sortMessageByServerTime = true,
bool usingHttpsOnly = true,
bool serverTransfer = true,
bool isAutoDownloadThumbnail = true,
bool enableDNSConfig = true,
String? dnsUrl,
String? restServer,
int? imPort,
String? imServer,
int? chatAreaCode,
bool enableEmptyConversation = false,
String? deviceName,
int? osType,
bool useReplacedMessageContents = false,
bool enableTLS = false,
bool messagesReceiveCallbackIncludeSend = false,
bool regardImportMessagesAsRead = false,
bool workPathCopiable = false,
String? loginExtension,
}) : this._(
appKey: appKey,
autoLogin: autoLogin,
debugMode: debugMode,
acceptInvitationAlways: acceptInvitationAlways,
autoAcceptGroupInvitation: autoAcceptGroupInvitation,
requireAck: requireAck,
requireDeliveryAck: requireDeliveryAck,
deleteMessagesAsExitGroup: deleteMessagesAsExitGroup,
deleteMessagesAsExitChatRoom: deleteMessagesAsExitChatRoom,
isChatRoomOwnerLeaveAllowed: isChatRoomOwnerLeaveAllowed,
sortMessageByServerTime: sortMessageByServerTime,
usingHttpsOnly: usingHttpsOnly,
serverTransfer: serverTransfer,
isAutoDownloadThumbnail: isAutoDownloadThumbnail,
enableDNSConfig: enableDNSConfig,
dnsUrl: dnsUrl,
restServer: restServer,
imPort: imPort,
imServer: imServer,
chatAreaCode: chatAreaCode ?? ChatAreaCode.GLOB,
enableEmptyConversation: enableEmptyConversation,
deviceName: deviceName,
osType: osType,
useReplacedMessageContents: useReplacedMessageContents,
enableTLS: enableTLS,
messagesReceiveCallbackIncludeSend:
messagesReceiveCallbackIncludeSend,
regardImportMessagesAsRead: regardImportMessagesAsRead,
workPathCopiable: workPathCopiable,
loginExtension: loginExtension,
);