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 });
|
||||
|
||||
if (!result) {
|
||||
actions.hangUp({ tabId: getCurrentTabId() });
|
||||
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||
return;
|
||||
}
|
||||
global = getGlobal();
|
||||
|
||||
@ -36,7 +36,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
if (!activeGroupCallId) break;
|
||||
|
||||
if (update.connectionState === 'disconnected') {
|
||||
actions.leaveGroupCall({ isFromLibrary: true, tabId: getCurrentTabId() });
|
||||
if ('leaveGroupCall' in actions) actions.leaveGroupCall({ isFromLibrary: true, tabId: getCurrentTabId() });
|
||||
break;
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
case 'updateGroupCallConnection': {
|
||||
if (update.data.stream) {
|
||||
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;
|
||||
}
|
||||
void handleUpdateGroupCallConnection(update.data, update.presentation);
|
||||
@ -107,7 +107,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
if (state === 'active' || state === 'accepted') {
|
||||
if (!verifyPhoneCallProtocol(call.protocol)) {
|
||||
const user = selectPhoneCallUser(global);
|
||||
actions.hangUp({ tabId: getCurrentTabId() });
|
||||
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||
actions.showNotification({
|
||||
message: langProvider.translate('VoipPeerIncompatible', user?.firstName),
|
||||
tabId: getCurrentTabId(),
|
||||
@ -181,7 +181,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
if (!global.phoneCall) return global;
|
||||
|
||||
if (connectionState === 'closed' || connectionState === 'disconnected' || connectionState === 'failed') {
|
||||
actions.hangUp({ tabId: getCurrentTabId() });
|
||||
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
case 'updateGroupCall': {
|
||||
if (update.call.connectionState === 'discarded') {
|
||||
if (global.groupCalls.activeGroupCallId) {
|
||||
actions.leaveGroupCall({ shouldRemove: true, tabId: getCurrentTabId() });
|
||||
if ('leaveGroupCall' in actions) actions.leaveGroupCall({ shouldRemove: true, tabId: getCurrentTabId() });
|
||||
return undefined;
|
||||
} else {
|
||||
return removeGroupCall(global, update.call.id);
|
||||
@ -93,7 +93,7 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
||||
if (phoneCall) {
|
||||
if (call.state === 'discarded') {
|
||||
actions.playGroupCallSound({ sound: 'end' });
|
||||
actions.hangUp({ tabId: getCurrentTabId() });
|
||||
if ('hangUp' in actions) actions.hangUp({ tabId: getCurrentTabId() });
|
||||
|
||||
return {
|
||||
...global,
|
||||
|
||||
@ -271,10 +271,12 @@ addActionHandler('joinGroupCall', async (global, actions, payload): Promise<void
|
||||
}
|
||||
|
||||
if (activeGroupCallId) {
|
||||
actions.leaveGroupCall({
|
||||
rejoin: payload,
|
||||
tabId,
|
||||
});
|
||||
if ('leaveGroupCall' in actions) {
|
||||
actions.leaveGroupCall({
|
||||
rejoin: payload,
|
||||
tabId,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user