getProfilePicture Fix => Evaluation failed: Error: Comms::sendIq called before startComms (#1264)

* Fix: Evaluation failed: Error: Comms::sendIq called before startComms

* [Requested Changes] - Only call Wap if we're not on MD & vice-versa

Co-authored-by: Joaquin Touris <joaquin@192.168.1.5>
This commit is contained in:
༺ LᴇG̸ᴇɴD ༻
2022-03-05 11:24:40 -03:00
committed by GitHub
parent ea2cc81d47
commit b96607338a

View File

@@ -876,11 +876,20 @@ class Client extends EventEmitter {
* @returns {Promise<string>}
*/
async getProfilePicUrl(contactId) {
const profilePic = await this.pupPage.evaluate((contactId) => {
const chatWid = window.Store.WidFactory.createWid(contactId);
return window.Store.getProfilePicFull(chatWid);
const profilePic = await this.pupPage.evaluate(async contactId => {
let asyncPic;
if (window.Store.Features.features.MD_BACKEND) {
const chatWid = window.Store.WidFactory.createWid(contactId);
asyncPic = await window.Store.getProfilePicFull(chatWid).catch(() => {
return undefined;
});
} else {
asyncPic = await window.Store.Wap.profilePicFind(contactId).catch(() => {
return undefined;
});
}
return asyncPic;
}, contactId);
return profilePic ? profilePic.eurl : undefined;
}