EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 908 forks source link

Share with link instead of image #870

Closed 1nfinite closed 4 years ago

1nfinite commented 7 years ago

I am using the shareWithOptions with options as follow. By default, when there is image file and url, facebook share will use image instead of url. Is there any way to configure to give priority to url instead?

var options = {
  message: 'share this', // not supported on some apps (Facebook, Instagram)
  subject: 'the subject', // fi. for email
  files: ['image.jpg'],
  url: 'https://www.website.com/foo/#bar?a=b',
  chooserTitle: 'Pick an app' // Android only, you can override the default share sheet title
}
muhsin-k commented 6 years ago

@1nfinite Did you get any solution?

1nfinite commented 6 years ago

@muhzi4u No. Do you have any suggestion?

muhsin-k commented 6 years ago

Yes.I just changed the implementation .First I will list all the possible options [Facebook, Whatsapp, etc] in a custom modal . Whenever we click on any option,

For Ex: Facebook ,then the following code will execute.

$cordovaSocialSharing
    .shareViaFacebookWithPasteMessageHint(message, null, webUrl)
    .then(function(success) {
        console.log('shareViaFacebook Success', success);
    }, function(err) {
        console.log('shareViaFacebook failed', err);
});

Whatsapp ,then the following code will execute.


 $cordovaSocialSharing
    .shareViaWhatsApp(message, imagePath, webUrl)
    .then(function(success) {
        console.log('shareViaWhatsApp Success', success);
    }, function(err) {
        console.log('shareViaWhatsApp failed', err);
});

So different code will execute based on the option.If you have any doubt.Please let me know.Thanks

1nfinite commented 6 years ago

@muhzi4u Thanks. But i am actually looking for a solution with shareWithOptions, something like

var options = {
  priority: 'link'
};
jerodfritz commented 4 years ago

PR here to resolve this https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/pull/1092