Skip to content

Commit

Permalink
Fix window.Store.ProfilePic.profilePicFind is not a function error (#…
Browse files Browse the repository at this point in the history
…3001)

* Change window.Store.ProfilePic.profilePicFind to window.Store.ProfilePic.requestProfilePicFromServer

* Prevent breaking v2.2x

* refactor: make it more readable

---------

Co-authored-by: alechkos <[email protected]>
  • Loading branch information
seowzhenjun0126 and alechkos committed May 14, 2024
1 parent 64491be commit 975819d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,9 @@ class Client extends EventEmitter {
const profilePic = await this.pupPage.evaluate(async contactId => {
try {
const chatWid = window.Store.WidFactory.createWid(contactId);
return await window.Store.ProfilePic.profilePicFind(chatWid);
return window.WWebJS.compareWwebVersions(window.Debug.VERSION, '<', '2.3000.0')
? await window.Store.ProfilePic.profilePicFind(chatWid)
: await window.Store.ProfilePic.requestProfilePicFromServer(chatWid);
} catch (err) {
if(err.name === 'ServerStatusCodeError') return undefined;
throw err;
Expand Down

0 comments on commit 975819d

Please sign in to comment.