集成融云
This commit is contained in:
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
85
.idea/workspace.xml
generated
Normal file
85
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fcbd9e13-46ae-4871-b6a6-f9012cc02ac4" name="更改" comment="1">
|
||||
<change beforePath="$PROJECT_DIR$/App.vue" beforeDir="false" afterPath="$PROJECT_DIR$/App.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/TUIKit/components/TUIChat/message-input-toolbar/call-view/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/TUIKit/components/TUIChat/message-input-toolbar/call-view/index.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/manifest.json" beforeDir="false" afterPath="$PROJECT_DIR$/manifest.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pages.json" beforeDir="false" afterPath="$PROJECT_DIR$/pages.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/stores/user.js" beforeDir="false" afterPath="$PROJECT_DIR$/stores/user.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/uni_modules/RongCloud-CallWrapper/lib/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/uni_modules/RongCloud-CallWrapper/lib/index.js" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="PUSH_TAGS">
|
||||
<GitPushTagMode>
|
||||
<option name="argument" value="--tags" />
|
||||
<option name="title" value="All" />
|
||||
</GitPushTagMode>
|
||||
</option>
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="master" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="39CgkMFHilJz3KjB9U6uRRYi97V" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"ts.external.directory.path": "D:\\Software\\developTool\\IntelliJ IDEA 2023.1\\plugins\\javascript-impl\\jsLanguageServicesImpl\\external",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="fcbd9e13-46ae-4871-b6a6-f9012cc02ac4" name="更改" comment="" />
|
||||
<created>1770205618468</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1770205618468</updated>
|
||||
<workItem from="1770205619734" duration="172000" />
|
||||
<workItem from="1770207280751" duration="89000" />
|
||||
<workItem from="1770218245313" duration="141000" />
|
||||
<workItem from="1770218395615" duration="626000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="1">
|
||||
<created>1770218264881</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1770218264881</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="1" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="1" />
|
||||
</component>
|
||||
</project>
|
||||
2
App.vue
2
App.vue
@@ -11,8 +11,6 @@
|
||||
|
||||
TUIChatKit.init()
|
||||
|
||||
|
||||
|
||||
const { token, tencentUserSig } = useAuthUser()
|
||||
const { loginTencentIM } = useUserStore()
|
||||
/** 静默登录逻辑 */
|
||||
|
||||
@@ -1,125 +1,125 @@
|
||||
<script setup lang="ts">
|
||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index.esm'
|
||||
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
||||
import custom from '../../../../assets/icon/telephone-icon.svg'
|
||||
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
||||
import { isUniFrameWork } from '../../../../utils/env'
|
||||
import { computed, ref } from 'vue'
|
||||
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index.esm'
|
||||
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
||||
import custom from '../../../../assets/icon/telephone-icon.svg'
|
||||
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
||||
import { isUniFrameWork } from '../../../../utils/env'
|
||||
import { computed, ref } from 'vue'
|
||||
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
||||
|
||||
CallLib.init({});
|
||||
// CallLib.init({});
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 通话状态: 0 语音 1 视频 */
|
||||
type?: '0' | '1'
|
||||
/** 信息数据 */
|
||||
currentConversation?: IConversationModel
|
||||
}>(),
|
||||
{
|
||||
type: '0',
|
||||
currentConversation: () => ({} as IConversationModel)
|
||||
}
|
||||
)
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 通话状态: 0 语音 1 视频 */
|
||||
type ?: '0' | '1'
|
||||
/** 信息数据 */
|
||||
currentConversation ?: IConversationModel
|
||||
}>(),
|
||||
{
|
||||
type: '0',
|
||||
currentConversation: () => ({} as IConversationModel)
|
||||
}
|
||||
)
|
||||
|
||||
/** 语音通话状态 */
|
||||
const isType = computed(() => props.type === '0')
|
||||
/** 语音通话状态 */
|
||||
const isType = computed(() => props.type === '0')
|
||||
|
||||
const evaluateIcon = isType.value ? custom : videoIcon
|
||||
const evaluateIcon = isType.value ? custom : videoIcon
|
||||
|
||||
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
||||
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
||||
|
||||
const container = ref()
|
||||
const closeDialog = () => {
|
||||
container?.value?.toggleDialogDisplay(false)
|
||||
}
|
||||
const container = ref()
|
||||
const closeDialog = () => {
|
||||
container?.value?.toggleDialogDisplay(false)
|
||||
}
|
||||
|
||||
const onDialogShow = () => {
|
||||
console.log('弹出窗口')
|
||||
console.log(props.currentConversation)
|
||||
emits('onDialogPopupShowOrHide', true)
|
||||
}
|
||||
const onDialogShow = () => {
|
||||
console.log('弹出窗口', isType.value)
|
||||
console.log("弹出窗口", props.currentConversation)
|
||||
let targetId = props.currentConversation.userProfile.userID
|
||||
// emits('onDialogPopupShowOrHide', true)
|
||||
callOut('single', isType.value ? 'audio' : 'video', targetId)
|
||||
}
|
||||
|
||||
const onDialogClose = () => {
|
||||
console.log('关闭窗口')
|
||||
emits('onDialogPopupShowOrHide', false)
|
||||
}
|
||||
function callOut(callSelect, mediaSelect, targetId) {
|
||||
console.log('callSelect: ',callSelect);
|
||||
console.log('mediaSelect: ',mediaSelect);
|
||||
console.log('targetId: ',targetId);
|
||||
//单聊音频
|
||||
if (callSelect === 'single' && mediaSelect === 'audio') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: "请输入对方ID",
|
||||
icon: "error",
|
||||
duration: 2000
|
||||
})
|
||||
return;
|
||||
}
|
||||
callMsg(mediaSelect, targetId, callSelect);
|
||||
} else if (callSelect === 'single' && mediaSelect === 'video') {
|
||||
if (targetId === '') {
|
||||
uni.showToast({
|
||||
title: "请输入对方ID",
|
||||
icon: "error",
|
||||
duration: 2000
|
||||
})
|
||||
return;
|
||||
}
|
||||
//单聊视频
|
||||
callMsg(mediaSelect, targetId, callSelect);
|
||||
}
|
||||
}
|
||||
|
||||
CallLib.onCallReceived(res => {
|
||||
console.log(res)
|
||||
console.log(
|
||||
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
|
||||
res.data.targetId
|
||||
)
|
||||
})
|
||||
function callMsg(mediaSelect,targetId,callSelect){
|
||||
console.log(targetId)
|
||||
console.log(mediaSelect)
|
||||
uni.setStorageSync('room-parameters', {
|
||||
callType: 'out',
|
||||
mediaType: mediaSelect,
|
||||
targetId: targetId,
|
||||
callSelect:callSelect
|
||||
});
|
||||
uni.navigateTo({
|
||||
url:'/pages/room/room'
|
||||
});
|
||||
}
|
||||
|
||||
CallLib.onCallConnected(res => {
|
||||
console.log(res)
|
||||
console.log(
|
||||
'Engine:OnCallConnected=>' +
|
||||
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
|
||||
res
|
||||
)
|
||||
})
|
||||
|
||||
CallLib.onRemoteUserJoined(res => {
|
||||
console.log(
|
||||
'Engine:OnRemoteUserJoined=>' +
|
||||
'主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
|
||||
res.data.userId
|
||||
)
|
||||
})
|
||||
const onDialogClose = () => {
|
||||
console.log('关闭窗口')
|
||||
emits('onDialogPopupShowOrHide', false)
|
||||
}
|
||||
|
||||
CallLib.onCallDisconnected(res => {
|
||||
console.log(
|
||||
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
|
||||
res.data.reason
|
||||
)
|
||||
})
|
||||
|
||||
const onDial = () => {
|
||||
const data = props.currentConversation.userProfile
|
||||
// data.userID
|
||||
CallLib.enableMicrophone(true)
|
||||
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
||||
}
|
||||
const onDial = () => {
|
||||
const data = props.currentConversation.userProfile
|
||||
// data.userID
|
||||
CallLib.enableMicrophone(true)
|
||||
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ToolbarItemContainer
|
||||
ref="container"
|
||||
needBottomPopup
|
||||
:iconFile="evaluateIcon"
|
||||
:iconWidth="isUniFrameWork ? '34px' : '20px'"
|
||||
:iconHeight="isUniFrameWork ? '34px' : '20px'"
|
||||
:title="isType ? '语音通话' : '视频通话'"
|
||||
@onDialogShow="onDialogShow"
|
||||
@onDialogClose="onDialogClose"
|
||||
>
|
||||
<view class="box-index">
|
||||
<view class="top-icon">
|
||||
<uni-icons
|
||||
type="back"
|
||||
color="#ffffff"
|
||||
size="42rpx"
|
||||
@click.stop="closeDialog"
|
||||
></uni-icons>
|
||||
</view>
|
||||
<ToolbarItemContainer ref="container" needBottomPopup :iconFile="evaluateIcon"
|
||||
:iconWidth="isUniFrameWork ? '34px' : '20px'" :iconHeight="isUniFrameWork ? '34px' : '20px'"
|
||||
:title="isType ? '语音通话' : '视频通话'" @onDialogShow="onDialogShow" @onDialogClose="onDialogClose">
|
||||
<view class="box-index">
|
||||
<view class="top-icon">
|
||||
<uni-icons type="back" color="#ffffff" size="42rpx" @click.stop="closeDialog"></uni-icons>
|
||||
</view>
|
||||
|
||||
<button @click.stop="onDial">拨打</button>
|
||||
<button @click.stop="onDial">拨打</button>
|
||||
|
||||
<button
|
||||
@click.stop="
|
||||
<button @click.stop="
|
||||
() => {
|
||||
CallLib.enableMicrophone(true)
|
||||
CallLib.accept()
|
||||
}
|
||||
"
|
||||
>
|
||||
接听
|
||||
</button>
|
||||
</view>
|
||||
</ToolbarItemContainer>
|
||||
">
|
||||
接听
|
||||
</button>
|
||||
</view>
|
||||
</ToolbarItemContainer>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss" src="./style/index.scss"></style>
|
||||
<style scoped lang="scss" src="./style/index.scss"></style>
|
||||
BIN
assets/developer-console-appkey.png
Normal file
BIN
assets/developer-console-appkey.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 383 KiB |
BIN
assets/phone.png
Normal file
BIN
assets/phone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
272
js_sdk/wa-permission/permission.js
Normal file
272
js_sdk/wa-permission/permission.js
Normal file
@@ -0,0 +1,272 @@
|
||||
/**
|
||||
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
|
||||
*/
|
||||
|
||||
var isIos
|
||||
// #ifdef APP-PLUS
|
||||
isIos = (plus.os.name == "iOS")
|
||||
// #endif
|
||||
|
||||
// 判断推送权限是否开启
|
||||
function judgeIosPermissionPush() {
|
||||
var result = false;
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var app = UIApplication.sharedApplication();
|
||||
var enabledTypes = 0;
|
||||
if (app.currentUserNotificationSettings) {
|
||||
var settings = app.currentUserNotificationSettings();
|
||||
enabledTypes = settings.plusGetAttribute("types");
|
||||
console.log("enabledTypes1:" + enabledTypes);
|
||||
if (enabledTypes == 0) {
|
||||
console.log("推送权限没有开启");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
plus.ios.deleteObject(settings);
|
||||
} else {
|
||||
enabledTypes = app.enabledRemoteNotificationTypes();
|
||||
if (enabledTypes == 0) {
|
||||
console.log("推送权限没有开启!");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("已经开启推送功能!")
|
||||
}
|
||||
console.log("enabledTypes2:" + enabledTypes);
|
||||
}
|
||||
plus.ios.deleteObject(app);
|
||||
plus.ios.deleteObject(UIApplication);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断定位权限是否开启
|
||||
function judgeIosPermissionLocation() {
|
||||
var result = false;
|
||||
var cllocationManger = plus.ios.import("CLLocationManager");
|
||||
var status = cllocationManger.authorizationStatus();
|
||||
result = (status != 2)
|
||||
console.log("定位权限开启:" + result);
|
||||
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
|
||||
/* var enable = cllocationManger.locationServicesEnabled();
|
||||
var status = cllocationManger.authorizationStatus();
|
||||
console.log("enable:" + enable);
|
||||
console.log("status:" + status);
|
||||
if (enable && status != 2) {
|
||||
result = true;
|
||||
console.log("手机定位服务已开启且已授予定位权限");
|
||||
} else {
|
||||
console.log("手机系统的定位没有打开或未给予定位权限");
|
||||
} */
|
||||
plus.ios.deleteObject(cllocationManger);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断麦克风权限是否开启
|
||||
function judgeIosPermissionRecord() {
|
||||
var result = false;
|
||||
var avaudiosession = plus.ios.import("AVAudioSession");
|
||||
var avaudio = avaudiosession.sharedInstance();
|
||||
var permissionStatus = avaudio.recordPermission();
|
||||
console.log("permissionStatus:" + permissionStatus);
|
||||
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
|
||||
console.log("麦克风权限没有开启");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("麦克风权限已经开启");
|
||||
}
|
||||
plus.ios.deleteObject(avaudiosession);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断相机权限是否开启
|
||||
function judgeIosPermissionCamera() {
|
||||
var result = false;
|
||||
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
|
||||
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
|
||||
console.log("authStatus:" + authStatus);
|
||||
if (authStatus == 3) {
|
||||
result = true;
|
||||
console.log("相机权限已经开启");
|
||||
} else {
|
||||
console.log("相机权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(AVCaptureDevice);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断相册权限是否开启
|
||||
function judgeIosPermissionPhotoLibrary() {
|
||||
var result = false;
|
||||
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
|
||||
var authStatus = PHPhotoLibrary.authorizationStatus();
|
||||
console.log("authStatus:" + authStatus);
|
||||
if (authStatus == 3) {
|
||||
result = true;
|
||||
console.log("相册权限已经开启");
|
||||
} else {
|
||||
console.log("相册权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(PHPhotoLibrary);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断通讯录权限是否开启
|
||||
function judgeIosPermissionContact() {
|
||||
var result = false;
|
||||
var CNContactStore = plus.ios.import("CNContactStore");
|
||||
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
|
||||
if (cnAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("通讯录权限已经开启");
|
||||
} else {
|
||||
console.log("通讯录权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(CNContactStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断日历权限是否开启
|
||||
function judgeIosPermissionCalendar() {
|
||||
var result = false;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("日历权限已经开启");
|
||||
} else {
|
||||
console.log("日历权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 判断备忘录权限是否开启
|
||||
function judgeIosPermissionMemo() {
|
||||
var result = false;
|
||||
var EKEventStore = plus.ios.import("EKEventStore");
|
||||
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
|
||||
if (ekAuthStatus == 3) {
|
||||
result = true;
|
||||
console.log("备忘录权限已经开启");
|
||||
} else {
|
||||
console.log("备忘录权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(EKEventStore);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Android权限查询
|
||||
function requestAndroidPermission(permissionID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.android.requestPermissions(
|
||||
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
|
||||
function(resultObj) {
|
||||
var result = 0;
|
||||
for (var i = 0; i < resultObj.granted.length; i++) {
|
||||
var grantedPermission = resultObj.granted[i];
|
||||
console.log('已获取的权限:' + grantedPermission);
|
||||
result = 1
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
|
||||
var deniedPresentPermission = resultObj.deniedPresent[i];
|
||||
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
|
||||
result = 0
|
||||
}
|
||||
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
|
||||
var deniedAlwaysPermission = resultObj.deniedAlways[i];
|
||||
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
|
||||
result = -1
|
||||
}
|
||||
resolve(result);
|
||||
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
|
||||
// if (result != 1) {
|
||||
// gotoAppPermissionSetting()
|
||||
// }
|
||||
},
|
||||
function(error) {
|
||||
console.log('申请权限错误:' + error.code + " = " + error.message);
|
||||
resolve({
|
||||
code: error.code,
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// 使用一个方法,根据参数判断权限
|
||||
function judgeIosPermission(permissionID) {
|
||||
if (permissionID == "location") {
|
||||
return judgeIosPermissionLocation()
|
||||
} else if (permissionID == "camera") {
|
||||
return judgeIosPermissionCamera()
|
||||
} else if (permissionID == "photoLibrary") {
|
||||
return judgeIosPermissionPhotoLibrary()
|
||||
} else if (permissionID == "record") {
|
||||
return judgeIosPermissionRecord()
|
||||
} else if (permissionID == "push") {
|
||||
return judgeIosPermissionPush()
|
||||
} else if (permissionID == "contact") {
|
||||
return judgeIosPermissionContact()
|
||||
} else if (permissionID == "calendar") {
|
||||
return judgeIosPermissionCalendar()
|
||||
} else if (permissionID == "memo") {
|
||||
return judgeIosPermissionMemo()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 跳转到**应用**的权限页面
|
||||
function gotoAppPermissionSetting() {
|
||||
if (isIos) {
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var application2 = UIApplication.sharedApplication();
|
||||
var NSURL2 = plus.ios.import("NSURL");
|
||||
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
|
||||
var setting2 = NSURL2.URLWithString("app-settings:");
|
||||
application2.openURL(setting2);
|
||||
|
||||
plus.ios.deleteObject(setting2);
|
||||
plus.ios.deleteObject(NSURL2);
|
||||
plus.ios.deleteObject(application2);
|
||||
} else {
|
||||
// console.log(plus.device.vendor);
|
||||
var Intent = plus.android.importClass("android.content.Intent");
|
||||
var Settings = plus.android.importClass("android.provider.Settings");
|
||||
var Uri = plus.android.importClass("android.net.Uri");
|
||||
var mainActivity = plus.android.runtimeMainActivity();
|
||||
var intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
mainActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查系统的设备服务是否开启
|
||||
// var checkSystemEnableLocation = async function () {
|
||||
function checkSystemEnableLocation() {
|
||||
if (isIos) {
|
||||
var result = false;
|
||||
var cllocationManger = plus.ios.import("CLLocationManager");
|
||||
var result = cllocationManger.locationServicesEnabled();
|
||||
console.log("系统定位开启:" + result);
|
||||
plus.ios.deleteObject(cllocationManger);
|
||||
return result;
|
||||
} else {
|
||||
var context = plus.android.importClass("android.content.Context");
|
||||
var locationManager = plus.android.importClass("android.location.LocationManager");
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
|
||||
var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
|
||||
console.log("系统定位开启:" + result);
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
judgeIosPermission: judgeIosPermission,
|
||||
requestAndroidPermission: requestAndroidPermission,
|
||||
checkSystemEnableLocation: checkSystemEnableLocation,
|
||||
gotoAppPermissionSetting: gotoAppPermissionSetting
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "密谈IM",
|
||||
"appid" : "__UNI__D40A151",
|
||||
"appid" : "__UNI__BE00EFC",
|
||||
"description" : "",
|
||||
"versionName" : "1.1.2",
|
||||
"versionCode" : 111,
|
||||
@@ -139,6 +139,20 @@
|
||||
"pid" : "9227",
|
||||
"parameters" : {}
|
||||
}
|
||||
},
|
||||
"RongCloud-Beauty" : {
|
||||
"__plugin_info__" : {
|
||||
"name" : "RCUniBeauty",
|
||||
"description" : "融云基础版美颜插件,服务于 RCUniRtc 或 RCUniCall",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "https://ext.dcloud.net.cn/plugin?id=7982",
|
||||
"android_package_name" : "com.audio.im",
|
||||
"ios_bundle_id" : "",
|
||||
"isCloud" : true,
|
||||
"bought" : 1,
|
||||
"pid" : "7982",
|
||||
"parameters" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
11
pages.json
11
pages.json
@@ -435,6 +435,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/room/room",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "Room",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle":"custom",
|
||||
"gestureBack":"NO"
|
||||
}
|
||||
|
||||
},
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
{
|
||||
|
||||
508
stores/user.js
508
stores/user.js
@@ -1,230 +1,334 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {
|
||||
getToken,
|
||||
getUserInfoData,
|
||||
setUserInfoData,
|
||||
removeUserInfoData,
|
||||
getSig,
|
||||
setSig,
|
||||
removeSig,
|
||||
getFontSize,
|
||||
setFontSize,
|
||||
removeFontSize
|
||||
defineStore
|
||||
} from 'pinia'
|
||||
import {
|
||||
getToken,
|
||||
getUserInfoData,
|
||||
setUserInfoData,
|
||||
removeUserInfoData,
|
||||
getSig,
|
||||
setSig,
|
||||
removeSig,
|
||||
getFontSize,
|
||||
setFontSize,
|
||||
removeFontSize
|
||||
} from '@/utils/storage'
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
import { useLoginState } from '@/uni_modules/tuikit-atomic-x/state/LoginState'
|
||||
import {
|
||||
useLoginState
|
||||
} from '@/uni_modules/tuikit-atomic-x/state/LoginState'
|
||||
import * as CallLib from "@/uni_modules/RongCloud-CallWrapper/lib/index"
|
||||
import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine'
|
||||
import permision from "@/js_sdk/wa-permission/permission.js"
|
||||
import {reasonDeal,errorDeal,imCode} from '@/utils/code.js'
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
import { useLoginState } from 'tuikit-atomicx-vue3'
|
||||
import {
|
||||
useLoginState
|
||||
} from 'tuikit-atomicx-vue3'
|
||||
// #endif
|
||||
import { useTokenStore } from './token'
|
||||
import { getUserData, userLogout, updateUserData } from '@/api'
|
||||
import { ref } from 'vue'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { reLaunch } from '@/utils/router'
|
||||
import { getTencentUserSig } from '@/api'
|
||||
import { TUILogin } from '@tencentcloud/tui-core-lite'
|
||||
import { TUIChatEngine } from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import { getUserIntegral } from '@/api/my-index'
|
||||
import { removeFriendList, removeGroupList } from '../utils/storage'
|
||||
import { getRongYunLoginInfo } from '../api'
|
||||
import {
|
||||
useTokenStore
|
||||
} from './token'
|
||||
import {
|
||||
getUserData,
|
||||
userLogout,
|
||||
updateUserData
|
||||
} from '@/api'
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
useUI
|
||||
} from '@/utils/use-ui'
|
||||
import {
|
||||
reLaunch
|
||||
} from '@/utils/router'
|
||||
import {
|
||||
getTencentUserSig
|
||||
} from '@/api'
|
||||
import {
|
||||
TUILogin
|
||||
} from '@tencentcloud/tui-core-lite'
|
||||
import {
|
||||
TUIChatEngine
|
||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import {
|
||||
getUserIntegral
|
||||
} from '@/api/my-index'
|
||||
import {
|
||||
removeFriendList,
|
||||
removeGroupList
|
||||
} from '../utils/storage'
|
||||
import {
|
||||
getRongYunLoginInfo
|
||||
} from '../api'
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const { clearToken } = useTokenStore()
|
||||
const { showDialog, showToast } = useUI()
|
||||
const {
|
||||
clearToken
|
||||
} = useTokenStore()
|
||||
const {
|
||||
showDialog,
|
||||
showToast
|
||||
} = useUI()
|
||||
|
||||
const userInfo = ref(
|
||||
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
|
||||
)
|
||||
/** 用户字体大小 */
|
||||
const fontSizeData = ref(getFontSize())
|
||||
const userInfo = ref(
|
||||
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
|
||||
)
|
||||
/** 用户字体大小 */
|
||||
const fontSizeData = ref(getFontSize())
|
||||
|
||||
/** 腾讯 IM 存储数据 */
|
||||
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
|
||||
/** 腾讯 IM 存储数据 */
|
||||
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
|
||||
|
||||
/** 用户积分数 */
|
||||
const integralData = ref(0)
|
||||
/** 用户积分数 */
|
||||
const integralData = ref(0)
|
||||
const imEngine = ref(null)
|
||||
|
||||
/**
|
||||
* 获取用户信息(可从缓存或接口)
|
||||
*/
|
||||
const fetchUserInfo = async () => {
|
||||
// 尝试从本地缓存读取
|
||||
const cachedToken = getToken()
|
||||
const cachedUserInfo = getUserInfoData()
|
||||
const cachedSig = getSig()
|
||||
/**
|
||||
* 获取用户信息(可从缓存或接口)
|
||||
*/
|
||||
const fetchUserInfo = async () => {
|
||||
// 尝试从本地缓存读取
|
||||
const cachedToken = getToken()
|
||||
const cachedUserInfo = getUserInfoData()
|
||||
const cachedSig = getSig()
|
||||
|
||||
if (cachedToken && cachedUserInfo) {
|
||||
userInfo.value = JSON.parse(cachedUserInfo)
|
||||
tencentUserSig.value = JSON.parse(cachedSig)
|
||||
loginTencentIM()
|
||||
return
|
||||
}
|
||||
await getIntegral()
|
||||
const res = await getUserData()
|
||||
await setUserInfo(res.data)
|
||||
loginTencentIM()
|
||||
return
|
||||
}
|
||||
if (cachedToken && cachedUserInfo) {
|
||||
userInfo.value = JSON.parse(cachedUserInfo)
|
||||
tencentUserSig.value = JSON.parse(cachedSig)
|
||||
loginTencentIM()
|
||||
return
|
||||
}
|
||||
await getIntegral()
|
||||
const res = await getUserData()
|
||||
await setUserInfo(res.data)
|
||||
loginTencentIM()
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置用户信息
|
||||
*/
|
||||
const setUserInfo = async data => {
|
||||
const res = await getTencentUserSig()
|
||||
const ryData = await getRongYunLoginInfo()
|
||||
const IM_DATA = {
|
||||
...res.data,
|
||||
...ryData.data
|
||||
}
|
||||
tencentUserSig.value = IM_DATA
|
||||
userInfo.value = data
|
||||
setUserInfoData(data)
|
||||
setSig(IM_DATA)
|
||||
}
|
||||
/**
|
||||
* 设置用户信息
|
||||
*/
|
||||
const setUserInfo = async data => {
|
||||
const res = await getTencentUserSig()
|
||||
const ryData = await getRongYunLoginInfo()
|
||||
const IM_DATA = {
|
||||
...res.data,
|
||||
...ryData.data
|
||||
}
|
||||
tencentUserSig.value = IM_DATA
|
||||
userInfo.value = data
|
||||
setUserInfoData(data)
|
||||
setSig(IM_DATA)
|
||||
}
|
||||
|
||||
/** 获取用户积分 */
|
||||
const getIntegral = async () => {
|
||||
const res = await getUserIntegral()
|
||||
integralData.value = res.data.availablePoints
|
||||
}
|
||||
/** 获取用户积分 */
|
||||
const getIntegral = async () => {
|
||||
const res = await getUserIntegral()
|
||||
integralData.value = res.data.availablePoints
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录腾讯 IM
|
||||
*/
|
||||
const loginTencentIM = async () => {
|
||||
await refreshUserInfo()
|
||||
await TUILogin.login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig,
|
||||
framework: `vue3`
|
||||
})
|
||||
/**
|
||||
* 登录腾讯 IM
|
||||
*/
|
||||
const loginTencentIM = async () => {
|
||||
await refreshUserInfo()
|
||||
await TUILogin.login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig,
|
||||
framework: `vue3`
|
||||
})
|
||||
|
||||
await TUIChatEngine.login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig,
|
||||
useUploadPlugin: true // 使用文件上传插件
|
||||
})
|
||||
// #ifdef H5
|
||||
await useLoginState().login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig
|
||||
})
|
||||
// #endif
|
||||
await TUIChatEngine.login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig,
|
||||
useUploadPlugin: true // 使用文件上传插件
|
||||
})
|
||||
// #ifdef H5
|
||||
await useLoginState().login({
|
||||
SDKAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
await useLoginState().login({
|
||||
sdkAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig
|
||||
})
|
||||
console.log(tencentUserSig.value.appKey, '====')
|
||||
await RCIMIWEngine.create(tencentUserSig.value.appKey, {
|
||||
kickReconnectDevice: true,
|
||||
logLevel: 'debug'
|
||||
}).then(
|
||||
res => {
|
||||
//本地代码保存引擎
|
||||
console.log(res, '====')
|
||||
}
|
||||
).catch(err => {
|
||||
console.log(err, '====')
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
await useLoginState().login({
|
||||
sdkAppID: tencentUserSig.value.sdkappID,
|
||||
userID: tencentUserSig.value.userId,
|
||||
userSig: tencentUserSig.value.userSig
|
||||
})
|
||||
console.log(tencentUserSig.value.appKey, '====')
|
||||
connectIM()
|
||||
// #endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除用户信息(退出登录)
|
||||
*/
|
||||
const clearUserInfo = async () => {
|
||||
const show = await showDialog('提示', '确定要退出登录吗?')
|
||||
if (show) {
|
||||
await logout()
|
||||
}
|
||||
}
|
||||
//连接融云IM
|
||||
async function connectIM() {
|
||||
const options = {
|
||||
naviServer: ''
|
||||
}
|
||||
imEngine.value = await RCIMIWEngine.create(tencentUserSig.value.appKey, options)
|
||||
imEngine.value.setOnConnectedListener((res) => {
|
||||
if (res.code != 0) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: 'OnCon:' + res.code,
|
||||
icon: 'error'
|
||||
})
|
||||
return
|
||||
}
|
||||
//连接成功
|
||||
CallLib.init({});
|
||||
onAllListeners()
|
||||
console.log('call.init')
|
||||
// this.libPage = true;
|
||||
// this.loginUserId = res.userId;
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res.userId
|
||||
});
|
||||
if (uni.getSystemInfoSync().platform === 'android') {
|
||||
permision.requestAndroidPermission('android.permission.CAMERA');
|
||||
permision.requestAndroidPermission('android.permission.RECORD_AUDIO');
|
||||
}
|
||||
});
|
||||
let code = await imEngine.value.connect(tencentUserSig.value.ryToken, 10)
|
||||
if (code != 0) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: 'connect:' + code,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function onAllListeners(){
|
||||
CallLib.onCallReceived(res => {
|
||||
console.log(res)
|
||||
console.log(
|
||||
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
|
||||
res.data.targetId
|
||||
)
|
||||
})
|
||||
|
||||
CallLib.onCallConnected(res => {
|
||||
console.log(res)
|
||||
console.log(
|
||||
'Engine:OnCallConnected=>' +
|
||||
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
|
||||
res
|
||||
)
|
||||
})
|
||||
|
||||
CallLib.onRemoteUserJoined(res => {
|
||||
console.log(
|
||||
'Engine:OnRemoteUserJoined=>' +
|
||||
'主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
|
||||
res.data.userId
|
||||
)
|
||||
})
|
||||
|
||||
CallLib.onCallDisconnected(res => {
|
||||
console.log(
|
||||
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
|
||||
res.data.reason
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录(不带提示)
|
||||
*/
|
||||
const logout = async () => {
|
||||
if (!userInfo.value) return
|
||||
try {
|
||||
userInfo.value = null
|
||||
/**
|
||||
* 清除用户信息(退出登录)
|
||||
*/
|
||||
const clearUserInfo = async () => {
|
||||
const show = await showDialog('提示', '确定要退出登录吗?')
|
||||
if (show) {
|
||||
await logout()
|
||||
}
|
||||
}
|
||||
|
||||
await userLogout()
|
||||
await TUILogin.logout()
|
||||
await TUIChatEngine.logout()
|
||||
// #ifdef APP-PLUS
|
||||
removeFriendList()
|
||||
removeGroupList()
|
||||
await useLoginState().logout()
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
await useLoginState().logout()
|
||||
// #endif
|
||||
clearAllUserInfo()
|
||||
await showToast('退出登录成功', 'success')
|
||||
reLaunch('/pages/login/login')
|
||||
} catch (error) {
|
||||
clearAllUserInfo()
|
||||
await showToast('退出登录成功', 'success')
|
||||
reLaunch('/pages/login/login')
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 退出登录(不带提示)
|
||||
*/
|
||||
const logout = async () => {
|
||||
if (!userInfo.value) return
|
||||
try {
|
||||
userInfo.value = null
|
||||
|
||||
/** 清空所有用户缓存 */
|
||||
const clearAllUserInfo = async () => {
|
||||
userInfo.value = null
|
||||
tencentUserSig.value = null
|
||||
fontSizeData.value = 26
|
||||
clearToken()
|
||||
removeUserInfoData()
|
||||
removeSig()
|
||||
removeFontSize()
|
||||
}
|
||||
await userLogout()
|
||||
await TUILogin.logout()
|
||||
await TUIChatEngine.logout()
|
||||
// #ifdef APP-PLUS
|
||||
removeFriendList()
|
||||
removeGroupList()
|
||||
await useLoginState().logout()
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
await useLoginState().logout()
|
||||
// #endif
|
||||
clearAllUserInfo()
|
||||
await showToast('退出登录成功', 'success')
|
||||
reLaunch('/pages/login/login')
|
||||
} catch (error) {
|
||||
clearAllUserInfo()
|
||||
await showToast('退出登录成功', 'success')
|
||||
reLaunch('/pages/login/login')
|
||||
}
|
||||
}
|
||||
|
||||
/** 刷新用户信息(如用户信息被修改) */
|
||||
const refreshUserInfo = async () => {
|
||||
const res = await getUserData()
|
||||
await getIntegral()
|
||||
await setUserInfoData(res.data)
|
||||
userInfo.value = res.data
|
||||
}
|
||||
/** 清空所有用户缓存 */
|
||||
const clearAllUserInfo = async () => {
|
||||
userInfo.value = null
|
||||
tencentUserSig.value = null
|
||||
fontSizeData.value = 26
|
||||
clearToken()
|
||||
removeUserInfoData()
|
||||
removeSig()
|
||||
removeFontSize()
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新部分用户信息(例如昵称、头像)
|
||||
*/
|
||||
const updateUserInfo = async partialData => {
|
||||
if (!userInfo.value) return
|
||||
await updateUserData(partialData)
|
||||
await refreshUserInfo()
|
||||
}
|
||||
/** 刷新用户信息(如用户信息被修改) */
|
||||
const refreshUserInfo = async () => {
|
||||
const res = await getUserData()
|
||||
await getIntegral()
|
||||
await setUserInfoData(res.data)
|
||||
userInfo.value = res.data
|
||||
}
|
||||
|
||||
/** 更新字体大小 */
|
||||
const updateFontSize = async fontSize => {
|
||||
fontSizeData.value = fontSize
|
||||
setFontSize(fontSize)
|
||||
}
|
||||
/**
|
||||
* 更新部分用户信息(例如昵称、头像)
|
||||
*/
|
||||
const updateUserInfo = async partialData => {
|
||||
if (!userInfo.value) return
|
||||
await updateUserData(partialData)
|
||||
await refreshUserInfo()
|
||||
}
|
||||
|
||||
return {
|
||||
userInfo,
|
||||
integralData,
|
||||
tencentUserSig,
|
||||
fontSizeData,
|
||||
getIntegral,
|
||||
clearAllUserInfo,
|
||||
updateFontSize,
|
||||
logout,
|
||||
refreshUserInfo,
|
||||
fetchUserInfo,
|
||||
loginTencentIM,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
updateUserInfo
|
||||
}
|
||||
})
|
||||
/** 更新字体大小 */
|
||||
const updateFontSize = async fontSize => {
|
||||
fontSizeData.value = fontSize
|
||||
setFontSize(fontSize)
|
||||
}
|
||||
|
||||
return {
|
||||
userInfo,
|
||||
integralData,
|
||||
tencentUserSig,
|
||||
fontSizeData,
|
||||
getIntegral,
|
||||
clearAllUserInfo,
|
||||
updateFontSize,
|
||||
logout,
|
||||
refreshUserInfo,
|
||||
fetchUserInfo,
|
||||
loginTencentIM,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
updateUserInfo
|
||||
}
|
||||
})
|
||||
@@ -4,9 +4,6 @@
|
||||
* Tue Dec 02 2025 16:50:41 GMT+0800 (China Standard Time)
|
||||
* ©2020 RongCloud, Inc. All rights reserved.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
class Logger {
|
||||
tag;
|
||||
@@ -18,417 +15,391 @@ class Logger {
|
||||
log(str) {
|
||||
console.log(`[${this.tag}] ${new Date().toISOString()} ${str}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const logger = new Logger('RCUNICallLib');
|
||||
|
||||
exports.RCCallIWCamera = void 0;
|
||||
// 枚举定义
|
||||
export const RCCallIWCamera = {
|
||||
NONE: 0,
|
||||
FRONT: 1,
|
||||
BACK: 2
|
||||
};
|
||||
|
||||
(function (RCCallIWCamera) {
|
||||
RCCallIWCamera[RCCallIWCamera["NONE"] = 0] = "NONE";
|
||||
RCCallIWCamera[RCCallIWCamera["FRONT"] = 1] = "FRONT";
|
||||
RCCallIWCamera[RCCallIWCamera["BACK"] = 2] = "BACK";
|
||||
})(exports.RCCallIWCamera || (exports.RCCallIWCamera = {}));
|
||||
export const RCCallIWMediaType = {
|
||||
AUDIO: 0,
|
||||
AUDIO_VIDEO: 1
|
||||
};
|
||||
|
||||
exports.RCCallIWMediaType = void 0;
|
||||
export const RCUNICallErrorCode = {
|
||||
SUCCESS: 0,
|
||||
ENGINE_NOT_FOUND: 1,
|
||||
NETWORK_UNAVAILABLE: 2,
|
||||
ONE_CALL_EXISTED: 3,
|
||||
OPERATION_UNAVAILABLE: 4,
|
||||
INVALID_PARAM: 5,
|
||||
NETWORK_UNSTABLE: 6,
|
||||
MEDIA_REQUEST_FAILED: 7,
|
||||
MEDIA_SERVER_NOT_READY: 8,
|
||||
MEDIA_SERVER_NOT_INITIALIZED: 9,
|
||||
MEDIA_REQUEST_TIMEOUT: 10,
|
||||
MEDIA_UNKOWN_ERROR: 11,
|
||||
MEDIA_KICKED_BY_SERVER_ERROR: 12,
|
||||
MEDIA_SERVER_CLOSED_ERROR: 13,
|
||||
MEDIA_SERVER_PUBLISH_ERROR: 14,
|
||||
MEDIA_SERVER_SUBSCRIBE_ERROR: 15,
|
||||
MEDIA_JOIN_ROOM_REFUSE_ERROR: 16
|
||||
};
|
||||
|
||||
(function (RCCallIWMediaType) {
|
||||
RCCallIWMediaType[RCCallIWMediaType["AUDIO"] = 0] = "AUDIO";
|
||||
RCCallIWMediaType[RCCallIWMediaType["AUDIO_VIDEO"] = 1] = "AUDIO_VIDEO";
|
||||
})(exports.RCCallIWMediaType || (exports.RCCallIWMediaType = {}));
|
||||
export const RCCallIWCallDisconnectedReason = {
|
||||
CANCEL: 0,
|
||||
REJECT: 1,
|
||||
HANGUP: 2,
|
||||
BUSY_LINE: 3,
|
||||
NO_RESPONSE: 4,
|
||||
ENGINE_UNSUPPORTED: 5,
|
||||
NETWORK_ERROR: 6,
|
||||
RESOURCE_GET_ERROR: 7,
|
||||
RESOURCE_PUBLISH_ERROR: 8,
|
||||
RESOURCE_SUBSCRIBE_ERROR: 9,
|
||||
REMOTE_CANCEL: 10,
|
||||
REMOTE_REJECT: 11,
|
||||
REMOTE_HANGUP: 12,
|
||||
REMOTE_BUSY_LINE: 13,
|
||||
REMOTE_NO_RESPONSE: 14,
|
||||
REMOTE_ENGINE_UNSUPPORTED: 15,
|
||||
REMOTE_NETWORK_ERROR: 16,
|
||||
REMOTE_RESOURCE_GET_ERROR: 17,
|
||||
REMOTE_RESOURCE_PUBLISH_ERROR: 18,
|
||||
REMOTE_RESOURCE_SUBSCRIBE_ERROR: 19,
|
||||
KICKED_BY_OTHER_CALL: 20,
|
||||
IN_OTHER_CALL: 21,
|
||||
KICKED_BY_SERVER: 22,
|
||||
REMOTE_KICKED_BY_OTHER_CALL: 23,
|
||||
REMOTE_IN_OTHER_CALL: 24,
|
||||
REMOTE_KICKED_BY_SERVER: 25,
|
||||
ACCEPT_BY_OTHER_CLIENT: 26,
|
||||
HANGUP_BY_OTHER_CLIENT: 27,
|
||||
REJECTED_BY_BLACKLIST: 28,
|
||||
SERVICE_NOT_OPENED: 29,
|
||||
DROP_TO_OBSERVER: 30,
|
||||
INIT_VIDEO_ERROR: 31,
|
||||
OTHER_DEVICE_HAD_ACCEPTED: 32,
|
||||
SERVICE_DISCONNECTED: 33
|
||||
};
|
||||
|
||||
exports.RCUNICallErrorCode = void 0;
|
||||
export const RCCallIWAudioCodecType = {
|
||||
PCMU: 0,
|
||||
OPUS: 111
|
||||
};
|
||||
|
||||
(function (RCUNICallErrorCode) {
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["SUCCESS"] = 0] = "SUCCESS";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["ENGINE_NOT_FOUND"] = 1] = "ENGINE_NOT_FOUND";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["NETWORK_UNAVAILABLE"] = 2] = "NETWORK_UNAVAILABLE";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["ONE_CALL_EXISTED"] = 3] = "ONE_CALL_EXISTED";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["OPERATION_UNAVAILABLE"] = 4] = "OPERATION_UNAVAILABLE";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["INVALID_PARAM"] = 5] = "INVALID_PARAM";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["NETWORK_UNSTABLE"] = 6] = "NETWORK_UNSTABLE";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_REQUEST_FAILED"] = 7] = "MEDIA_REQUEST_FAILED";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_NOT_READY"] = 8] = "MEDIA_SERVER_NOT_READY";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_NOT_INITIALIZED"] = 9] = "MEDIA_SERVER_NOT_INITIALIZED";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_REQUEST_TIMEOUT"] = 10] = "MEDIA_REQUEST_TIMEOUT";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_UNKOWN_ERROR"] = 11] = "MEDIA_UNKOWN_ERROR";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_KICKED_BY_SERVER_ERROR"] = 12] = "MEDIA_KICKED_BY_SERVER_ERROR";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_CLOSED_ERROR"] = 13] = "MEDIA_SERVER_CLOSED_ERROR";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_PUBLISH_ERROR"] = 14] = "MEDIA_SERVER_PUBLISH_ERROR";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_SERVER_SUBSCRIBE_ERROR"] = 15] = "MEDIA_SERVER_SUBSCRIBE_ERROR";
|
||||
RCUNICallErrorCode[RCUNICallErrorCode["MEDIA_JOIN_ROOM_REFUSE_ERROR"] = 16] = "MEDIA_JOIN_ROOM_REFUSE_ERROR";
|
||||
})(exports.RCUNICallErrorCode || (exports.RCUNICallErrorCode = {}));
|
||||
export const RCCallIWAudioSource = {
|
||||
DEFAULT: 0,
|
||||
MIC: 1,
|
||||
VOICE_UPLINK: 2,
|
||||
VOICE_DOWNLINK: 3,
|
||||
VOICE_CALL: 4,
|
||||
CAMCORDER: 5,
|
||||
VOICE_RECOGNITION: 6,
|
||||
VOICE_COMMUNICATION: 7
|
||||
};
|
||||
|
||||
exports.RCCallIWCallDisconnectedReason = void 0;
|
||||
export const RCCallIWVideoProfile = {
|
||||
PROFILE_144_256: 0,
|
||||
PROFILE_240_240: 1,
|
||||
PROFILE_240_320: 2,
|
||||
PROFILE_360_480: 3,
|
||||
PROFILE_360_640: 4,
|
||||
PROFILE_480_640: 5,
|
||||
PROFILE_480_720: 6,
|
||||
PROFILE_720_1280: 7,
|
||||
PROFILE_1080_1920: 8,
|
||||
PROFILE_144_256_HIGH: 9,
|
||||
PROFILE_240_240_HIGH: 10,
|
||||
PROFILE_240_320_HIGH: 11,
|
||||
PROFILE_360_480_HIGH: 12,
|
||||
PROFILE_360_640_HIGH: 13,
|
||||
PROFILE_480_640_HIGH: 14,
|
||||
PROFILE_480_720_HIGH: 15,
|
||||
PROFILE_720_1280_HIGH: 16,
|
||||
PROFILE_1080_1920_HIGH: 17
|
||||
};
|
||||
|
||||
(function (RCCallIWCallDisconnectedReason) {
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["CANCEL"] = 0] = "CANCEL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REJECT"] = 1] = "REJECT";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["HANGUP"] = 2] = "HANGUP";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["BUSY_LINE"] = 3] = "BUSY_LINE";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["NO_RESPONSE"] = 4] = "NO_RESPONSE";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["ENGINE_UNSUPPORTED"] = 5] = "ENGINE_UNSUPPORTED";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["NETWORK_ERROR"] = 6] = "NETWORK_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_GET_ERROR"] = 7] = "RESOURCE_GET_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_PUBLISH_ERROR"] = 8] = "RESOURCE_PUBLISH_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["RESOURCE_SUBSCRIBE_ERROR"] = 9] = "RESOURCE_SUBSCRIBE_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_CANCEL"] = 10] = "REMOTE_CANCEL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_REJECT"] = 11] = "REMOTE_REJECT";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_HANGUP"] = 12] = "REMOTE_HANGUP";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_BUSY_LINE"] = 13] = "REMOTE_BUSY_LINE";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_NO_RESPONSE"] = 14] = "REMOTE_NO_RESPONSE";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_ENGINE_UNSUPPORTED"] = 15] = "REMOTE_ENGINE_UNSUPPORTED";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_NETWORK_ERROR"] = 16] = "REMOTE_NETWORK_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_GET_ERROR"] = 17] = "REMOTE_RESOURCE_GET_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_PUBLISH_ERROR"] = 18] = "REMOTE_RESOURCE_PUBLISH_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_RESOURCE_SUBSCRIBE_ERROR"] = 19] = "REMOTE_RESOURCE_SUBSCRIBE_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["KICKED_BY_OTHER_CALL"] = 20] = "KICKED_BY_OTHER_CALL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["IN_OTHER_CALL"] = 21] = "IN_OTHER_CALL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["KICKED_BY_SERVER"] = 22] = "KICKED_BY_SERVER";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_KICKED_BY_OTHER_CALL"] = 23] = "REMOTE_KICKED_BY_OTHER_CALL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_IN_OTHER_CALL"] = 24] = "REMOTE_IN_OTHER_CALL";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REMOTE_KICKED_BY_SERVER"] = 25] = "REMOTE_KICKED_BY_SERVER";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["ACCEPT_BY_OTHER_CLIENT"] = 26] = "ACCEPT_BY_OTHER_CLIENT";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["HANGUP_BY_OTHER_CLIENT"] = 27] = "HANGUP_BY_OTHER_CLIENT";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["REJECTED_BY_BLACKLIST"] = 28] = "REJECTED_BY_BLACKLIST";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["SERVICE_NOT_OPENED"] = 29] = "SERVICE_NOT_OPENED";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["DROP_TO_OBSERVER"] = 30] = "DROP_TO_OBSERVER";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["INIT_VIDEO_ERROR"] = 31] = "INIT_VIDEO_ERROR";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["OTHER_DEVICE_HAD_ACCEPTED"] = 32] = "OTHER_DEVICE_HAD_ACCEPTED";
|
||||
RCCallIWCallDisconnectedReason[RCCallIWCallDisconnectedReason["SERVICE_DISCONNECTED"] = 33] = "SERVICE_DISCONNECTED";
|
||||
})(exports.RCCallIWCallDisconnectedReason || (exports.RCCallIWCallDisconnectedReason = {}));
|
||||
export const RCCallIWCameraOrientation = {
|
||||
PORTRAIT: 0,
|
||||
PORTRAIT_UPSIDE_DOWN: 1,
|
||||
LANDSCAPE_RIGHT: 2,
|
||||
LANDSCAPE_LEFT: 3
|
||||
};
|
||||
|
||||
exports.RCCallIWAudioCodecType = void 0;
|
||||
export const RCCallIWVideoBitrateMode = {
|
||||
CQ: 0,
|
||||
VBR: 1,
|
||||
CBR: 2
|
||||
};
|
||||
|
||||
(function (RCCallIWAudioCodecType) {
|
||||
RCCallIWAudioCodecType[RCCallIWAudioCodecType["PCMU"] = 0] = "PCMU";
|
||||
RCCallIWAudioCodecType[RCCallIWAudioCodecType["OPUS"] = 111] = "OPUS";
|
||||
})(exports.RCCallIWAudioCodecType || (exports.RCCallIWAudioCodecType = {}));
|
||||
export const RCCallIWNetworkQuality = {
|
||||
UNKNOWN: 0,
|
||||
EXCELLENT: 1,
|
||||
GOOD: 2,
|
||||
POOR: 3,
|
||||
BAD: 4,
|
||||
TERRIBLE: 5
|
||||
};
|
||||
|
||||
exports.RCCallIWAudioSource = void 0;
|
||||
export const RCCallIWImportanceHW = {
|
||||
NORMAL: 0,
|
||||
LOW: 1
|
||||
};
|
||||
|
||||
(function (RCCallIWAudioSource) {
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["DEFAULT"] = 0] = "DEFAULT";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["MIC"] = 1] = "MIC";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_UPLINK"] = 2] = "VOICE_UPLINK";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_DOWNLINK"] = 3] = "VOICE_DOWNLINK";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_CALL"] = 4] = "VOICE_CALL";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["CAMCORDER"] = 5] = "CAMCORDER";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_RECOGNITION"] = 6] = "VOICE_RECOGNITION";
|
||||
RCCallIWAudioSource[RCCallIWAudioSource["VOICE_COMMUNICATION"] = 7] = "VOICE_COMMUNICATION";
|
||||
})(exports.RCCallIWAudioSource || (exports.RCCallIWAudioSource = {}));
|
||||
export const RCCallIWCallType = {
|
||||
SINGLE: 0,
|
||||
GROUP: 1
|
||||
};
|
||||
|
||||
exports.RCCallIWVideoProfile = void 0;
|
||||
|
||||
(function (RCCallIWVideoProfile) {
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_144_256"] = 0] = "PROFILE_144_256";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_240"] = 1] = "PROFILE_240_240";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_320"] = 2] = "PROFILE_240_320";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_480"] = 3] = "PROFILE_360_480";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_640"] = 4] = "PROFILE_360_640";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_640"] = 5] = "PROFILE_480_640";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_720"] = 6] = "PROFILE_480_720";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_720_1280"] = 7] = "PROFILE_720_1280";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_1080_1920"] = 8] = "PROFILE_1080_1920";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_144_256_HIGH"] = 9] = "PROFILE_144_256_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_240_HIGH"] = 10] = "PROFILE_240_240_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_240_320_HIGH"] = 11] = "PROFILE_240_320_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_480_HIGH"] = 12] = "PROFILE_360_480_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_360_640_HIGH"] = 13] = "PROFILE_360_640_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_640_HIGH"] = 14] = "PROFILE_480_640_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_480_720_HIGH"] = 15] = "PROFILE_480_720_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_720_1280_HIGH"] = 16] = "PROFILE_720_1280_HIGH";
|
||||
RCCallIWVideoProfile[RCCallIWVideoProfile["PROFILE_1080_1920_HIGH"] = 17] = "PROFILE_1080_1920_HIGH";
|
||||
})(exports.RCCallIWVideoProfile || (exports.RCCallIWVideoProfile = {}));
|
||||
|
||||
exports.RCCallIWCameraOrientation = void 0;
|
||||
|
||||
(function (RCCallIWCameraOrientation) {
|
||||
RCCallIWCameraOrientation[RCCallIWCameraOrientation["PORTRAIT"] = 0] = "PORTRAIT";
|
||||
RCCallIWCameraOrientation[RCCallIWCameraOrientation["PORTRAIT_UPSIDE_DOWN"] = 1] = "PORTRAIT_UPSIDE_DOWN";
|
||||
RCCallIWCameraOrientation[RCCallIWCameraOrientation["LANDSCAPE_RIGHT"] = 2] = "LANDSCAPE_RIGHT";
|
||||
RCCallIWCameraOrientation[RCCallIWCameraOrientation["LANDSCAPE_LEFT"] = 3] = "LANDSCAPE_LEFT";
|
||||
})(exports.RCCallIWCameraOrientation || (exports.RCCallIWCameraOrientation = {}));
|
||||
|
||||
exports.RCCallIWVideoBitrateMode = void 0;
|
||||
|
||||
(function (RCCallIWVideoBitrateMode) {
|
||||
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["CQ"] = 0] = "CQ";
|
||||
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["VBR"] = 1] = "VBR";
|
||||
RCCallIWVideoBitrateMode[RCCallIWVideoBitrateMode["CBR"] = 2] = "CBR";
|
||||
})(exports.RCCallIWVideoBitrateMode || (exports.RCCallIWVideoBitrateMode = {}));
|
||||
|
||||
exports.RCCallIWNetworkQuality = void 0;
|
||||
|
||||
(function (RCCallIWNetworkQuality) {
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["UNKNOWN"] = 0] = "UNKNOWN";
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["EXCELLENT"] = 1] = "EXCELLENT";
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["GOOD"] = 2] = "GOOD";
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["POOR"] = 3] = "POOR";
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["BAD"] = 4] = "BAD";
|
||||
RCCallIWNetworkQuality[RCCallIWNetworkQuality["TERRIBLE"] = 5] = "TERRIBLE";
|
||||
})(exports.RCCallIWNetworkQuality || (exports.RCCallIWNetworkQuality = {}));
|
||||
|
||||
exports.RCCallIWImportanceHW = void 0;
|
||||
|
||||
(function (RCCallIWImportanceHW) {
|
||||
RCCallIWImportanceHW[RCCallIWImportanceHW["NORMAL"] = 0] = "NORMAL";
|
||||
RCCallIWImportanceHW[RCCallIWImportanceHW["LOW"] = 1] = "LOW";
|
||||
})(exports.RCCallIWImportanceHW || (exports.RCCallIWImportanceHW = {}));
|
||||
|
||||
exports.RCCallIWCallType = void 0;
|
||||
|
||||
(function (RCCallIWCallType) {
|
||||
RCCallIWCallType[RCCallIWCallType["SINGLE"] = 0] = "SINGLE";
|
||||
RCCallIWCallType[RCCallIWCallType["GROUP"] = 1] = "GROUP";
|
||||
})(exports.RCCallIWCallType || (exports.RCCallIWCallType = {}));
|
||||
|
||||
exports.RCCallIWUserType = void 0;
|
||||
|
||||
(function (RCCallIWUserType) {
|
||||
RCCallIWUserType[RCCallIWUserType["NORMAL"] = 0] = "NORMAL";
|
||||
RCCallIWUserType[RCCallIWUserType["OBSERVER"] = 1] = "OBSERVER";
|
||||
})(exports.RCCallIWUserType || (exports.RCCallIWUserType = {}));
|
||||
export const RCCallIWUserType = {
|
||||
NORMAL: 0,
|
||||
OBSERVER: 1
|
||||
};
|
||||
|
||||
const call = uni.requireNativePlugin('RongCloud-Call-RCUniCall');
|
||||
const Platform = uni.getSystemInfoSync().platform;
|
||||
function init() {
|
||||
|
||||
export function init() {
|
||||
logger.log(`init Platform->${Platform}`);
|
||||
call.init({});
|
||||
}
|
||||
function unInit() {
|
||||
|
||||
export function unInit() {
|
||||
logger.log(`unInit Platform->${Platform}`);
|
||||
call.unInit();
|
||||
}
|
||||
function onCallReceived(listener) {
|
||||
|
||||
export function onCallReceived(listener) {
|
||||
logger.log(`Engine:OnCallReceived 监听通话呼入 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnCallReceived", listener);
|
||||
}
|
||||
function removeCallReceivedListener() {
|
||||
|
||||
export function removeCallReceivedListener() {
|
||||
logger.log(`removeCallReceivedListener`);
|
||||
call.removeAllEventListeners('Engine:OnCallReceived');
|
||||
}
|
||||
function onCallConnected(listener) {
|
||||
|
||||
export function onCallConnected(listener) {
|
||||
logger.log(`Engine:OnCallConnected 已建立通话通话接通 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnCallConnected", listener);
|
||||
}
|
||||
function removeCallConnectedListener() {
|
||||
|
||||
export function removeCallConnectedListener() {
|
||||
logger.log(`removeCallConnectedListener`);
|
||||
call.removeAllEventListeners('Engine:OnCallConnected');
|
||||
}
|
||||
function onCallDisconnected(listener) {
|
||||
|
||||
export function onCallDisconnected(listener) {
|
||||
logger.log(`Engine:OnCallDisconnected 监听通话结束 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnCallDisconnected", listener);
|
||||
}
|
||||
function removeCallDisconnectedListener() {
|
||||
|
||||
export function removeCallDisconnectedListener() {
|
||||
logger.log(`removeCallDisconnectedListener`);
|
||||
call.removeAllEventListeners('Engine:OnCallDisconnected');
|
||||
}
|
||||
function onRemoteUserInvited(listener) {
|
||||
|
||||
export function onRemoteUserInvited(listener) {
|
||||
logger.log(`Engine:OnRemoteUserInvited 通话中的某一个参与者,邀请好友加入通话 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserInvited", listener);
|
||||
}
|
||||
function removeRemoteUserInvited() {
|
||||
|
||||
export function removeRemoteUserInvited() {
|
||||
logger.log(`removeRemoteUserInvited`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserInvited');
|
||||
}
|
||||
function onRemoteUserJoined(listener) {
|
||||
|
||||
export function onRemoteUserJoined(listener) {
|
||||
logger.log(`Engine:OnRemoteUserJoined 对端用户加入通话 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserJoined", listener);
|
||||
}
|
||||
function removeRemoteUserJoinedListener() {
|
||||
|
||||
export function removeRemoteUserJoinedListener() {
|
||||
logger.log(`removeRemoteUserJoinedListener`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserJoined');
|
||||
}
|
||||
function onRemoteUserLeft(listener) {
|
||||
|
||||
export function onRemoteUserLeft(listener) {
|
||||
logger.log(`Engine:OnRemoteUserLeft 对端用户挂断(群聊触发) Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserLeft", listener);
|
||||
}
|
||||
function removeRemoteUserLeftListener() {
|
||||
|
||||
export function removeRemoteUserLeftListener() {
|
||||
logger.log(`removeRemoteUserLeftListener`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserLeft');
|
||||
}
|
||||
function onCallOutgoing(listener) {
|
||||
|
||||
export function onCallOutgoing(listener) {
|
||||
logger.log(`Engine:OnCallOutgoing 电话已拨出,通知当前 call 的详细信息 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnCallOutgoing", listener);
|
||||
}
|
||||
function removeCallOutgoingListener() {
|
||||
|
||||
export function removeCallOutgoingListener() {
|
||||
logger.log(`removeCallOutgoingListener`);
|
||||
call.removeAllEventListeners('Engine:OnCallOutgoing');
|
||||
}
|
||||
function onRemoteUserRinging(listener) {
|
||||
|
||||
export function onRemoteUserRinging(listener) {
|
||||
logger.log(`Engine:OnRemoteUserRinging 被叫端收到请求,发出振铃响应时监听 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserRinging", listener);
|
||||
}
|
||||
function removeRemoteUserRingingListener() {
|
||||
|
||||
export function removeRemoteUserRingingListener() {
|
||||
logger.log(`removeRemoteUserRingingListener`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserRinging');
|
||||
}
|
||||
function onError(listener) {
|
||||
|
||||
export function onError(listener) {
|
||||
logger.log(`Engine:OnError 通话出现错误 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnError", listener);
|
||||
}
|
||||
function removeErrorListener() {
|
||||
|
||||
export function removeErrorListener() {
|
||||
logger.log(`removeErrorListener`);
|
||||
call.removeAllEventListeners('Engine:OnError');
|
||||
}
|
||||
function onRemoteUserMediaTypeChanged(listener) {
|
||||
|
||||
export function onRemoteUserMediaTypeChanged(listener) {
|
||||
logger.log(`Engine:OnRemoteUserMediaTypeChanged 对端用户切换了媒体类型 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserMediaTypeChanged", listener);
|
||||
}
|
||||
function removeRemoteUserMediaTypeChangedListener() {
|
||||
|
||||
export function removeRemoteUserMediaTypeChangedListener() {
|
||||
logger.log(`removeRemoteUserMediaTypeChangedListener`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserMediaTypeChanged');
|
||||
}
|
||||
function onRemoteUserCameraStateChanged(listener) {
|
||||
|
||||
export function onRemoteUserCameraStateChanged(listener) {
|
||||
logger.log(`Engine:OnRemoteUserCameraStateChanged 对端用户关闭了摄像头 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserCameraStateChanged", listener);
|
||||
}
|
||||
function removeRemoteUserCameraStateChangedListener() {
|
||||
|
||||
export function removeRemoteUserCameraStateChangedListener() {
|
||||
logger.log(`removeRemoteUserCameraStateChangedListener`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserCameraStateChanged');
|
||||
}
|
||||
function onRemoteUserMicrophoneStateChanged(listener) {
|
||||
|
||||
export function onRemoteUserMicrophoneStateChanged(listener) {
|
||||
logger.log(`Engine:OnRemoteUserMicrophoneStateChanged 对端用户开关麦克风 Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnRemoteUserMicrophoneStateChanged", listener);
|
||||
}
|
||||
function removeRemoteUserMicrophoneStateChangedListener() {
|
||||
|
||||
export function removeRemoteUserMicrophoneStateChangedListener() {
|
||||
logger.log(`removeRemoteUserMicrophoneStateChanged`);
|
||||
call.removeAllEventListeners('Engine:OnRemoteUserMicrophoneStateChanged');
|
||||
}
|
||||
function onNetworkQuality(listener) {
|
||||
|
||||
export function onNetworkQuality(listener) {
|
||||
logger.log(`Engine:OnNetworkQuality Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnNetworkQuality", listener);
|
||||
}
|
||||
function removeNetworkQualityListener() {
|
||||
|
||||
export function removeNetworkQualityListener() {
|
||||
call.removeAllEventListeners('Engine:OnNetworkQuality');
|
||||
}
|
||||
function onEnableCamera(listener) {
|
||||
|
||||
export function onEnableCamera(listener) {
|
||||
logger.log(`Engine:OnEnableCamera Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnEnableCamera", listener);
|
||||
}
|
||||
function removeEnableCameraListener() {
|
||||
|
||||
export function removeEnableCameraListener() {
|
||||
logger.log(`removeEnableCameraListener`);
|
||||
call.removeAllEventListeners('Engine:OnEnableCamera');
|
||||
}
|
||||
function onSwitchCamera(listener) {
|
||||
|
||||
export function onSwitchCamera(listener) {
|
||||
logger.log(`Engine:OnSwitchCamera Platform->${Platform}`);
|
||||
call.addEventListener("Engine:OnSwitchCamera", listener);
|
||||
}
|
||||
function removeSwitchCameraListener() {
|
||||
|
||||
export function removeSwitchCameraListener() {
|
||||
logger.log(`removeSwitchCameraListener`);
|
||||
call.removeAllEventListeners('Engine:OnSwitchCamera');
|
||||
}
|
||||
function getCurrentCallSession() {
|
||||
|
||||
export function getCurrentCallSession() {
|
||||
logger.log(`getCurrentCallSession Platform->${Platform}`);
|
||||
return call.getCurrentCallSession();
|
||||
}
|
||||
function hangup() {
|
||||
|
||||
export function hangup() {
|
||||
logger.log(`hangup Platform->${Platform}`);
|
||||
call.hangup();
|
||||
}
|
||||
function accept() {
|
||||
|
||||
export function accept() {
|
||||
logger.log(`accept Platform->${Platform}`);
|
||||
call.accept();
|
||||
}
|
||||
function startSingleCall(targetId, type, extra) {
|
||||
|
||||
export function startSingleCall(targetId, type, extra) {
|
||||
logger.log(`startSingleCall targetId->${targetId} type=>${type} extra=>${extra} Platform->${Platform}`);
|
||||
call.startSingleCall(targetId, type, extra);
|
||||
}
|
||||
function startGroupCall(groupId, userIds, observerUserIds, type, extra) {
|
||||
|
||||
export function startGroupCall(groupId, userIds, observerUserIds, type, extra) {
|
||||
logger.log(`startGroupCall groupId->${groupId} userIds=>${userIds} observerUserIds=>${observerUserIds} type=>${type} extra=>${extra} Platform->${Platform}`);
|
||||
call.startGroupCall(groupId, userIds, observerUserIds, type, extra);
|
||||
}
|
||||
function inviteUsers(userIds, observerUserIds) {
|
||||
|
||||
export function inviteUsers(userIds, observerUserIds) {
|
||||
logger.log(`inviteUsers 邀请用户->${userIds} Platform->${Platform}`);
|
||||
call.inviteUsers(userIds, observerUserIds);
|
||||
}
|
||||
function setVideoView(userId, ref, type, isZOrderOnTop = false) {
|
||||
|
||||
export function setVideoView(userId, ref, type, isZOrderOnTop = false) {
|
||||
logger.log(`setVideoView userId->${userId} ref=>${ref} type=>${type} isZOrderOnTop=>${isZOrderOnTop} Platform->${Platform}`);
|
||||
Platform === 'android' ? call.setVideoView(userId, ref, type, isZOrderOnTop) : call.setVideoView(userId, ref, type);
|
||||
}
|
||||
function enableSpeaker(isOpen) {
|
||||
|
||||
export function enableSpeaker(isOpen) {
|
||||
logger.log(`enableSpeaker isOPen->${isOpen} Platform->${Platform}`);
|
||||
call.enableSpeaker(isOpen);
|
||||
}
|
||||
function enableMicrophone(isOpen) {
|
||||
|
||||
export function enableMicrophone(isOpen) {
|
||||
logger.log(`enableMicrophone isOPen->${isOpen} Platform->${Platform}`);
|
||||
call.enableMicrophone(isOpen);
|
||||
}
|
||||
function switchCamera() {
|
||||
|
||||
export function switchCamera() {
|
||||
logger.log(`switchCamera Platform->${Platform}`);
|
||||
call.switchCamera();
|
||||
}
|
||||
function currentCamera() {
|
||||
|
||||
export function currentCamera() {
|
||||
logger.log(`currentCamera Platform->${Platform}`);
|
||||
return call.currentCamera();
|
||||
}
|
||||
function enableCamera(isOpen, camera) {
|
||||
|
||||
export function enableCamera(isOpen, camera) {
|
||||
logger.log(`enableCamera isOpen=>${isOpen} camera=>${camera} Platform->${Platform}`);
|
||||
call.enableCamera(isOpen, camera);
|
||||
}
|
||||
function changeMediaType(type) {
|
||||
|
||||
export function changeMediaType(type) {
|
||||
logger.log(`changeMediaType type=>${type} Platform->${Platform}`);
|
||||
call.changeMediaType(type);
|
||||
}
|
||||
function setAudioConfig(config) {
|
||||
|
||||
export function setAudioConfig(config) {
|
||||
logger.log(`setAudioConfig config=>${config} Platform->${Platform}`);
|
||||
call.setAudioConfig(config);
|
||||
}
|
||||
function setVideoConfig(config) {
|
||||
|
||||
export function setVideoConfig(config) {
|
||||
logger.log(`setVideoConfig config=>${config} Platform->${Platform}`);
|
||||
call.setVideoConfig(config);
|
||||
}
|
||||
function setPushConfig(config, hangupPushConfig) {
|
||||
|
||||
export function setPushConfig(config, hangupPushConfig) {
|
||||
logger.log(`setPushConfig config=>${config} hangupPushConfig=>${hangupPushConfig} Platform->${Platform}`);
|
||||
call.setPushConfig(config, hangupPushConfig);
|
||||
}
|
||||
|
||||
exports.accept = accept;
|
||||
exports.changeMediaType = changeMediaType;
|
||||
exports.currentCamera = currentCamera;
|
||||
exports.enableCamera = enableCamera;
|
||||
exports.enableMicrophone = enableMicrophone;
|
||||
exports.enableSpeaker = enableSpeaker;
|
||||
exports.getCurrentCallSession = getCurrentCallSession;
|
||||
exports.hangup = hangup;
|
||||
exports.init = init;
|
||||
exports.inviteUsers = inviteUsers;
|
||||
exports.onCallConnected = onCallConnected;
|
||||
exports.onCallDisconnected = onCallDisconnected;
|
||||
exports.onCallOutgoing = onCallOutgoing;
|
||||
exports.onCallReceived = onCallReceived;
|
||||
exports.onEnableCamera = onEnableCamera;
|
||||
exports.onError = onError;
|
||||
exports.onNetworkQuality = onNetworkQuality;
|
||||
exports.onRemoteUserCameraStateChanged = onRemoteUserCameraStateChanged;
|
||||
exports.onRemoteUserInvited = onRemoteUserInvited;
|
||||
exports.onRemoteUserJoined = onRemoteUserJoined;
|
||||
exports.onRemoteUserLeft = onRemoteUserLeft;
|
||||
exports.onRemoteUserMediaTypeChanged = onRemoteUserMediaTypeChanged;
|
||||
exports.onRemoteUserMicrophoneStateChanged = onRemoteUserMicrophoneStateChanged;
|
||||
exports.onRemoteUserRinging = onRemoteUserRinging;
|
||||
exports.onSwitchCamera = onSwitchCamera;
|
||||
exports.removeCallConnectedListener = removeCallConnectedListener;
|
||||
exports.removeCallDisconnectedListener = removeCallDisconnectedListener;
|
||||
exports.removeCallOutgoingListener = removeCallOutgoingListener;
|
||||
exports.removeCallReceivedListener = removeCallReceivedListener;
|
||||
exports.removeEnableCameraListener = removeEnableCameraListener;
|
||||
exports.removeErrorListener = removeErrorListener;
|
||||
exports.removeNetworkQualityListener = removeNetworkQualityListener;
|
||||
exports.removeRemoteUserCameraStateChangedListener = removeRemoteUserCameraStateChangedListener;
|
||||
exports.removeRemoteUserInvited = removeRemoteUserInvited;
|
||||
exports.removeRemoteUserJoinedListener = removeRemoteUserJoinedListener;
|
||||
exports.removeRemoteUserLeftListener = removeRemoteUserLeftListener;
|
||||
exports.removeRemoteUserMediaTypeChangedListener = removeRemoteUserMediaTypeChangedListener;
|
||||
exports.removeRemoteUserMicrophoneStateChangedListener = removeRemoteUserMicrophoneStateChangedListener;
|
||||
exports.removeRemoteUserRingingListener = removeRemoteUserRingingListener;
|
||||
exports.removeSwitchCameraListener = removeSwitchCameraListener;
|
||||
exports.setAudioConfig = setAudioConfig;
|
||||
exports.setPushConfig = setPushConfig;
|
||||
exports.setVideoConfig = setVideoConfig;
|
||||
exports.setVideoView = setVideoView;
|
||||
exports.startGroupCall = startGroupCall;
|
||||
exports.startSingleCall = startSingleCall;
|
||||
exports.switchCamera = switchCamera;
|
||||
exports.unInit = unInit;
|
||||
}
|
||||
Reference in New Issue
Block a user