From b9ec3fa6096881602b1d3e6592c44e303b272e96 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Sun, 22 Mar 2015 21:12:35 -0500 Subject: [PATCH] feat(plugin): Add Instagram support --- src/plugins/instagram.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/plugins/instagram.js diff --git a/src/plugins/instagram.js b/src/plugins/instagram.js new file mode 100644 index 00000000..06a5f3ae --- /dev/null +++ b/src/plugins/instagram.js @@ -0,0 +1,28 @@ +// install : cordova plugins add https://github.com/vstirbu/InstagramPlugin +// link : https://github.com/vstirbu/InstagramPlugin + +angular.module('ngCordova.plugins.instagram', []) + +.factory('$cordovaInstagram', ['$q', function ($q) { + + return { + share: function (options) { + var q = $q.defer(); + + if (!window.Instagram) { + console.error('Tried to call Instagram.share but the Instagram plugin isn\'t installed!'); + q.resolve(null); + return q.promise; + } + + Instagram.share(options.image, options.caption, function(err) { + if(err) { + q.reject(err); + } else { + q.resolve(true); + } + }); + return q.promise; + } + }; +}]);