feat: get profile pic url by user ID

This moves the function from Contact to Client to enable getting profile picture without requiring a conversation before. The old function is still available on Contact for convenience and backwards-compatibility.
This commit is contained in:
Pedro Lopez
2020-04-11 19:03:47 -04:00
parent 7eb7fa8e28
commit 8528d9b0b6
2 changed files with 13 additions and 5 deletions

View File

@@ -103,11 +103,7 @@ class Contact extends Base {
* @returns {Promise<string>}
*/
async getProfilePicUrl() {
const profilePic = await this.client.pupPage.evaluate((contactId) => {
return window.Store.Wap.profilePicFind(contactId);
}, this.id._serialized);
return profilePic ? profilePic.eurl : undefined;
return await this.client.getProfilePicUrl(this.id._serialized);
}
}