"use strict";var o=require("../../../../../common/vendor.js"),a=require("../IComponentServer.js"),i=require("../../../../../store/index.js");class c extends a.IComponentServer{constructor(t){super(),this.store=i.store.state.timStore,this.TUICore=o.index.$TUIKit,o.index.setStorageSync(`TIM_${o.index.$chat_SDKAppID}_isTUIKit`,!0),o.index.$aegis&&o.index.$aegis.reportEvent({name:"platform",ext1:"platform-MP-WEIXIN",ext2:"uniTuikitExternalVue3",ext3:`${o.index.$chat_SDKAppID}`}),this.bindTIMEvent(),o.index.$chat_isSDKReady&&this.getConversationList()}bindTIMEvent(){this.TUICore.on(o.index.$TIM.EVENT.CONVERSATION_LIST_UPDATED,this.handleConversationListUpdate,this)}unbindTIMEvent(){this.TUICore.off(o.index.$TIM.EVENT.CONVERSATION_LIST_UPDATED,this.handleConversationListUpdate)}handleConversationListUpdate(t){o.index.hideLoading(),t.data.length,o.index.$emit("refreshMsgCount"),t.data.forEach(function(s){console.log("\u6536\u5230\u4F1A\u8BDD\u6D88\u606F"),console.log(s)}),i.store.commit("timStore/setConversationList",t.data)}destroyed(){this.unbindTIMEvent()}async getConversationList(){return new Promise(async(t,s)=>{try{const n=await o.index.$TUIKit.getConversationList();i.store.commit("timStore/setConversationList",n.data.conversationList),o.index.hideLoading(),t(n)}catch(n){s(n)}})}async getConversationProfile(t){return new Promise(async(s,n)=>{try{const e=await this.TUICore.getConversationProfile(t);s(e)}catch(e){n(e)}})}async setConversationValue(t,s){return new Promise(async(n,e)=>{try{const r=await this.TUICore.setConversationCustomData({conversationIDList:[t],customData:s});n(r)}catch(r){e(r)}})}async deleteConversation(t){return new Promise(async(s,n)=>{try{const e=await this.TUICore.deleteConversation(t);s(e)}catch(e){n(e)}})}async pinConversation(t){return new Promise(async(s,n)=>{try{const e=await this.TUICore.pinConversation(t);s(e)}catch(e){n(e)}})}async muteConversation(t){return new Promise(async(s,n)=>{try{const e=await this.TUICore.setMessageRemindType(t);s(e)}catch(e){n(e)}})}async setMessageRead(t){return new Promise(async(s,n)=>{try{const e=await this.TUICore.setMessageRead({conversationID:t});s(e)}catch(e){n(e)}})}}exports.TUIConversationServer=c;
