ChatOptions.withAppKey constructor

ChatOptions.withAppKey(
  1. 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,
  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,
  28. bool workPathCopiable = false,
  29. String? loginExtension,
})

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

Param autoLogin 是否开启自动登录。

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

Param debugMode 是否输出调试信息,在 ChatClient 初始化完成后调用,详见 ChatClient.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 发送的消息是会执行 ChatEventHandler.onMessagesReceived 回调。

  • true:是。接收消息通知中包含发送成功的消息。
  • (默认)false:否。接收消息通知中只包含接收的消息。

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

Param workPathCopiable 是否允许复制工作路径到其他地方,只有ios生效,默认为 false。

Implementation

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,
  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,
      );