From 004312a99ffc8c94f8d7c0a4da28b613aead323a Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sat, 8 Feb 2020 01:12:25 -0400 Subject: [PATCH] expose some more fields on contacts --- src/structures/Contact.js | 30 ++++++++++++++++++++++++++++++ src/util/Injected.js | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/src/structures/Contact.js b/src/structures/Contact.js index 3b4b4b5..ccaf682 100644 --- a/src/structures/Contact.js +++ b/src/structures/Contact.js @@ -59,6 +59,36 @@ class Contact extends Base { this.verifiedLevel = data.verifiedLevel; this.verifiedName = data.verifiedName; + /** + * Indicates if the contact is the current user's contact + * @type {boolean} + */ + this.isMe = data.isMe; + + /** + * Indicates if the contact is a user contact + * @type {boolean} + */ + this.isUser = data.isUser; + + /** + * Indicates if the contact is a group contact + * @type {boolean} + */ + this.isGroup = data.isGroup; + + /** + * Indicates if the number is registered on WhatsApp + * @type {boolean} + */ + this.isWAContact = data.isWAContact; + + /** + * Indicates if the number is saved in the current phone's contacts + * @type {boolean} + */ + this.isMyContact = data.isMyContact; + return super._patch(data); } diff --git a/src/util/Injected.js b/src/util/Injected.js index a78b4c2..99d0be1 100644 --- a/src/util/Injected.js +++ b/src/util/Injected.js @@ -140,6 +140,12 @@ exports.LoadUtils = () => { res.businessProfile = contact.businessProfile.serialize(); } + res.isMe = contact.isMe; + res.isUser = contact.isUser; + res.isGroup = contact.isGroup; + res.isWAContact = contact.isWAContact; + res.isMyContact = contact.isMyContact; + return res; };