feat(im): 群通话本端拒绝 / 挂断后立即从胶囊条移除自己,无需等后端推回

im
YunaiV 2026-05-18 00:12:28 +08:00
parent b9b085f1ee
commit ae7f3a8bc5
2 changed files with 18 additions and 17 deletions

View File

@ -309,17 +309,19 @@ async function handleCancel() {
/** 被叫拒绝来电 */
async function handleReject() {
const payload = rtcStore.incomingPayload
const room = payload?.room
if (room) {
if (payload?.room) {
try {
await rejectCall(room)
await rejectCall(payload.room)
} catch (e) {
console.warn('[Call] reject 失败', { room }, e)
console.warn('[Call] reject 失败', { room: payload.room }, e)
}
}
// RTC_CALL(REJECTED)
if (payload?.conversationType === ImConversationType.GROUP && payload.groupId) {
rtcStore.applyParticipantRejected({ ...payload, operatorUserId: getCurrentUserId() })
// RTC_CALL(REJECTED) store no-op
rtcStore.applyParticipantRejected({
room: payload.room,
conversationType: payload.conversationType,
groupId: payload.groupId,
operatorUserId: getCurrentUserId()
})
}
rtcStore.reset()
}
@ -341,18 +343,15 @@ async function handleAccept() {
/** 通话中挂断 */
async function handleHangup() {
const call = rtcStore.call
const room = call?.room
if (room) {
if (call?.room) {
try {
await leaveCall(room)
await leaveCall(call.room)
} catch (e) {
console.warn('[Call] leave 失败', { room }, e)
console.warn('[Call] leave 失败', { room: call.room }, e)
}
}
// 1603 END
if (call?.conversationType === ImConversationType.GROUP && call.groupId && room) {
// RTC_PARTICIPANT_DISCONNECTED store no-op END
rtcStore.applyParticipantDisconnected({
room,
room: call.room,
userId: getCurrentUserId(),
conversationType: call.conversationType,
groupId: call.groupId

View File

@ -325,7 +325,9 @@ export const useRtcStore = defineStore('imRtc', () => {
}
/** 群通话单人拒绝邀请:标记 leftUserIds + 从胶囊条 inviteeIds 移除(私聊拒绝走 RTC_CALL_END不入本通道 */
function applyParticipantRejected(payload: ImRtcCallNotification) {
function applyParticipantRejected(
payload: Pick<ImRtcCallNotification, 'room' | 'conversationType' | 'groupId' | 'operatorUserId'>
) {
if (!payload.operatorUserId) {
return
}