Skip to content

Commit

Permalink
fix: Fixed compatibility for WhatsApp >= 2.2329.7
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jul 11, 2023
1 parent 0431c55 commit bf34304
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/whatsapp/functions/fetchLinkPreview.ts
Expand Up @@ -58,9 +58,17 @@ export declare function fetchLinkPreview(
exportModule(
exports,
{
fetchLinkPreview: 'default',
fetchLinkPreview: [
'getLinkPreview', // @whatsapp >= 2.2329.7
'default', // @whatsapp < 2.2329.7
],
},
(m, id) => {
// @whatsapp >= 2.2329.7
if (m.getLinkPreview && !m.getAck) {
return true;
}
// @whatsapp < 2.2329.7
const source: string = webpack.moduleSource(id);
return (
source.includes('.genMinimalLinkPreview') &&
Expand Down
14 changes: 11 additions & 3 deletions src/whatsapp/misc/MediaBlobCache.ts
Expand Up @@ -40,8 +40,16 @@ export declare const MediaBlobCache: MediaBlobCacheImpl;
exportModule(
exports,
{
MediaBlobCacheImpl: 'MediaBlobCacheImpl',
MediaBlobCache: 'MediaBlobCache',
MediaBlobCacheImpl: [
'InMemoryMediaBlobCacheImpl', // @whatsapp >= 2.2329.7
'MediaBlobCacheImpl', // @whatsapp < 2.2329.7
],
MediaBlobCache: [
'InMemoryMediaBlobCache', // @whatsapp >= 2.2329.7
'MediaBlobCache', // @whatsapp < 2.2329.7
],
},
(m) => m.MediaBlobCache
(m) =>
m.InMemoryMediaBlobCacheImpl || // @whatsapp >= 2.2329.7
m.MediaBlobCache // @whatsapp < 2.2329.7
);

0 comments on commit bf34304

Please sign in to comment.