"use strict";const E=require("../../../common/vendor.js"),e=require("./config.js");exports.TUIChatServer=class{constructor(){this.currentConversationID="",this.currentMessageList=[],E.R.registerService(E.E.TUIChat.SERVICE.NAME,this),E.R.registerEvent(E.E.TUITheme.EVENT.THEME_CHANGED,E.E.TUITheme.EVENT_SUB_KEY.CHANGE_SUCCESS,this),E.R.registerEvent(E.E.TUIChat.EVENT.CHAT_TYPE_CHANGED,E.E.TUIChat.EVENT_SUB_KEY.CHANGE_SUCCESS,this),E.Jt.watch(E.o.CONV,{currentConversationID:E=>{this.currentConversationID=E}})}onCall(t,s,C){let T;switch(t){case E.E.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST:T=s.message,(null==T?void 0:T.conversationID)===this.currentConversationID&&E.Qt.updateMessageList([T],"push");break;case E.E.TUIChat.SERVICE.METHOD.SEND_CUSTOM_MESSAGE:E.Qt.sendCustomMessage(s).then((E=>{C&&C(E)}));break;case E.E.TUIChat.SERVICE.METHOD.SEND_TEXT_MESSAGE:E.Qt.sendTextMessage(s).then((E=>{C&&C(E)}));break;case E.E.TUIChat.SERVICE.METHOD.SET_CHAT_TYPE:e.ChatConfig.setChatType(null==s?void 0:s.chatType);break;case E.E.TUIChat.SERVICE.METHOD.CLOSE_MESSAGE_POP_MENU:E.Jt.update(E.o.CUSTOM,"isShowMessagePopMenu",!1);break;case E.E.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_INFO:E.Qt.updateMessageInfo(null==s?void 0:s.userInfo)}}onNotifyEvent(t,s,C){if(t===E.E.TUITheme.EVENT.THEME_CHANGED&&s===E.E.TUITheme.EVENT_SUB_KEY.CHANGE_SUCCESS)(null==C?void 0:C.theme)&&e.ChatConfig.setTheme(C.theme.toLowerCase());if(t===E.E.TUIChat.EVENT.CHAT_TYPE_CHANGED&&s===E.E.TUIChat.EVENT_SUB_KEY.CHANGE_SUCCESS)(null==C?void 0:C.chatType)&&e.ChatConfig.setChatType(null==C?void 0:C.chatType)}};
