Skip to content

Commit

Permalink
fix: Fixed compatibility with WhatsApp Web >= 2.2222.8
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jun 14, 2022
1 parent 817592b commit a1d994c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/tools/updateModuleID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function start() {

page.on('console', (message) => {
if (message.type() !== 'debug') {
console.log('browser', message.type(), message.text(), ...message.args());
console.log('browser', message.type(), message.text());
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/whatsapp/collections/BaseCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ export declare class BaseCollection<C, A = C | C[]> extends Collection<C> {
exportModule(
exports,
{ BaseCollection: 'BaseCollection' },
(m) => m.CACHE_POLICY || m.BaseCollection
(m) => m.BaseCollection
);
69 changes: 60 additions & 9 deletions src/whatsapp/functions/handleAck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,92 @@ export interface SimpleAckData {
biz?: null;
}

/** @whatsapp 90756 */
/**
* @whatsapp 90756
* @deprecated
*/
export declare function handleStatusSimpleAck(
ackData: SimpleAckData
): Promise<any>;

/** @whatsapp 48309 */
/**
* @whatsapp 48309
* @deprecated
*/
export declare function handleChatSimpleAck(
ackData: SimpleAckData
): Promise<any>;

/** @whatsapp 84947 */
/**
* @whatsapp 84947
* @deprecated
*/
export declare function handleGroupSimpleAck(
ackData: SimpleAckData
): Promise<any>;

/** @whatsapp 90756 */
export declare function handleStatusSimpleReceipt(
ackData: SimpleAckData
): Promise<any>;

/** @whatsapp 48309 */
export declare function handleChatSimpleReceipt(
ackData: SimpleAckData
): Promise<any>;

/** @whatsapp 84947 */
export declare function handleGroupSimpleReceipt(
ackData: SimpleAckData
): Promise<any>;

exportModule(
exports,
{
handleStatusSimpleAck: 'handleStatusSimpleAck',
handleStatusSimpleAck: [
'handleStatusSimpleReceipt', // @whatsapp >= 2.2222.8
'handleStatusSimpleAck',
],
handleStatusSimpleReceipt: [
'handleStatusSimpleReceipt', // @whatsapp >= 2.2222.8
'handleStatusSimpleAck',
],
},
(m) => m.handleStatusSimpleAck
(m) =>
m.handleStatusSimpleReceipt || // @whatsapp >= 2.2222.8
m.handleStatusSimpleAck
);

exportModule(
exports,
{
handleChatSimpleAck: 'handleChatSimpleAck',
handleChatSimpleAck: [
'handleChatSimpleReceipt', // @whatsapp >= 2.2222.8
'handleChatSimpleAck',
],
handleChatSimpleReceipt: [
'handleChatSimpleReceipt', // @whatsapp >= 2.2222.8
'handleChatSimpleAck',
],
},
(m) => m.handleChatSimpleAck
(m) =>
m.handleChatSimpleReceipt || // @whatsapp >= 2.2222.8
m.handleChatSimpleAck
);

exportModule(
exports,
{
handleGroupSimpleAck: 'handleGroupSimpleAck',
handleGroupSimpleAck: [
'handleGroupSimpleReceipt', // @whatsapp >= 2.2222.8
'handleGroupSimpleAck',
],
handleGroupSimpleReceipt: [
'handleGroupSimpleReceipt', // @whatsapp >= 2.2222.8
'handleGroupSimpleAck',
],
},
(m) => m.handleGroupSimpleAck
(m) =>
m.handleGroupSimpleReceipt || // @whatsapp >= 2.2222.8
m.handleGroupSimpleAck
);
6 changes: 5 additions & 1 deletion src/whatsapp/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ for (const name of storeNames) {
exportModule(
exports,
{
RecentStickerStore: ['default', 'RecentStickerCollectionMd'],
RecentStickerStore: [
'default',
'RecentStickerCollectionMd',
'RecentStickerCollection', // @whatsapp >= 2.2222.8
],
},
(m) => m.RecentStickerCollection
);
Expand Down

0 comments on commit a1d994c

Please sign in to comment.