患者1.2
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { IBellParams } from '../interface/index';
|
||||
export declare class BellContext {
|
||||
private _bellContext;
|
||||
private _isMuteBell;
|
||||
private _calleeBellFilePath;
|
||||
private _callRole;
|
||||
private _callStatus;
|
||||
constructor();
|
||||
setBellSrc(): void;
|
||||
setBellProperties(bellParams: IBellParams): void;
|
||||
play(): Promise<void>;
|
||||
stop(): Promise<void>;
|
||||
setBellMute(enable: boolean): Promise<void>;
|
||||
destroy(): void;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BellContext = void 0;
|
||||
const index_1 = require("../const/index");
|
||||
const common_utils_1 = require("../utils/common-utils");
|
||||
const DEFAULT_CALLER_BELL_FILEPATH = '/TUICallKit/static/phone_dialing.mp3';
|
||||
const DEFAULT_CALLEE_BELL_FILEPATH = '/TUICallKit/static/phone_ringing.mp3';
|
||||
class BellContext {
|
||||
constructor() {
|
||||
this._bellContext = null;
|
||||
this._isMuteBell = false;
|
||||
this._calleeBellFilePath = DEFAULT_CALLEE_BELL_FILEPATH;
|
||||
this._callRole = index_1.CallRole.UNKNOWN;
|
||||
this._callStatus = index_1.CallStatus.IDLE;
|
||||
// @ts-ignore
|
||||
this._bellContext = wx.createInnerAudioContext();
|
||||
this._bellContext.loop = true;
|
||||
}
|
||||
setBellSrc() {
|
||||
// @ts-ignore
|
||||
const fs = wx.getFileSystemManager();
|
||||
try {
|
||||
let playBellFilePath = DEFAULT_CALLER_BELL_FILEPATH;
|
||||
if (this._callRole === index_1.CallRole.CALLEE) {
|
||||
playBellFilePath = this._calleeBellFilePath || DEFAULT_CALLEE_BELL_FILEPATH;
|
||||
}
|
||||
fs.readFileSync(playBellFilePath, 'utf8', 0);
|
||||
this._bellContext.src = playBellFilePath;
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(`${index_1.NAME.PREFIX}Failed to setBellSrc, ${error}`);
|
||||
}
|
||||
}
|
||||
setBellProperties(bellParams) {
|
||||
this._callRole = bellParams.callRole || this._callRole;
|
||||
this._callStatus = bellParams.callStatus || this._callStatus;
|
||||
this._calleeBellFilePath = bellParams.calleeBellFilePath || this._calleeBellFilePath;
|
||||
// undefined/false || isMuteBell => isMuteBell (不符合预期)
|
||||
this._isMuteBell = (0, common_utils_1.isUndefined)(bellParams.isMuteBell) ? this._isMuteBell : bellParams.isMuteBell;
|
||||
}
|
||||
play() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
if (this._callStatus !== index_1.CallStatus.CALLING) {
|
||||
return;
|
||||
}
|
||||
this.setBellSrc();
|
||||
if (this._callRole === index_1.CallRole.CALLEE && !this._isMuteBell) {
|
||||
yield this._bellContext.play();
|
||||
}
|
||||
if (this._callRole === index_1.CallRole.CALLER) {
|
||||
yield this._bellContext.play();
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(`${index_1.NAME.PREFIX}Failed to play audio file, ${error}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
stop() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
this._bellContext.stop();
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(`${index_1.NAME.PREFIX}Failed to stop audio file, ${error}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
setBellMute(enable) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this._callStatus !== index_1.CallStatus.CALLING && this._callRole !== index_1.CallRole.CALLEE) {
|
||||
return;
|
||||
}
|
||||
if (enable) {
|
||||
yield this.stop();
|
||||
}
|
||||
else {
|
||||
yield this.play();
|
||||
}
|
||||
});
|
||||
}
|
||||
destroy() {
|
||||
try {
|
||||
this._isMuteBell = false;
|
||||
this._calleeBellFilePath = '';
|
||||
this._callRole = index_1.CallRole.UNKNOWN;
|
||||
this._callStatus = index_1.CallStatus.IDLE;
|
||||
this._bellContext.destroy();
|
||||
this._bellContext = null;
|
||||
}
|
||||
catch (error) {
|
||||
console.warn(`${index_1.NAME.PREFIX}Failed to destroy, ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.BellContext = BellContext;
|
||||
@@ -0,0 +1,97 @@
|
||||
import { ITUICallService, ICallParams, IGroupCallParams, ICallbackParam, ISelfInfoParams, IInviteUserParams, IJoinInGroupCallParams, IInitParams } from '../interface/ICallService';
|
||||
import { LanguageType, LOG_LEVEL, VideoDisplayMode, VideoResolution } from '../const/index';
|
||||
import { ITUIGlobal } from '../interface/ITUIGlobal';
|
||||
import { ITUIStore } from '../interface/ITUIStore';
|
||||
declare const TUIGlobal: ITUIGlobal;
|
||||
declare const TUIStore: ITUIStore;
|
||||
export { TUIGlobal, TUIStore };
|
||||
export default class TUICallService implements ITUICallService {
|
||||
static instance: TUICallService;
|
||||
_tuiCallEngine: any;
|
||||
private _tim;
|
||||
private _TUICore;
|
||||
private _timerId;
|
||||
private _bellContext;
|
||||
constructor();
|
||||
static getInstance(): TUICallService;
|
||||
init(params: IInitParams): Promise<void>;
|
||||
destroyed(): Promise<void>;
|
||||
call(callParams: ICallParams): Promise<void>;
|
||||
groupCall(groupCallParams: IGroupCallParams): Promise<void>;
|
||||
inviteUser(params: IInviteUserParams): Promise<void>;
|
||||
joinInGroupCall(params: IJoinInGroupCallParams): Promise<void>;
|
||||
getTUICallEngineInstance(): any;
|
||||
setLogLevel(level: LOG_LEVEL): void;
|
||||
setLanguage(language: LanguageType): void;
|
||||
enableFloatWindow(enable: boolean): void;
|
||||
setSelfInfo(params: ISelfInfoParams): Promise<void>;
|
||||
setCallingBell(filePath?: string): Promise<void>;
|
||||
enableMuteMode(enable: boolean): Promise<void>;
|
||||
accept(): Promise<void>;
|
||||
hangup(): Promise<void>;
|
||||
reject(): Promise<void>;
|
||||
openCamera(videoViewDomID: string): Promise<void>;
|
||||
closeCamera(): Promise<void>;
|
||||
openMicrophone(): Promise<void>;
|
||||
closeMicrophone(): Promise<void>;
|
||||
switchScreen(userId: string): void;
|
||||
switchCallMediaType(): Promise<void>;
|
||||
switchCamera(): Promise<void>;
|
||||
setSoundMode(type?: string): void;
|
||||
getTim(): any;
|
||||
private _addListenTuiCallEngineEvent;
|
||||
private _removeListenTuiCallEngineEvent;
|
||||
private _handleError;
|
||||
private _handleNewInvitationReceived;
|
||||
private _handleUserAccept;
|
||||
private _handleUserEnter;
|
||||
private _callerChangeToConnected;
|
||||
private _handleUserLeave;
|
||||
private _unNormalEventsManager;
|
||||
private _handleInviteeReject;
|
||||
private _handleNoResponse;
|
||||
private _handleLineBusy;
|
||||
private _handleCallingCancel;
|
||||
private _handleCallingEnd;
|
||||
private _handleSDKReady;
|
||||
private _handleKickedOut;
|
||||
private _handleCallTypeChange;
|
||||
private _messageSentByMe;
|
||||
private _handleUserUpdate;
|
||||
private _handleCallError;
|
||||
beforeCalling: ((...args: any[]) => void) | undefined;
|
||||
afterCalling: ((...args: any[]) => void) | undefined;
|
||||
onMinimized: ((...args: any[]) => void) | undefined;
|
||||
onMessageSentByMe: ((...args: any[]) => void) | undefined;
|
||||
kickedOut: ((...args: any[]) => void) | undefined;
|
||||
statusChanged: ((...args: any[]) => void) | undefined;
|
||||
setCallback(params: ICallbackParam): void;
|
||||
toggleMinimize(): void;
|
||||
private _executeExternalBeforeCalling;
|
||||
private _executeExternalAfterCalling;
|
||||
setVideoDisplayMode(displayMode: VideoDisplayMode): void;
|
||||
setVideoResolution(resolution: VideoResolution): Promise<void>;
|
||||
private _handleExceptionExit;
|
||||
private _setLocalUserInfoAudioVideoAvailable;
|
||||
private _updateCallStoreBeforeCall;
|
||||
private _updateCallStoreAfterCall;
|
||||
private _resetCurrentDevice;
|
||||
private _resetCallStore;
|
||||
private _noDevicePermissionToast;
|
||||
private _startTimer;
|
||||
private _updateCallDuration;
|
||||
private _stopTimer;
|
||||
private _deleteRemoteUser;
|
||||
private _analyzeEventData;
|
||||
getGroupMemberList(count: number, offset: number): Promise<any>;
|
||||
getGroupProfile(): Promise<any>;
|
||||
private _handleCallStatusChange;
|
||||
private _watchTUIStore;
|
||||
private _unwatchTUIStore;
|
||||
bindTUICore(TUICore: any): void;
|
||||
private _callTUIService;
|
||||
onNotifyEvent(eventName: string, subKey: string): Promise<void>;
|
||||
onCall(method: String, params: any): Promise<void>;
|
||||
private _handleTUICoreOnClick;
|
||||
onGetExtension(extensionID: string, params: any): any[];
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
import { CallMediaType, CallStatus } from '../const/index';
|
||||
export declare function initialUI(): void;
|
||||
export declare function checkRunPlatform(): void;
|
||||
export declare function initAndCheckRunEnv(): void;
|
||||
export declare function beforeCall(type: CallMediaType, that: any): Promise<CallStatus.IDLE | CallStatus.CALLING>;
|
||||
export declare function handlePackageError(error: any): void;
|
||||
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.handlePackageError = exports.beforeCall = exports.initAndCheckRunEnv = exports.checkRunPlatform = exports.initialUI = void 0;
|
||||
const index_1 = require("../const/index");
|
||||
function initialUI() {
|
||||
// 收起键盘
|
||||
// @ts-ignore
|
||||
wx.hideKeyboard({
|
||||
complete: () => { },
|
||||
});
|
||||
}
|
||||
exports.initialUI = initialUI;
|
||||
;
|
||||
// 检测运行时环境, 当是微信开发者工具时, 提示用户需要手机调试
|
||||
function checkRunPlatform() {
|
||||
// @ts-ignore
|
||||
const systemInfo = wx.getSystemInfoSync();
|
||||
if (systemInfo.platform === 'devtools') {
|
||||
// 当前运行在微信开发者工具里
|
||||
// @ts-ignore
|
||||
wx.showModal({
|
||||
icon: 'none',
|
||||
title: '运行环境提醒',
|
||||
content: '微信开发者工具不支持原生推拉流组件(即 <live-pusher> 和 <live-player> 标签),请使用真机调试或者扫码预览。',
|
||||
showCancel: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.checkRunPlatform = checkRunPlatform;
|
||||
;
|
||||
function initAndCheckRunEnv() {
|
||||
initialUI(); // miniProgram 收起键盘, 隐藏 tabBar
|
||||
checkRunPlatform(); // miniProgram 检测运行时环境
|
||||
}
|
||||
exports.initAndCheckRunEnv = initAndCheckRunEnv;
|
||||
function beforeCall(type, that) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
initAndCheckRunEnv();
|
||||
// 检查设备权限
|
||||
const deviceMap = {
|
||||
microphone: true,
|
||||
camera: type === index_1.CallMediaType.VIDEO,
|
||||
};
|
||||
const hasDevicePermission = yield that._tuiCallEngine.deviceCheck(deviceMap); // miniProgram 检查设备权限
|
||||
return hasDevicePermission ? index_1.CallStatus.CALLING : index_1.CallStatus.IDLE;
|
||||
}
|
||||
catch (error) {
|
||||
console.debug(error);
|
||||
return index_1.CallStatus.IDLE;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.beforeCall = beforeCall;
|
||||
// 套餐问题提示, 小程序最低需要群组通话版, 1v1 通话版本使用 TRTC 就会报错
|
||||
function handlePackageError(error) {
|
||||
if ((error === null || error === void 0 ? void 0 : error.code) === -1002) {
|
||||
// @ts-ignore
|
||||
wx.showModal({
|
||||
icon: 'none',
|
||||
title: 'error',
|
||||
content: (error === null || error === void 0 ? void 0 : error.message) || '',
|
||||
showCancel: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.handlePackageError = handlePackageError;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { IUserInfo } from '../interface/ICallService';
|
||||
import { ITUIStore } from '../interface/ITUIStore';
|
||||
export declare function setDefaultUserInfo(userId: string, domId?: string): IUserInfo;
|
||||
export declare function getMyProfile(myselfUserId: string, tim: any, TUIStore: any): Promise<IUserInfo>;
|
||||
export declare function getRemoteUserProfile(userIdList: Array<string>, tim: any, TUIStore: any): Promise<any>;
|
||||
export declare function generateText(TUIStore: ITUIStore, key: string, prefix?: string, suffix?: string): string;
|
||||
export declare function generateStatusChangeText(TUIStore: ITUIStore): string;
|
||||
export declare function getGroupMemberList(groupID: string, tim: any, count: any, offset: any): Promise<any>;
|
||||
export declare function getGroupProfile(groupID: string, tim: any): Promise<any>;
|
||||
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getGroupProfile = exports.getGroupMemberList = exports.generateStatusChangeText = exports.generateText = exports.getRemoteUserProfile = exports.getMyProfile = exports.setDefaultUserInfo = void 0;
|
||||
const index_1 = require("../const/index");
|
||||
const index_2 = require("../locales/index");
|
||||
// 设置默认的 UserInfo 信息
|
||||
function setDefaultUserInfo(userId, domId) {
|
||||
const userInfo = {
|
||||
userId,
|
||||
nick: '',
|
||||
avatar: '',
|
||||
remark: '',
|
||||
displayUserInfo: '',
|
||||
isAudioAvailable: false,
|
||||
isVideoAvailable: false,
|
||||
isEnter: false,
|
||||
domId: domId || userId,
|
||||
};
|
||||
return domId ? userInfo : Object.assign(Object.assign({}, userInfo), { isEnter: false }); // localUserInfo 没有 isEnter, remoteUserInfoList 有 isEnter
|
||||
}
|
||||
exports.setDefaultUserInfo = setDefaultUserInfo;
|
||||
// 获取个人用户信息
|
||||
function getMyProfile(myselfUserId, tim, TUIStore) {
|
||||
var _a, _b, _c;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let localUserInfo = setDefaultUserInfo(myselfUserId, index_1.NAME.LOCAL_VIDEO);
|
||||
try {
|
||||
if (!tim)
|
||||
return localUserInfo;
|
||||
const res = yield tim.getMyProfile();
|
||||
const currentLocalUserInfo = TUIStore === null || TUIStore === void 0 ? void 0 : TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); // localUserInfo may have been updated
|
||||
if ((res === null || res === void 0 ? void 0 : res.code) === 0) {
|
||||
localUserInfo = Object.assign(Object.assign(Object.assign({}, localUserInfo), currentLocalUserInfo), { userId: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.userID, nick: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.nick, avatar: (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.avatar });
|
||||
}
|
||||
return localUserInfo;
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`${index_1.NAME.PREFIX}getMyProfile failed, error: ${error}.`);
|
||||
return localUserInfo;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getMyProfile = getMyProfile;
|
||||
// 获取远端用户列表信息
|
||||
function getRemoteUserProfile(userIdList, tim, TUIStore) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let remoteUserInfoList = userIdList.map((userId) => setDefaultUserInfo(userId));
|
||||
try {
|
||||
if (!tim)
|
||||
return remoteUserInfoList;
|
||||
const res = yield tim.getFriendProfile({ userIDList: userIdList });
|
||||
if (res.code === 0) {
|
||||
const { friendList = [], failureUserIDList = [] } = res.data;
|
||||
let unFriendList = failureUserIDList.map((obj) => obj.userID);
|
||||
if (failureUserIDList.length > 0) {
|
||||
const res = yield tim.getUserProfile({ userIDList: failureUserIDList.map((obj) => obj.userID) });
|
||||
if ((res === null || res === void 0 ? void 0 : res.code) === 0) {
|
||||
unFriendList = (res === null || res === void 0 ? void 0 : res.data) || [];
|
||||
}
|
||||
}
|
||||
const currentRemoteUserInfoList = TUIStore === null || TUIStore === void 0 ? void 0 : TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST); // remoteUserInfoList may have been updated
|
||||
const tempFriendIdList = friendList.map((obj) => obj.userID);
|
||||
const tempUnFriendIdList = unFriendList.map((obj) => obj.userID);
|
||||
remoteUserInfoList = userIdList.map((userId) => {
|
||||
var _a, _b, _c, _d, _e, _f, _g;
|
||||
const defaultUserInfo = setDefaultUserInfo(userId);
|
||||
const friendListIndex = tempFriendIdList.indexOf(userId);
|
||||
const unFriendListIndex = tempUnFriendIdList.indexOf(userId);
|
||||
let remark = '';
|
||||
let nick = '';
|
||||
let displayUserInfo = '';
|
||||
let avatar = '';
|
||||
if (friendListIndex !== -1) {
|
||||
remark = ((_a = friendList[friendListIndex]) === null || _a === void 0 ? void 0 : _a.remark) || '';
|
||||
nick = ((_c = (_b = friendList[friendListIndex]) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.nick) || '';
|
||||
displayUserInfo = remark || nick || defaultUserInfo.userId || '';
|
||||
avatar = ((_e = (_d = friendList[friendListIndex]) === null || _d === void 0 ? void 0 : _d.profile) === null || _e === void 0 ? void 0 : _e.avatar) || '';
|
||||
}
|
||||
if (unFriendListIndex !== -1) {
|
||||
nick = ((_f = unFriendList[unFriendListIndex]) === null || _f === void 0 ? void 0 : _f.nick) || '';
|
||||
displayUserInfo = nick || defaultUserInfo.userId || '';
|
||||
avatar = ((_g = unFriendList[unFriendListIndex]) === null || _g === void 0 ? void 0 : _g.avatar) || '';
|
||||
}
|
||||
const userInfo = currentRemoteUserInfoList.find(subObj => subObj.userId === userId) || {};
|
||||
return Object.assign(Object.assign(Object.assign({}, defaultUserInfo), userInfo), { remark, nick, displayUserInfo, avatar });
|
||||
});
|
||||
}
|
||||
return remoteUserInfoList;
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`${index_1.NAME.PREFIX}getRemoteUserProfile failed, error: ${error}.`);
|
||||
return remoteUserInfoList;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getRemoteUserProfile = getRemoteUserProfile;
|
||||
// 生成弹框提示文案
|
||||
function generateText(TUIStore, key, prefix, suffix) {
|
||||
const isGroup = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.IS_GROUP);
|
||||
let callTips = `${(0, index_2.t)(key)}`;
|
||||
if (isGroup) {
|
||||
callTips = prefix ? `${prefix} ${callTips}` : callTips;
|
||||
callTips = suffix ? `${callTips} ${suffix}` : callTips;
|
||||
}
|
||||
return callTips;
|
||||
}
|
||||
exports.generateText = generateText;
|
||||
// 生成 statusChange 抛出的字符串
|
||||
function generateStatusChangeText(TUIStore) {
|
||||
const callStatus = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_STATUS);
|
||||
if (callStatus === index_1.CallStatus.IDLE) {
|
||||
return index_1.StatusChange.IDLE;
|
||||
}
|
||||
const isGroup = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.IS_GROUP);
|
||||
if (callStatus === index_1.CallStatus.CALLING) {
|
||||
return isGroup ? index_1.StatusChange.DIALING_GROUP : index_1.StatusChange.DIALING_C2C;
|
||||
}
|
||||
const callMediaType = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_MEDIA_TYPE);
|
||||
if (isGroup) {
|
||||
return callMediaType === index_1.CallMediaType.AUDIO ? index_1.StatusChange.CALLING_GROUP_AUDIO : index_1.StatusChange.CALLING_GROUP_VIDEO;
|
||||
}
|
||||
return callMediaType === index_1.CallMediaType.AUDIO ? index_1.StatusChange.CALLING_C2C_AUDIO : index_1.StatusChange.CALLING_C2C_VIDEO;
|
||||
}
|
||||
exports.generateStatusChangeText = generateStatusChangeText;
|
||||
// 获取群组[offset, count + offset]区间成员
|
||||
function getGroupMemberList(groupID, tim, count, offset) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let groupMemberList = [];
|
||||
try {
|
||||
const res = yield tim.getGroupMemberList({ groupID, count, offset });
|
||||
if (res.code === 0) {
|
||||
return res.data.memberList || groupMemberList;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`${index_1.NAME.PREFIX}getGroupMember failed, error: ${error}.`);
|
||||
return groupMemberList;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getGroupMemberList = getGroupMemberList;
|
||||
// 获取 IM 群信息
|
||||
function getGroupProfile(groupID, tim) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let groupProfile = {};
|
||||
try {
|
||||
const res = yield tim.getGroupProfile({ groupID });
|
||||
if (res.code === 0) {
|
||||
return res.data.group || groupProfile;
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(`${index_1.NAME.PREFIX}getGroupProfile failed, error: ${error}.`);
|
||||
return groupProfile;
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.getGroupProfile = getGroupProfile;
|
||||
Reference in New Issue
Block a user