ChatOptions class

~english The ChatOptions class, which contains the settings of the Chat SDK.

For example, whether to encrypt the messages before sending and whether to automatically accept the friend invitations. ~end

~chinese 提供 SDK 聊天相关的设置。 用户可以用来配置 SDK 的各种参数、选项, 比如,发送消息加密,是否自动接受加好友邀请。 ~end

Constructors

ChatOptions({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, String? webSocketServer, int? webSocketPort, int? chatAreaCode, bool enableEmptyConversation = false, String? deviceName, int? osType, bool useReplacedMessageContents = false, bool enableTLS = false, bool messagesReceiveCallbackIncludeSend = false, bool regardImportMessagesAsRead = false, bool workPathCopiable = false, bool enableUserInfo = false, bool enableAutoSyncContacts = false, String? loginExtension, List<String>? ntpServers, String? apnsCertName, String? pushKitCertName, bool enableChatroomConversation = false, bool autoLoadConversations = true})
~english Sets the app options.
ChatOptions.withAppId(String appId, {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, String? webSocketServer, int? webSocketPort, int? chatAreaCode, bool enableEmptyConversation = false, String? deviceName, int? osType, bool useReplacedMessageContents = false, bool enableTLS = false, bool messagesReceiveCallbackIncludeSend = false, bool regardImportMessagesAsRead = false, bool workPathCopiable = false, bool enableUserInfo = false, bool enableAutoSyncContacts = false, String? loginExtension, List<String>? ntpServers, String? apnsCertName, String? pushKitCertName, bool enableChatroomConversation = false, bool autoLoadConversations = true, Map<String, dynamic>? extSettings})
~english Sets the app options.
ChatOptions.withAppKey(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, String? webSocketServer, int? webSocketPort, int? chatAreaCode, bool enableEmptyConversation = false, String? deviceName, int? osType, bool useReplacedMessageContents = false, bool enableTLS = false, bool messagesReceiveCallbackIncludeSend = false, bool regardImportMessagesAsRead = false, bool workPathCopiable = false, bool enableUserInfo = false, bool enableAutoSyncContacts = false, String? loginExtension, List<String>? ntpServers, String? apnsCertName, String? pushKitCertName, bool enableChatroomConversation = false, bool autoLoadConversations = true, Map<String, dynamic>? extSettings})
~english Sets the app options.

Properties

acceptInvitationAlways → bool
~english Whether to accept friend invitations from other users automatically.
final
apnsCertName → String?
~english The name of the APNs certificate, which is used for offline push notifications on iOS.
final
appId → String?
~english The app key that you get from the console when creating the app. ~end
final
appKey → String?
~english The app key that you get from the console when creating the app. ~end
final
autoAcceptGroupInvitation → bool
~english Whether to accept group invitations automatically.
final
autoLoadConversations → bool
~english Whether to automatically load the conversation list from the local database during initialization.
final
autoLogin → bool
~english Whether to enable automatic login.
final
chatAreaCode → int
~english The area code. This attribute is used to restrict the scope of accessible edge nodes. The default value is AreaCodeGLOB. This attribute can be set only when you call ChatClient.init. The attribute setting cannot be changed during the app runtime. ~end
final
debugMode → bool
~english Whether to output the debug information. Make sure to call the method after initializing the ChatClient using ChatClient.init.
final
deleteMessagesAsExitChatRoom → bool
~english Whether to delete the chat room messages when leaving the chat room.
final
deleteMessagesAsExitGroup → bool
~english Whether to delete the group messages when leaving a group.
final
deviceName → String?
~english Custom device name. ~end
final
dnsUrl → String?
~english The DNS URL. ~end
final
enableAutoSyncContacts → bool
~english Whether to automatically sync the contact list from the server after login.
final
enableChatroomConversation → bool
~english Whether to create a conversation for chat room messages.
final
enableDNSConfig → bool
~english Whether to enable DNS.
final
enableEmptyConversation → bool
~english Whether to include empty conversations when the SDK loads conversations from the local database:
final
enableTLS → bool
~english Whether to enable TLS connection, which takes effect during initialization and is false by default. ~end
final
enableUserInfo → bool
~english Whether to enable the user info feature.
final
hashCode → int
The hash code for this object.
no setterinherited
imPort → int?
~english The custom IM server port. ~end
final
imServer → String?
~english The custom IM message server url. ~end
final
isAutoDownloadThumbnail → bool
~english Whether to automatically download the thumbnail.
final
isChatRoomOwnerLeaveAllowed → bool
~english Whether to allow the chat room owner to leave the chat room.
final
loginExtension → String?
~english The extended information carried during login can be a JSON string. The current string length is limited to 1024 characters. ~end
final
messagesReceiveCallbackIncludeSend → bool
~english Whether the sent message is included in ChatEventHandler.onMessagesReceived:
final
ntpServers → List<String>?
~english The custom NTP server list used by the SDK to calibrate time.
final
osType → int?
~english Custom system type. ~end
final
pushKitCertName → String?
~english The name of the PushKit certificate, which is used for VoIP push notifications on iOS.
final
regardImportMessagesAsRead → bool
~english Whether to regard import messages as read.
final
requireAck → bool
~english Whether to require read receipt after sending a message.
final
requireDeliveryAck → bool
~english Whether to require the delivery receipt after sending a message.
final
restServer → String?
~english The custom REST server. ~end
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverTransfer → bool
~english Whether to upload the message attachments automatically to the chat server.
final
sortMessageByServerTime → bool
~english Whether to sort the messages by the time when the messages are received by the server.
final
useReplacedMessageContents → bool
~english Whether the server returns the sender the text message with the content replaced during text moderation:
final
usingHttpsOnly → bool
~english Whether only HTTPS is used for REST operations.
final
webSocketPort → int?
~english The WebSocket server port.
final
webSocketServer → String?
~english The WebSocket server.
final
workPathCopiable → bool
~english Whether the SDK work path is copiable, only valid for iOS, default is false. ~end
final

Methods

copyWith({bool? usingHttpsOnly, String? loginExtension, bool? deleteMessageWhenLeaveRoom, bool? deleteMessagesWhenLeaveGroup, bool? roomOwnerCanLeave, bool? autoAcceptGroupInvitation, bool? acceptInvitationAlways, bool? autoDownloadThumbnail, bool? requireDeliveryAck, bool? requireAck, bool? sortMessageByServerTime, bool? messagesReceiveCallbackIncludeSend, bool? regardImportMessagesAsRead, Map<String, dynamic>? extSettings}) → ChatOptions
enableAPNs(String certName) → void
~english Enables Apple Push Notification service (APNs) on iOS devices.
enableFCM(String appId) → void
~english Enables Firebase Cloud Messaging (FCM) push on devices that support Google Play.
enableHonorPush() → void
~english Enables Honor Push on Honor devices. ~end
enableHWPush() → void
~english Enables Huawei Push on Huawei devices. ~end
enableMeiZuPush(String appId, String appKey) → void
~english Enables MeiZu Push on MeiZu devices. Param appId The app ID for MeiZu Push. Param appKey The app key for MeiZu Push. ~end
enableMiPush(String appId, String appKey) → void
~english Enables Mi Push on Mi devices.
enableOppoPush(String appKey, String secret) → void
~english Enables OPPO PUSH on OPPO devices.
enableVivoPush(bool agreePrivacyStatement) → void
~english Enables vivo Push on vivo devices. ~end
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited