"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../const/index"); const common_utils_1 = require("../utils/common-utils"); class CallStore { constructor() { this.defaultStore = { callStatus: index_1.CallStatus.IDLE, callRole: index_1.CallRole.UNKNOWN, callMediaType: index_1.CallMediaType.UNKNOWN, localUserInfo: { userId: '' }, remoteUserInfoList: [], callerUserInfo: { userId: '' }, isGroup: false, callDuration: '00:00:00', callTips: '', toastInfo: { text: '' }, isMinimized: false, enableFloatWindow: false, bigScreenUserId: '', language: (0, common_utils_1.getLanguage)(), isClickable: false, deviceList: { cameraList: [], microphoneList: [], currentCamera: {}, currentMicrophone: {} }, showPermissionTip: false, groupID: '', roomID: 0, // TUICallKit 组件上的属性 displayMode: index_1.VideoDisplayMode.COVER, videoResolution: index_1.VideoResolution.RESOLUTION_480P, showSelectUser: false, // 小程序相关属性 pusher: {}, player: [], isEarPhone: false, // 是否是听筒, 默认: false }; this.store = Object.assign({}, this.defaultStore); } ; update(key, data) { switch (key) { // case 'callTips': // break; default: // resolve "Type 'any' is not assignable to type 'never'.ts", ref: https://github.com/microsoft/TypeScript/issues/31663 this.store[key] = data; } } getData(key) { if (!key) return this.store; return this.store[key]; } // reset call store reset(keyList = []) { if (keyList.length === 0) { keyList = Object.keys(this.store); } const resetToDefault = keyList.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: this.defaultStore[key] })), {}); this.store = Object.assign(Object.assign(Object.assign({}, this.defaultStore), this.store), resetToDefault); } } exports.default = CallStore;