From ed166f58c8eb8ceed730e64cf9156c0121a7b7ec Mon Sep 17 00:00:00 2001 From: Maxime Pauvert Date: Mon, 14 Nov 2016 23:56:22 +0100 Subject: [PATCH] update version --- bower.json | 4 ++-- dist/angular-google-gapi.js | 6 +++--- dist/angular-google-gapi.min.js | 2 +- package.json | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bower.json b/bower.json index 1682446..271b641 100644 --- a/bower.json +++ b/bower.json @@ -1,11 +1,11 @@ { "name": "angular-google-gapi", - "version": "1.0.0", + "version": "1.0.1", "homepage": "https://maximepvrt.github.io/angular-google-gapi", "authors": [ "maximepvrt " ], - "description": "An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module use Google APIs Client Library for JavaScript, available for all GApis.", + "description": "An AngularJS module for using all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth. This module uses Google APIs Client Library for JavaScript, available for all GApis.", "main": "dist/angular-google-gapi.min.js", "keywords": [ "google apis", diff --git a/dist/angular-google-gapi.js b/dist/angular-google-gapi.js index 98b02b3..e1b6f20 100644 --- a/dist/angular-google-gapi.js +++ b/dist/angular-google-gapi.js @@ -342,12 +342,12 @@ (function() { 'use strict'; - angular.module('angular-google-gapi').factory('GClient', ['$document', '$q', '$window', - function ($document, $q, $window) { + angular.module('angular-google-gapi').factory('GClient', ['$document', '$q', '$window', '$timeout', + function ($document, $q, $window, $timeout) { var LOAD_GAE_API = false; var LOADING_GAE_API = false; - var URL = 'https://apis.google.com/js/client.js?onload=_gapiOnLoad'; + var URL = 'https://apis.google.com/js/client:platform.js?onload=_gapiOnLoad'; var API_KEY = null; var OBSERVER_CALLBACKS = []; diff --git a/dist/angular-google-gapi.min.js b/dist/angular-google-gapi.min.js index 81be615..56daf1a 100644 --- a/dist/angular-google-gapi.min.js +++ b/dist/angular-google-gapi.min.js @@ -3,4 +3,4 @@ * @version 1.0.0-beta.2 * @link https://github.com/maximepvrt/angular-google-gapi */ -!function(){"use strict";angular.module("angular-google-gapi",[])}(),function(){"use strict";angular.module("angular-google-gapi").factory("GApi",["$q","GClient","GData","$window",function(e,n,t,o){function r(e,n,t,o,r){var i={};i.api=e,i.apiLoad=!1,i.method=n,i.params=t,i.auth=o,i.deferred=r,p.push(i)}function i(t,r,i){var a=e.defer();return n.get().then(function(){o.gapi.client.load(t,r,void 0,i).then(function(e){var n={api:t,version:r,url:i};e&&e.hasOwnProperty("error")?(console.log(r),a.reject(n)):(a.resolve(n),f.push(t),u(t))})}),a.promise}function u(e){for(var n=e,o=0;o-1&&p.splice(o--,1))}}function a(e,n,t){for(var r=n.split("."),e=o.gapi.client[e],i=0;i-1?c(n,t,o,u):r(n,t,o,i,u),u.promise}function s(n,t){function o(e,n){e.apply(this,t).then(function(e){r.resolve(e)})["catch"](function(t){if(403==t.code&&t.message.toLowerCase().indexOf("limit exceeded")>-1||503==t.code){var i=2,u=1e3,a=Math.floor(1e3*Math.random()+1);5>n?setTimeout(function(){o(e,++n)},u*Math.pow(i,n)+a):r.reject(t)}else r.reject(t)})}var r=e.defer(),i=0;return o(n,i),r.promise}var f=[],p=[];return{executeCallbacks:function(){u()},load:i,createRequest:a,execute:function(e,n,t){return 3==arguments.length?l(e,n,t,!1):2==arguments.length?l(e,n,null,!1):void 0},executeAuth:function(e,n,t){return 3==arguments.length?s(l,arguments):2==arguments.length?s(l,arguments):void 0}}}])}(),function(){"use strict";angular.module("angular-google-gapi").factory("GAuth",["$rootScope","$q","GClient","GApi","GData","$interval","$window","$location",function(e,n,t,o,r,i,u,a){function c(){var e=n.defer();return 0==g?t.get().then(function(){u.gapi.client.load("oauth2","v2",function(){g=!0,e.resolve()})}):e.resolve(),e.promise}function l(e,n){function t(e,n){var t={client_id:p,scope:h,immediate:!1,authuser:-1,response_type:v};e&&(t.user_id=r.getUserId(),t.immediate=!0),void 0!=d&&(t.hd=d),u.gapi.auth.authorize(t,n)}e||g!==!0?c().then(function(){t(e,n)}):t(e,n)}function s(){function e(n){if("https://accounts.google.com"===n.origin){var r=JSON.parse(n.data);u.removeEventListener("message",e),r=t(r.a[0],"code"),void 0==r?o.reject():o.resolve(r)}}function t(e,n){n=n.replace(/[[]/,"[").replace(/[]]/,"]");var t=n+"=([^&#]*)",o=new RegExp(t),r=o.exec(e);return null==r?void 0:r[1]}var o=n.defer(),r=a.protocol()+"//"+a.hostname();(""!=a.port()||443!=a.port()&&"https"==a.protocol())&&(r=r+":"+a.port());u.open("https://accounts.google.com/o/oauth2/auth?scope="+encodeURI(h)+"&redirect_uri=postmessage&response_type=code&client_id="+p+"&access_type=offline&approval_prompt=force&origin="+r,null,"width=800, height=600");return u.addEventListener("message",e),o.promise}function f(){var e=n.defer();return u.gapi.client.oauth2.userinfo.get().execute(function(n){n.code?e.reject():(r.isLogin(!0),o.executeCallbacks(),n.name&&0!==n.name.length||(n.name=n.email),r.getUser(n),e.resolve(n))}),e.promise}var p,g=!1,d=void 0,h="https://www.googleapis.com/auth/userinfo.email",v="token id_token";return{setClient:function(e){p=e},setDomain:function(e){d=e},setScope:function(e){h=e},load:c,checkAuth:function(){var e=n.defer();return l(!0,function(){f().then(function(n){e.resolve(n)},function(){e.reject()})}),e.promise},login:function(){var e=n.defer();return l(!1,function(){f().then(function(n){e.resolve(n)},function(){e.reject()})}),e.promise},setToken:function(e){var t=n.defer();return c().then(function(){u.gapi.auth.setToken(e),f().then(function(){t.resolve()},function(){t.reject()})}),t.promise},getToken:function(){var e=n.defer();return c().then(function(){e.resolve(u.gapi.auth.getToken())}),e.promise},logout:function(){var e=n.defer();return c().then(function(){u.gapi.auth.setToken(null),r.isLogin(!1),r.getUser(null),e.resolve()}),e.promise},offline:function(){var e=n.defer();return s().then(function(n){e.resolve(n)},function(){e.reject()}),e.promise}}}])}(),function(){"use strict";angular.module("angular-google-gapi").factory("GClient",["$document","$q","$window",function(e,n,t){function o(o){var r=n.defer();t._gapiOnLoad=function(){r.resolve()};var i=e[0].createElement("script");return i.onerror=function(e){$timeout(function(){r.reject(e)})},i.src=o,e[0].body.appendChild(i),r.promise}var r=!1,i=!1,u="https://apis.google.com/js/client.js?onload=_gapiOnLoad",a=null,c=[];return{get:function(){var e=n.defer();return r?e.resolve():i?c.push(e):(i=!0,o(u).then(function(){t.gapi.client.setApiKey(a),r=!0,i=!1,e.resolve();for(var n=0;n-1&&p.splice(o--,1))}}function a(e,n,t){for(var r=n.split("."),e=o.gapi.client[e],i=0;i-1?c(n,t,o,u):r(n,t,o,i,u),u.promise}function l(n,t){function o(e,n){e.apply(this,t).then(function(e){r.resolve(e)})["catch"](function(t){if(403==t.code&&t.message.toLowerCase().indexOf("limit exceeded")>-1||503==t.code){var i=2,u=1e3,a=Math.floor(1e3*Math.random()+1);5>n?setTimeout(function(){o(e,++n)},u*Math.pow(i,n)+a):r.reject(t)}else r.reject(t)})}var r=e.defer(),i=0;return o(n,i),r.promise}var f=[],p=[];return{executeCallbacks:function(){u()},load:i,createRequest:a,execute:function(e,n,t){return 3==arguments.length?s(e,n,t,!1):2==arguments.length?s(e,n,null,!1):void 0},executeAuth:function(e,n,t){return 3==arguments.length?l(s,arguments):2==arguments.length?l(s,arguments):void 0}}}])}(),function(){"use strict";angular.module("angular-google-gapi").factory("GAuth",["$rootScope","$q","GClient","GApi","GData","$interval","$window","$location",function(e,n,t,o,r,i,u,a){function c(){var e=n.defer();return 0==g?t.get().then(function(){u.gapi.client.load("oauth2","v2",function(){g=!0,e.resolve()})}):e.resolve(),e.promise}function s(e,n){function t(e,n){var t={client_id:p,scope:h,immediate:!1,authuser:-1,response_type:v};e&&(t.user_id=r.getUserId(),t.immediate=!0),void 0!=d&&(t.hd=d),u.gapi.auth.authorize(t,n)}e||g!==!0?c().then(function(){t(e,n)}):t(e,n)}function l(){function e(n){if("https://accounts.google.com"===n.origin){var r=JSON.parse(n.data);u.removeEventListener("message",e),r=t(r.a[0],"code"),void 0==r?o.reject():o.resolve(r)}}function t(e,n){n=n.replace(/[[]/,"[").replace(/[]]/,"]");var t=n+"=([^&#]*)",o=new RegExp(t),r=o.exec(e);return null==r?void 0:r[1]}var o=n.defer(),r=a.protocol()+"//"+a.hostname();(""!=a.port()||443!=a.port()&&"https"==a.protocol())&&(r=r+":"+a.port());u.open("https://accounts.google.com/o/oauth2/auth?scope="+encodeURI(h)+"&redirect_uri=postmessage&response_type=code&client_id="+p+"&access_type=offline&approval_prompt=force&origin="+r,null,"width=800, height=600");return u.addEventListener("message",e),o.promise}function f(){var e=n.defer();return u.gapi.client.oauth2.userinfo.get().execute(function(n){n.code?e.reject():(r.isLogin(!0),o.executeCallbacks(),n.name&&0!==n.name.length||(n.name=n.email),r.getUser(n),e.resolve(n))}),e.promise}var p,g=!1,d=void 0,h="https://www.googleapis.com/auth/userinfo.email",v="token id_token";return{setClient:function(e){p=e},setDomain:function(e){d=e},setScope:function(e){h=e},load:c,checkAuth:function(){var e=n.defer();return s(!0,function(){f().then(function(n){e.resolve(n)},function(){e.reject()})}),e.promise},login:function(){var e=n.defer();return s(!1,function(){f().then(function(n){e.resolve(n)},function(){e.reject()})}),e.promise},setToken:function(e){var t=n.defer();return c().then(function(){u.gapi.auth.setToken(e),f().then(function(){t.resolve()},function(){t.reject()})}),t.promise},getToken:function(){var e=n.defer();return c().then(function(){e.resolve(u.gapi.auth.getToken())}),e.promise},logout:function(){var e=n.defer();return c().then(function(){u.gapi.auth.setToken(null),r.isLogin(!1),r.getUser(null),e.resolve()}),e.promise},offline:function(){var e=n.defer();return l().then(function(n){e.resolve(n)},function(){e.reject()}),e.promise}}}])}(),function(){"use strict";angular.module("angular-google-gapi").factory("GClient",["$document","$q","$window","$timeout",function(e,n,t,o){function r(r){var i=n.defer();t._gapiOnLoad=function(){i.resolve()};var u=e[0].createElement("script");return u.onerror=function(e){o(function(){i.reject(e)})},u.src=r,e[0].body.appendChild(u),i.promise}var i=!1,u=!1,a="https://apis.google.com/js/client:platform.js?onload=_gapiOnLoad",c=null,s=[];return{get:function(){var e=n.defer();return i?e.resolve():u?s.push(e):(u=!0,r(a).then(function(){t.gapi.client.setApiKey(c),i=!0,u=!1,e.resolve();for(var n=0;n