Fix: Event Call (#201714)

* Fix: Event Call

* Update Client.js
This commit is contained in:
BenyFilho 2026-04-16 13:14:53 -03:00 • committed by GitHub
commit 33f88ac150
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1020,8 +1020,7 @@ class Client extends EventEmitter {
); );
await this.pupPage.evaluate(() => { await this.pupPage.evaluate(() => {
const { Msg, Chat, WAWebCallCollection } = const { Msg, Chat } = window.require('WAWebCollections');
window.require('WAWebCollections');
const AppState = window.require('WAWebSocketModel').Socket; const AppState = window.require('WAWebSocketModel').Socket;
// Enable placeholder message resend (recovery for ciphertext messages) // Enable placeholder message resend (recovery for ciphertext messages)
@ -1069,13 +1068,31 @@ class Client extends EventEmitter {
.Conn.on('change:battery', (state) => { .Conn.on('change:battery', (state) => {
window.onBatteryStateChangedEvent(state); window.onBatteryStateChangedEvent(state);
}); });
const WAWebCallCollection = window.require('WAWebCallCollection');
if ( if (
WAWebCallCollection && WAWebCallCollection &&
typeof WAWebCallCollection.on === 'function' typeof WAWebCallCollection.on === 'function'
) { ) {
WAWebCallCollection.on('add', (call) => { const mapKey = Object.keys(WAWebCallCollection).find(
window.onIncomingCall(call); (k) => WAWebCallCollection[k] instanceof Map,
);
const internalCallMap = WAWebCallCollection[mapKey];
const originalMapSet =
internalCallMap.set.bind(internalCallMap);
internalCallMap.set = function (key, value) {
window.onIncomingCall({
id: value.id,
peerJid: value.peerJid,
isVideo: value.isVideo,
isGroup: value.isGroup,
canHandleLocally: value.canHandleLocally,
outgoing: value.outgoing,
webClientShouldHandle: value.webClientShouldHandle,
participants: value.participants,
}); });
return originalMapSet(key, value);
};
} }
Chat.on('remove', async (chat) => { Chat.on('remove', async (chat) => {
window.onRemoveChatEvent( window.onRemoveChatEvent(