Skip to content

Commit

Permalink
fix: payload for webshare
Browse files Browse the repository at this point in the history
  • Loading branch information
Slicit committed Apr 22, 2021
1 parent 1de8c3e commit bf2fde4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ionic/www/js/services/social-sharing.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ angular
*/
service.webShare = function (message, subject, link, file) {
var payload = link ? link : file;
payload = [message, payload].join(' ').trim();
var payloadMsg = [message, payload].join(' ').trim();

var android = navigator.userAgent.match(/Android/i);
var ios = navigator.userAgent.match(/iPhone|iPad|iPod/i);
var isDesktop = !(ios || android); // on those two support "mobile deep links", so HTTP based fallback for all others.

// sms on ios 'sms:;body='+payload, on Android 'sms:?body='+payload
var shareUrls = {
whatsapp: (isDesktop ? 'https://api.whatsapp.com/send?text=' : 'whatsapp://send?text=') + payload,
whatsapp: (isDesktop ? 'https://api.whatsapp.com/send?text=' : 'whatsapp://send?text=') + payloadMsg,
facebook: 'https://www.facebook.com/sharer/sharer.php?u=' + payload,
twitter: 'https://twitter.com/intent/tweet?text=' + payload,
email: 'mailto:?subject=' + subject + '&body=' + payload,
sms: 'sms:?body=' + payload
twitter: 'https://twitter.com/intent/tweet?text=' + payloadMsg,
email: 'mailto:?subject=' + subject + '&body=' + payloadMsg,
sms: 'sms:?body=' + payloadMsg
};

var _buttons = [
Expand Down

0 comments on commit bf2fde4

Please sign in to comment.