Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit 2605cfe

Browse files
Graydagortok
authored andcommitted
Added shareWithOptions, which was introduced in 5.1.0 (#1263)
See https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#using-the-share-sheet for usage details
1 parent 7d1c506 commit 2605cfe

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/mocks/socialSharing.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,21 @@ ngCordovaMocks.factory('$cordovaSocialSharing', ['$q', function ($q) {
258258
defer.resolve();
259259
}
260260
return defer.promise;
261+
},
262+
263+
shareWithOptions: function (options) {
264+
var defer = $q.defer();
265+
if (this.throwsError) {
266+
defer.reject('There was an error sharing via SMS.');
267+
} else {
268+
this.message = options.message;
269+
this.subject = options.subject;
270+
this.attachments = options.files;
271+
this.link = options.url;
272+
273+
defer.resolve();
274+
}
275+
return defer.promise;
261276
}
262277
};
263278
}]);

src/plugins/socialSharing.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ angular.module('ngCordova.plugins.socialSharing', [])
2222
return q.promise;
2323
},
2424

25+
shareWithOptions: function (options) {
26+
var q = $q.defer();
27+
$window.plugins.socialsharing.shareWithOptions(options, function () {
28+
q.resolve(true);
29+
}, function () {
30+
q.reject(false);
31+
});
32+
return q.promise;
33+
},
34+
2535
shareViaTwitter: function (message, file, link) {
2636
var q = $q.defer();
2737
file = file || null;
@@ -139,7 +149,7 @@ angular.module('ngCordova.plugins.socialSharing', [])
139149
q.reject();
140150
}
141151
});
142-
152+
143153
return q.promise;
144154
}
145155
};

0 commit comments

Comments
 (0)