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

Social links aren't showing after vcard downloaded #56

Open
744322 opened this issue Oct 29, 2020 · 2 comments
Open

Social links aren't showing after vcard downloaded #56

744322 opened this issue Oct 29, 2020 · 2 comments

Comments

@744322
Copy link

744322 commented Oct 29, 2020

Actually I am facing the problem regarding the social links after downloading the vcard file just because it's not showing the social links in my vcard after download.
Here is the code:
var vCardsJS = require('vcards-js');
//create a new vCard
var vCard = vCardsJS();

//set properties
vCard.firstName = name;
vCard.organization = companyName;
vCard.workPhone = phone;
vCard.url = website;
vCard.workEmail = email;
vCard.socialUrls['facebook'] = facebook;
vCard.socialUrls['instagram'] = instagram;
vCard.socialUrls['twitter'] = twitter;
vCard.socialUrls['youtube'] = youtube;
vCard.socialUrls['snapchat'] = snapchat;
vCard.socialUrls['tiktok'] = tiktok;
vCard.socialUrls['whatsapp'] = whatsapp;
vCard.socialUrls['pinterest'] = pinterest;
let card = await vCard.getFormattedString();
Links are coming from my site front-end.

@yasmanets
Copy link

Is it an iOS or Android device? Labels don't work for both.
I suggest you look at these PR
https://github.com/enesser/vCards-js/pull/51
https://github.com/enesser/vCards-js/pull/52

@mgecawicz
Copy link

mgecawicz commented Mar 19, 2021

I did find a solution, but it is a bit of a workaround. I did some research on VCF formatting conventions and created the following edit to the vCardFormatter.js file which produces the desired effect:

if (vCard.socialUrls) {
for (var key in vCard.socialUrls) {
index++;
if (vCard.socialUrls.hasOwnProperty(key) &&
vCard.socialUrls[key]) {
formattedVCardString += 'item' + index + '.URL:' + vCard.socialUrls[key] + nl();
formattedVCardString += 'item' + index + '.X-ABLabel:' + key + nl();
// formattedVCardString += 'X-SOCIALPROFILE' + encodingPrefix + ';type=' + key + ':' + e(vCard.socialUrls[key]) + nl();
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants