ChatOptions class

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

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})
设置 SDK Param appKey 创建 app 时在 console 后台上注册的 app 唯一识别符。
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, Map<String, dynamic>? extSettings})
设置 SDK Param appKey 创建 app 时在 console 后台上注册的 app 唯一识别符。
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, Map<String, dynamic>? extSettings})
设置 SDK Param appKey 创建 app 时在 console 后台上注册的 app 唯一识别符。

Properties

acceptInvitationAlways → bool
是否自动接受加好友邀请。
final
appId → String?
创建 app 时在 console 后台上注册的 app 唯一识别符。
final
appKey → String?
创建 app 时在 console 后台上注册的 app 唯一识别符。
final
autoAcceptGroupInvitation → bool
是否自动接受群组邀请。
final
autoLogin → bool
是否允许自动登录。
final
chatAreaCode → int
区号 此属性用于限制可访问边缘节点的范围。缺省值为AreaCodeGLOB。 此属性只能在调用ChatClient.init时设置。在应用程序运行期间不能更改属性设置。
final
debugMode → bool
是否输出调试信息,在 ChatClient 初始化完成后调用,详见 ChatClient.init。
final
deleteMessagesAsExitChatRoom → bool
离开聊天室时是否删除消息。
final
deleteMessagesAsExitGroup → bool
离开群组时是否删除消息。
final
deviceName → String?
自定义设备名称。
final
dnsUrl → String?
DNS 地址。
final
enableAutoSyncContacts → bool
是否在登录后自动从服务器同步联系人列表。
final
enableDNSConfig → bool
是否开启 DNS。
final
enableEmptyConversation → bool
从本地数据库加载会话时是否包括空会话。
final
enableTLS → bool
是否开启 TLS 连接,初始化时生效,默认为 false。
final
enableUserInfo → bool
是否开启用户属性功能。
final
hashCode → int
The hash code for this object.
no setterinherited
imPort → int?
是否使用自定义 IM 服务的端口。用于私有化部署。
final
imServer → String?
消息服务器。
final
isAutoDownloadThumbnail → bool
是否自动下载缩略图。
final
isChatRoomOwnerLeaveAllowed → bool
是否允许聊天室所有者离开聊天室。
final
loginExtension → String?
登录时携带的扩展信息,可以是JSON 字符串,目前字符串长度 底层限制长度1024
final
messagesReceiveCallbackIncludeSend → bool
发送的消息是会执行 ChatEventHandler.onMessagesReceived 回调。
final
ntpServers → List<String>?
自定义 NTP 服务器列表,用于 SDK 校准时间。
final
osType → int?
自定义系统类型。
final
regardImportMessagesAsRead → bool
是否将导入的消息视为已读。
final
requireAck → bool
是否发送消息已读回执.
final
requireDeliveryAck → bool
/// 是否发送消息已送达回执。
final
restServer → String?
REST 服务器。
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverTransfer → bool
是否自动将消息附件上传到聊天服务器。
final
sortMessageByServerTime → bool
是否根据服务器收到消息的时间对消息进行排序。
final
useReplacedMessageContents → bool
是否在文本审核时,返回给发送者被替换内容的文本消息:
final
usingHttpsOnly → bool
是否只用 HTTPS。
final
webSocketPort → int?
WebSocket 服务器端口。
final
webSocketServer → String?
WebSocket 服务器地址。
final
workPathCopiable → bool
SDK 的工作路径是否可备份, 只有ios生效,默认为 false。
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
开启 Apple 推送通知服务(APNs)推送。
enableFCM(String appId) → void
开启 FCM(GCM 的升级版)推送。
enableHonorPush() → void
开启荣耀推送。
enableHWPush() → void
开启华为推送。
enableMeiZuPush(String appId, String appKey) → void
开启魅族推送. Param appId 魅族 App ID. Param appKey 魅族 App Key.
enableMiPush(String appId, String appKey) → void
开启小米推送。
enableOppoPush(String appKey, String secret) → void
开启 Oppo 推送。
enableVivoPush(bool agreePrivacyStatement) → void
开启 vivo 推送。
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