Calls: Fix errors when bundle is not loaded (#2518)
This commit is contained in:
parent
dcee60e77e
commit
0be5085d69
@ -253,7 +253,7 @@ addActionHandler('connectToActivePhoneCall', async (global, actions): Promise<vo
|
|||||||
const result = await callApi('requestCall', { user, gAHash, isVideo: phoneCall.isVideo });
|
const result = await callApi('requestCall', { user, gAHash, isVideo: phoneCall.isVideo });
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
actions.hangUp({ tabId: getCurrentTabId() });
|
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
global = getGlobal();
|
global = getGlobal();
|
||||||
|
|||||||
@ -36,7 +36,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
if (!activeGroupCallId) break;
|
if (!activeGroupCallId) break;
|
||||||
|
|
||||||
if (update.connectionState === 'disconnected') {
|
if (update.connectionState === 'disconnected') {
|
||||||
actions.leaveGroupCall({ isFromLibrary: true, tabId: getCurrentTabId() });
|
if ('leaveGroupCall' in actions) actions.leaveGroupCall({ isFromLibrary: true, tabId: getCurrentTabId() });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
case 'updateGroupCallConnection': {
|
case 'updateGroupCallConnection': {
|
||||||
if (update.data.stream) {
|
if (update.data.stream) {
|
||||||
actions.showNotification({ message: 'Big live streams are not yet supported', tabId: getCurrentTabId() });
|
actions.showNotification({ message: 'Big live streams are not yet supported', tabId: getCurrentTabId() });
|
||||||
actions.leaveGroupCall({ tabId: getCurrentTabId() });
|
if ('leaveGroupCall' in actions) actions.leaveGroupCall({ tabId: getCurrentTabId() });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
void handleUpdateGroupCallConnection(update.data, update.presentation);
|
void handleUpdateGroupCallConnection(update.data, update.presentation);
|
||||||
@ -107,7 +107,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
if (state === 'active' || state === 'accepted') {
|
if (state === 'active' || state === 'accepted') {
|
||||||
if (!verifyPhoneCallProtocol(call.protocol)) {
|
if (!verifyPhoneCallProtocol(call.protocol)) {
|
||||||
const user = selectPhoneCallUser(global);
|
const user = selectPhoneCallUser(global);
|
||||||
actions.hangUp({ tabId: getCurrentTabId() });
|
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||||
actions.showNotification({
|
actions.showNotification({
|
||||||
message: langProvider.translate('VoipPeerIncompatible', user?.firstName),
|
message: langProvider.translate('VoipPeerIncompatible', user?.firstName),
|
||||||
tabId: getCurrentTabId(),
|
tabId: getCurrentTabId(),
|
||||||
@ -181,7 +181,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
if (!global.phoneCall) return global;
|
if (!global.phoneCall) return global;
|
||||||
|
|
||||||
if (connectionState === 'closed' || connectionState === 'disconnected' || connectionState === 'failed') {
|
if (connectionState === 'closed' || connectionState === 'disconnected' || connectionState === 'failed') {
|
||||||
actions.hangUp({ tabId: getCurrentTabId() });
|
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
case 'updateGroupCall': {
|
case 'updateGroupCall': {
|
||||||
if (update.call.connectionState === 'discarded') {
|
if (update.call.connectionState === 'discarded') {
|
||||||
if (global.groupCalls.activeGroupCallId) {
|
if (global.groupCalls.activeGroupCallId) {
|
||||||
actions.leaveGroupCall({ shouldRemove: true, tabId: getCurrentTabId() });
|
if ('leaveGroupCall' in actions) actions.leaveGroupCall({ shouldRemove: true, tabId: getCurrentTabId() });
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
} else {
|
||||||
return removeGroupCall(global, update.call.id);
|
return removeGroupCall(global, update.call.id);
|
||||||
@ -93,7 +93,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
if (phoneCall) {
|
if (phoneCall) {
|
||||||
if (call.state === 'discarded') {
|
if (call.state === 'discarded') {
|
||||||
actions.playGroupCallSound({ sound: 'end' });
|
actions.playGroupCallSound({ sound: 'end' });
|
||||||
actions.hangUp({ tabId: getCurrentTabId() });
|
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...global,
|
...global,
|
||||||
|
|||||||
@ -271,10 +271,12 @@ addActionHandler('joinGroupCall', async (global, actions, payload): Promise<void
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (activeGroupCallId) {
|
if (activeGroupCallId) {
|
||||||
actions.leaveGroupCall({
|
if ('leaveGroupCall' in actions) {
|
||||||
rejoin: payload,
|
actions.leaveGroupCall({
|
||||||
tabId,
|
rejoin: payload,
|
||||||
});
|
tabId,
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user