Location
diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js
index 30b45c3..d88972d 100644
--- a/docs/scripts/jsdoc-toc.js
+++ b/docs/scripts/jsdoc-toc.js
@@ -6,7 +6,7 @@
treeNode.tree({
autoEscape: false,
closedIcon: '⇢',
- data: [{"label":"
Globals","id":"global","children":[]},{"label":"
Base","id":"Base","children":[]},{"label":"
BusinessContact","id":"BusinessContact","children":[]},{"label":"
Buttons","id":"Buttons","children":[]},{"label":"
Call","id":"Call","children":[]},{"label":"
Chat","id":"Chat","children":[]},{"label":"
Client","id":"Client","children":[]},{"label":"
ClientInfo","id":"ClientInfo","children":[]},{"label":"
Contact","id":"Contact","children":[]},{"label":"
GroupChat","id":"GroupChat","children":[]},{"label":"
GroupNotification","id":"GroupNotification","children":[]},{"label":"
InterfaceController","id":"InterfaceController","children":[]},{"label":"
Label","id":"Label","children":[]},{"label":"
List","id":"List","children":[]},{"label":"
Location","id":"Location","children":[]},{"label":"
Message","id":"Message","children":[]},{"label":"
MessageMedia","id":"MessageMedia","children":[]},{"label":"
Order","id":"Order","children":[]},{"label":"
Poll","id":"Poll","children":[]},{"label":"
PrivateChat","id":"PrivateChat","children":[]},{"label":"
PrivateContact","id":"PrivateContact","children":[]},{"label":"
Product","id":"Product","children":[]},{"label":"
Reaction","id":"Reaction","children":[]},{"label":"
Util","id":"Util","children":[]}],
+ data: [{"label":"
Globals","id":"global","children":[]},{"label":"
Base","id":"Base","children":[]},{"label":"
BusinessContact","id":"BusinessContact","children":[]},{"label":"
Call","id":"Call","children":[]},{"label":"
Chat","id":"Chat","children":[]},{"label":"
Client","id":"Client","children":[]},{"label":"
ClientInfo","id":"ClientInfo","children":[]},{"label":"
Contact","id":"Contact","children":[]},{"label":"
GroupChat","id":"GroupChat","children":[]},{"label":"
GroupNotification","id":"GroupNotification","children":[]},{"label":"
InterfaceController","id":"InterfaceController","children":[]},{"label":"
Label","id":"Label","children":[]},{"label":"
Location","id":"Location","children":[]},{"label":"
Message","id":"Message","children":[]},{"label":"
MessageMedia","id":"MessageMedia","children":[]},{"label":"
Order","id":"Order","children":[]},{"label":"
Poll","id":"Poll","children":[]},{"label":"
PrivateChat","id":"PrivateChat","children":[]},{"label":"
PrivateContact","id":"PrivateContact","children":[]},{"label":"
Product","id":"Product","children":[]},{"label":"
Reaction","id":"Reaction","children":[]},{"label":"
Util","id":"Util","children":[]}],
openedIcon: ' ⇣',
saveState: false,
useContextMenu: false
diff --git a/src/Client.js b/src/Client.js
index 7abc1e2..9445d43 100644
--- a/src/Client.js
+++ b/src/Client.js
@@ -427,39 +427,37 @@ class Client extends EventEmitter {
});
}, Events);
- if (isAuthenticated === true) {
- await this.playPage.evaluate((Events) => {
- window.WPP.on('conn.main_ready', async () => {
- window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); });
- window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); });
- window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); });
- window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); });
- window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); });
- window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); });
- window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
- window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); });
- window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); });
- window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); });
- window.WPP.on('chat.new_message', (msg) => {
- if (msg.isNewMsg) {
- if (msg.type === 'ciphertext') {
- // defer message event until ciphertext is resolved (type changed)
- msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg)));
- } else {
- window.onAddMessageEvent(window.WAJS.getMessageModel(msg));
- }
+ await this.playPage.evaluate((Events) => {
+ window.WPP.on('conn.main_ready', async () => {
+ window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); });
+ window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); });
+ window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); });
+ window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); });
+ window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); });
+ window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); });
+ window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
+ window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); });
+ window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); });
+ window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); });
+ window.WPP.on('chat.new_message', (msg) => {
+ if (msg.isNewMsg) {
+ if (msg.type === 'ciphertext') {
+ // defer message event until ciphertext is resolved (type changed)
+ msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg)));
+ } else {
+ window.onAddMessageEvent(window.WAJS.getMessageModel(msg));
}
- });
- window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); });
-
- window.WPP.on('chat.new_reaction', (reaction) => {
- window.onReaction([reaction]);
- });
-
- window.EmitEvent(Events.READY);
+ }
});
- }, Events);
- }
+ window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); });
+
+ window.WPP.on('chat.new_reaction', (reaction) => {
+ window.onReaction([reaction]);
+ });
+
+ window.EmitEvent(Events.READY);
+ });
+ }, Events);
await this.playPage.evaluate((Events) => {
window.WPP.whatsapp.Cmd.on('logout', () => window.EmitEvent(Events.DISCONNECTED, 'NAVIGATION'));