parent
46c2918ff3
commit
33f88ac150
1 changed files with 22 additions and 5 deletions
|
|
@ -1020,8 +1020,7 @@ class Client extends EventEmitter {
|
|||
);
|
||||
|
||||
await this.pupPage.evaluate(() => {
|
||||
const { Msg, Chat, WAWebCallCollection } =
|
||||
window.require('WAWebCollections');
|
||||
const { Msg, Chat } = window.require('WAWebCollections');
|
||||
const AppState = window.require('WAWebSocketModel').Socket;
|
||||
|
||||
// Enable placeholder message resend (recovery for ciphertext messages)
|
||||
|
|
@ -1069,13 +1068,31 @@ class Client extends EventEmitter {
|
|||
.Conn.on('change:battery', (state) => {
|
||||
window.onBatteryStateChangedEvent(state);
|
||||
});
|
||||
const WAWebCallCollection = window.require('WAWebCallCollection');
|
||||
if (
|
||||
WAWebCallCollection &&
|
||||
typeof WAWebCallCollection.on === 'function'
|
||||
) {
|
||||
WAWebCallCollection.on('add', (call) => {
|
||||
window.onIncomingCall(call);
|
||||
const mapKey = Object.keys(WAWebCallCollection).find(
|
||||
(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) => {
|
||||
window.onRemoveChatEvent(
|
||||
|
|
|
|||
Loading…
Reference in a new issue