Skip to content
This repository has been archived by the owner on Mar 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #160 from shaibo10/sms-fix
Browse files Browse the repository at this point in the history
Sms fix: text that contains '%' wont crash sms share
  • Loading branch information
45kb authored Sep 29, 2016
2 parents a160062 + 39206c7 commit c36e95e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
10 changes: 8 additions & 2 deletions dist/angular-socialshare.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* http://720kb.github.io/angular-socialshare
*
* MIT license
* Tue Sep 27 2016
* Wed Sep 28 2016
*/
/*global angular*/
/*eslint no-loop-func:0, func-names:0*/
Expand Down Expand Up @@ -263,6 +263,7 @@
{
'provider': 'sms',
'conf': {
'url': '',
'text': '',
'to': '',
'trigger': 'click'
Expand Down Expand Up @@ -765,7 +766,12 @@
}
,manageSmsShare = function smsShare($window, attrs, element) {

var body = encodeURIComponent(attrs.socialshareText)
if(attrs.socialshareText.indexOf('%')>=0)
{
$log.warn('sending sms text with "%" sign is not supported');
}

var body = encodeURIComponent(attrs.socialshareText.replace('%','')) + ' - ' + encodeURIComponent(attrs.socialshareUrl)
, toPhoneNumber = attrs.socialshareTo || ''
, urlString = 'sms:' + toPhoneNumber + '?&body=' + body;

Expand Down
2 changes: 1 addition & 1 deletion dist/angular-socialshare.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit c36e95e

Please sign in to comment.