@tencentcloud/chat-cs-wx
Advanced tools
Comparing version 1.0.5 to 1.0.6
46
index.js
@@ -235,4 +235,11 @@ // chat-cs-wx/index.js | ||
async handleLoginSuccess() { | ||
const clientDataObject = this.safeParseClientData(wx.$tccc_clientData); | ||
const res = await request('/ccc/user/startSession', { | ||
channelId: wx.$tccc_webAppId | ||
channelId: wx.$tccc_webAppId, | ||
...(wx.$tccc_userSig && | ||
wx.$tccc_clientData && { | ||
userSig:wx.$tccc_userSig, | ||
userBuf: wx.$tccc_clientData, | ||
userId: `${clientDataObject.uid}` || "", | ||
}), | ||
}); | ||
@@ -301,2 +308,13 @@ const { | ||
async onSDKReady() { | ||
const clientDataObject = this.safeParseClientData(wx.$tccc_clientData); | ||
try { | ||
if (wx.$tccc_userSig && wx.$tccc_clientData) { | ||
wx.$TCCC.updateMyProfile({ | ||
nick: clientDataObject?.nickName ?? "", | ||
avatar: clientDataObject?.avatarUrl ?? "", | ||
}); | ||
} | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
@@ -316,4 +334,22 @@ const conversationRes = await wx.$TCCC.getConversationProfile( | ||
}; | ||
} | ||
}, | ||
safeParseClientData(clientDataStr) { | ||
try { | ||
console.log(clientDataStr, "clientDataStr"); | ||
const clientDataObject = | ||
clientDataStr && JSON.parse(decodeURIComponent(clientDataStr)); | ||
console.log( | ||
clientDataObject, | ||
"clientDataObjectclientDataObjectclientDataObject" | ||
); | ||
return clientDataObject; | ||
} catch (e) { | ||
console.log(e); | ||
return null; | ||
} | ||
}, | ||
}, | ||
@@ -327,2 +363,8 @@ lifetimes: { | ||
detached: function () { | ||
let promise = wx.$TCCC.logout(); | ||
promise.then(function (imResponse) { | ||
console.log(imResponse.data); // 登出成功 | ||
}).catch(function (imError) { | ||
console.warn('logout error:', imError); | ||
}); | ||
// wx.offAppShow(this.handleVisibilityChange("visible")); | ||
@@ -329,0 +371,0 @@ // wx.offonAppHide(this.handleVisibilityChange("invisible")); |
{ | ||
"name": "@tencentcloud/chat-cs-wx", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "TCCC wx UIKit", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
import logger from '../../../../utils/logger'; | ||
import constant from '../../../../utils/constant'; | ||
import '../../../../utils/lodash-fix' | ||
import _ from "../../../../utils/lodash/index"; | ||
import debounce from "../../../../utils/lodashDebounce/index" | ||
import { | ||
@@ -82,3 +81,3 @@ CUSTOM_MESSAGE_SRC, | ||
hasCallKit: false, | ||
inputChange: _.debounce(async (inputThis, value) => { | ||
inputChange: debounce(async (inputThis, value) => { | ||
const searchResult = await request('/ccc/im/botSearchInput', { | ||
@@ -481,32 +480,6 @@ sdkAppId: wx.$tccc_sdkAppId, | ||
handleCalling(e) { | ||
if (!this.data.hasCallKit) { | ||
wx.showToast({ | ||
title: '请先集成 TUICallKit 组件', | ||
icon: 'none', | ||
}); | ||
return; | ||
} | ||
const type = e.currentTarget.dataset.value; | ||
const conversationType = this.data.conversation.type; | ||
if (conversationType === wx.$TCCCCore.TYPES.CONV_GROUP) { | ||
if (type === 1) {} else if (type === 2) {} | ||
this.triggerEvent('handleCall', { | ||
type, | ||
conversationType, | ||
}); | ||
} | ||
if (conversationType === wx.$TCCCCore.TYPES.CONV_C2C) { | ||
const { | ||
userID | ||
} = this.data.conversation.userProfile; | ||
if (type === 1) {} else if (type === 2) {} | ||
this.triggerEvent('handleCall', { | ||
conversationType, | ||
type, | ||
userID, | ||
}); | ||
} | ||
this.setData({ | ||
displayFlag: '', | ||
}); | ||
}, | ||
@@ -513,0 +486,0 @@ |
@@ -242,2 +242,3 @@ import dayjs from '../../../../utils/dayjs'; | ||
this.isHideInput(message) | ||
this.isAudioVideoIn(message) | ||
wx.$TCCC.setMessageRead({ | ||
@@ -891,2 +892,19 @@ conversationID: this.data.conversation.conversationID | ||
}, | ||
isAudioVideoIn(message){ | ||
try{ | ||
if ( | ||
(message.type === wx.$TCCCCore.TYPES.MSG_CUSTOM && | ||
(JSON.parse(message.payload.data).src === '16')) | ||
) { | ||
if(JSON.parse(message.payload.data).content.currentMedia === 'audio'){ | ||
this.triggerEvent('audioIn') | ||
}else if(JSON.parse(message.payload.data).content.currentMedia === 'video'){ | ||
this.triggerEvent('videoIn') | ||
} | ||
} | ||
}catch(e){ | ||
console.log(e); | ||
} | ||
}, | ||
imgOnload(e){ | ||
@@ -893,0 +911,0 @@ if(this.data.messageList[this.data.messageList.length - 1].ID==e.detail.message.ID){ |
@@ -92,2 +92,4 @@ // TUIKit-WChat/Chat/index.js | ||
isHideInput: false, | ||
hiddenCall: true, | ||
hiddenVideo: true, | ||
}, | ||
@@ -148,6 +150,10 @@ | ||
handleCall(event) { | ||
if (event.detail.conversationType === wx.$TCCCCore.TYPES.CONV_GROUP) { | ||
this.selectComponent('#TUIGroup').callShowMoreMember(event); | ||
} else { | ||
this.triggerEvent('handleCall', event.detail); | ||
//1 call 2 video | ||
if (event.detail.type === 1) { | ||
this.setData({ | ||
hiddenCall:false | ||
}) | ||
this.selectComponent('#Call').handleSendCall(); | ||
} else if (event.detail.type === 2) { | ||
} | ||
@@ -278,5 +284,19 @@ }, | ||
}) | ||
} | ||
}, | ||
hideCallPage(){ | ||
this.setData({ | ||
hiddenCall:true | ||
}) | ||
}, | ||
audioIn(){ | ||
this.setData({ | ||
hiddenCall:false | ||
}) | ||
this.selectComponent('#Call').onMediaInvited(); | ||
}, | ||
videoIn(){ | ||
}, | ||
}, | ||
}); |
@@ -6,4 +6,5 @@ { | ||
"MessageInput": "./components/MessageInput/index", | ||
"TUIGroup": "../TUIGroup/index" | ||
"TUIGroup": "../TUIGroup/index", | ||
"Call":"../TUIChat/components/chatCsCallKit/call/call" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
266
2
1445849
13430