diff --git a/src/Client.js b/src/Client.js index 1cb4ef8..a6393e6 100644 --- a/src/Client.js +++ b/src/Client.js @@ -756,7 +756,10 @@ class Client extends EventEmitter { window.Store.Msg.on('change:body change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WWebJS.getMessageModel(msg), newBody, prevBody); }); window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); - window.Store.Call.on('add', (call) => { window.onIncomingCall(call); }); + const callCollection = (window.Store && window.Store.Call) || (window.Store && window.Store.WAWebCallCollection); + if (callCollection && typeof callCollection.on === 'function') { + callCollection.on('add', (call) => { window.onIncomingCall(call); }); + } window.Store.Chat.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WWebJS.getChatModel(chat)); }); window.Store.Chat.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WWebJS.getChatModel(chat), currState, prevState); }); window.Store.Msg.on('add', (msg) => {