From 25e8fd17929e1d6820da750b23142ade87356bbc Mon Sep 17 00:00:00 2001 From: Edgard Date: Fri, 26 Nov 2021 14:36:20 -0300 Subject: [PATCH] fix: Fixed compability with WhatsApp version 2.2144.11 --- src/whatsapp/misc/Clock.ts | 2 +- src/whatsapp/models/ProductMessageListModel.ts | 5 +++-- src/whatsapp/stores.ts | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/whatsapp/misc/Clock.ts b/src/whatsapp/misc/Clock.ts index 73b0ddb619..6a1640e35d 100644 --- a/src/whatsapp/misc/Clock.ts +++ b/src/whatsapp/misc/Clock.ts @@ -56,5 +56,5 @@ exportModule( ClockClass: (m) => m.Clock?.constructor || m.default?.constructor, Clock: (m) => m.Clock || m.default, }, - (m) => m.Clock.globalUnixTime || m.default.globalUnixTime + (m) => m.Clock?.globalUnixTime || m.default?.globalUnixTime ); diff --git a/src/whatsapp/models/ProductMessageListModel.ts b/src/whatsapp/models/ProductMessageListModel.ts index 4d811b2804..1401c58890 100644 --- a/src/whatsapp/models/ProductMessageListModel.ts +++ b/src/whatsapp/models/ProductMessageListModel.ts @@ -63,7 +63,8 @@ export declare class ProductMessageListModel extends Model { exportModule( exports, { - ProductMessageListModel: 'ProductMessageList', + ProductMessageListModel: (m) => m.ProductMessageList || m.default, }, - (m) => m.ProductMessageList + (m) => + m.ProductMessageList || m.default?.prototype?.proxyName === 'product_list' ); diff --git a/src/whatsapp/stores.ts b/src/whatsapp/stores.ts index 2ea9e7b077..f3eb96269e 100644 --- a/src/whatsapp/stores.ts +++ b/src/whatsapp/stores.ts @@ -110,10 +110,10 @@ for (const name of storeNames) { exportModule( exports, { - [name]: (m) => m[collectionName] || m[`${collectionName}Md`] || m.default, + [name]: (m) => m.default || m[collectionName], }, (m) => - (m[collectionName] || m[`${collectionName}Md`] || m.default) instanceof + (m.default || m[collectionName]) instanceof (collections as any)[collectionName] ); } @@ -121,23 +121,23 @@ for (const name of storeNames) { exportModule( exports, { - RecentStickerStore: (m) => m.RecentStickerCollectionMd, + RecentStickerStore: (m) => m.default || m.RecentStickerCollectionMd, }, - (m) => m.RecentStickerCollection && m.RecentStickerCollectionMd + (m) => m.RecentStickerCollection ); exportModule( exports, { - StarredMsgStore: (m) => m.AllStarredMsgsCollection, + StarredMsgStore: (m) => m.default || m.AllStarredMsgsCollection, }, - (m) => m.StarredMsgCollection && m.AllStarredMsgsCollection + (m) => m.StarredMsgCollection ); exportModule( exports, { - StickerPackStore: (m) => m.StickerPackCollectionMd, + StickerPackStore: (m) => m.default || m.StickerPackCollectionMd, }, - (m) => m.StickerPackCollection && m.StickerPackCollectionMd + (m) => m.StickerPackCollection );