From 2cabd00de7773a40c521dea71779045582bb6efc Mon Sep 17 00:00:00 2001 From: gine Date: Sat, 18 Mar 2017 12:43:16 +0100 Subject: [PATCH] Preparazione dell'app per aggiungere il bottone per fare lo sharing --- www/index.html | 4 +++- www/js/share.js | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 www/js/share.js diff --git a/www/index.html b/www/index.html index f877b89..5bf17ef 100644 --- a/www/index.html +++ b/www/index.html @@ -43,6 +43,7 @@ + + diff --git a/www/js/share.js b/www/js/share.js new file mode 100644 index 0000000..d3b99c1 --- /dev/null +++ b/www/js/share.js @@ -0,0 +1,19 @@ +// this is the complete list of currently supported params you can pass to the plugin (all optional) +var options = { + message: 'share this', // not supported on some apps (Facebook, Instagram) + subject: 'the subject', // fi. for email + files: ['', ''], // an array of filenames either locally or remotely + url: 'https://www.website.com/foo/#bar?a=b', + chooserTitle: 'Pick an app' // Android only, you can override the default share sheet title +} + +var onSuccess = function(result) { + console.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true + console.log("Shared to app: " + result.app); // On Android result.app is currently empty. On iOS it's empty when sharing is cancelled (result.completed=false) +} + +var onError = function(msg) { + console.log("Sharing failed with message: " + msg); +} + +window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError); \ No newline at end of file