Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vcard): parse vcard module #1995

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
11 changes: 6 additions & 5 deletions src/util/Injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ exports.ExposeStore = (moduleRaidStr) => {
window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
window.Store.Validators = window.mR.findModule('findLinks')[0];
window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
window.Store.VCardParse = window.mR.findModule('WA_BIZ_NAME')[0];
window.Store.WidFactory = window.mR.findModule('createWid')[0];
window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0];
window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0];
Expand Down Expand Up @@ -184,8 +185,8 @@ exports.LoadUtils = () => {
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);

// TODO remove .canReply() once all clients are updated to >= v2.2241.6
const canReply = window.Store.ReplyUtils ?
window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
const canReply = window.Store.ReplyUtils ?
window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
quotedMessage.canReply();

if (canReply) {
Expand Down Expand Up @@ -266,11 +267,11 @@ exports.LoadUtils = () => {
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
delete options.parseVCards;
try {
const parsed = window.Store.VCard.parseVcard(content);
const parsed = window.Store.VCardParse.parseVcard(content);
if (parsed) {
vcardOptions = {
type: 'vcard',
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
vcardFormattedName: window.Store.VCardParse.vcardGetNameFromParsed(parsed)
};
}
} catch (_) {
Expand All @@ -291,7 +292,7 @@ exports.LoadUtils = () => {
}
}
}

let buttonOptions = {};
if(options.buttons){
let caption;
Expand Down