diff options
Diffstat (limited to 'www/lib/ngCordova')
| -rw-r--r-- | www/lib/ngCordova/.bower.json | 13 | ||||
| -rw-r--r-- | www/lib/ngCordova/README.md | 1 | ||||
| -rw-r--r-- | www/lib/ngCordova/bower.json | 2 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova-mocks.js | 4000 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova-mocks.min.js | 4 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova.js | 2833 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova.min.js | 9 | ||||
| -rw-r--r-- | www/lib/ngCordova/package.json | 3 |
8 files changed, 3578 insertions, 3287 deletions
diff --git a/www/lib/ngCordova/.bower.json b/www/lib/ngCordova/.bower.json index 66dd58e4..6e1dcaed 100644 --- a/www/lib/ngCordova/.bower.json +++ b/www/lib/ngCordova/.bower.json @@ -1,6 +1,6 @@ { "name": "ngCordova", - "version": "0.1.15-alpha", + "version": "0.1.17-alpha", "homepage": "http://ngCordova.com/", "authors": [ "Max Lynch <max@drifty.com>", @@ -42,14 +42,13 @@ "angular-mocks": ">= 1.2.23", "jquery": "~2.1.1" }, - "_release": "0.1.15-alpha", + "_release": "0.1.17-alpha", "_resolution": { "type": "version", - "tag": "v0.1.15-alpha", - "commit": "dbdfe5b9c716002548bc4a5e8d1fd5dc2de788ed" + "tag": "v0.1.17-alpha", + "commit": "712fe8d7de28a2abf354e146ef0c364b04f1d136" }, "_source": "git://github.com/driftyco/ng-cordova.git", - "_target": "~0.1.15-alpha", - "_originalSource": "ngCordova", - "_direct": true + "_target": ">= 0.1.14-alpha", + "_originalSource": "ngCordova" } diff --git a/www/lib/ngCordova/README.md b/www/lib/ngCordova/README.md index d64c8424..2b1350bb 100644 --- a/www/lib/ngCordova/README.md +++ b/www/lib/ngCordova/README.md @@ -66,7 +66,6 @@ $ bower install ngCordova - [Globalization](https://github.com/apache/cordova-plugin-globalization) * - [Google Ads](https://github.com/floatinghotpot/cordova-admob-pro) - [Google Analytics](https://github.com/danwilson/google-analytics-plugin) -- [Google Maps]() - [HealthKit for iOS](https://github.com/Telerik-Verified-Plugins/HealthKit) - [Httpd (Web Server)](https://github.com/floatinghotpot/cordova-httpd) - [Apple iAd](https://github.com/floatinghotpot/cordova-iad-pro) diff --git a/www/lib/ngCordova/bower.json b/www/lib/ngCordova/bower.json index 1b1ce504..46d9e0c5 100644 --- a/www/lib/ngCordova/bower.json +++ b/www/lib/ngCordova/bower.json @@ -1,6 +1,6 @@ { "name": "ngCordova", - "version": "0.1.15-alpha", + "version": "0.1.17-alpha", "homepage": "http://ngCordova.com/", "authors": [ "Max Lynch <max@drifty.com>", diff --git a/www/lib/ngCordova/dist/ng-cordova-mocks.js b/www/lib/ngCordova/dist/ng-cordova-mocks.js index cda8cf4f..77606630 100644 --- a/www/lib/ngCordova/dist/ng-cordova-mocks.js +++ b/www/lib/ngCordova/dist/ng-cordova-mocks.js @@ -1,16 +1,16 @@ /*! * ngCordova - * v0.1.15-alpha + * v0.1.17-alpha * Copyright 2014 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */ (function(){ var ngCordovaMocks = angular.module('ngCordovaMocks', []); -ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function($q) { +ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function ($q) { var throwsError = false; return { throwsError: throwsError, - getAppVersion: function() { + getAppVersion: function () { var defer = $q.defer(); defer.resolve('mock v'); return defer.promise; @@ -25,89 +25,91 @@ ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function($q) { * @description * A service for testing barcode scanner features * in an app build with ngCordova. -**/ -ngCordovaMocks.factory('$cordovaBarcodeScanner', ['$q', function($q) { - var throwsError = false; + **/ +ngCordovaMocks.factory('$cordovaBarcodeScanner', ['$q', function ($q) { + var throwsError = false; - var scannedText = ''; - var scannedFormat = ''; - var wasCancelled = false; + var scannedText = ''; + var scannedFormat = ''; + var wasCancelled = false; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaBarcodeScanner - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name scannedText - * @propertyOf ngCordovaMocks.cordovaBarcodeScanner - * - * @description - * Used to simulate the result.text property of a - * successful scan. For more information, see the text at - * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin - * This property should only be used in automated tests. - **/ - scannedText: scannedText, - - /** - * @ngdoc property - * @name scannedFormat - * @propertyOf ngCordovaMocks.cordovaBarcodeScanner - * - * @description - * Used to simulate the result.format property of a - * successful scan. For more information, see the text at - * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin - * This property should only be used in automated tests. - **/ - scannedFormat: scannedFormat, - - /** - * @ngdoc property - * @name wasCancelled - * @propertyOf ngCordovaMocks.cordovaBarcodeScanner - * - * @description - * Used to simulate the result.cancelled property of a - * successful scan. For more information, see the text at - * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin - * This property should only be used in automated tests. - **/ - wasCancelled: wasCancelled, - - scan: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error scanning.'); - } else { - defer.resolve({text: this.scannedText, format: this.scannedFormat, cancelled: this.wasCancelled }); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaBarcodeScanner + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, - encode: function(type, data) { - this.scannedFormat = type; - this.scannedText = data; - - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error encoding the data.'); - } else { - defer.resolve(); - } - return defer.promise; - } - }; + /** + * @ngdoc property + * @name scannedText + * @propertyOf ngCordovaMocks.cordovaBarcodeScanner + * + * @description + * Used to simulate the result.text property of a + * successful scan. For more information, see the text at + * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin + * This property should only be used in automated tests. + **/ + scannedText: scannedText, + + /** + * @ngdoc property + * @name scannedFormat + * @propertyOf ngCordovaMocks.cordovaBarcodeScanner + * @description + * Used to simulate the result.format property of a + * successful scan. For more information, see the text at + * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin + * This property should only be used in automated tests. + **/ + scannedFormat: scannedFormat, + + /** + * @ngdoc property + * @name wasCancelled + * @propertyOf ngCordovaMocks.cordovaBarcodeScanner + * + * @description + * Used to simulate the result.cancelled property of a + * successful scan. For more information, see the text at + * https://github.com/wildabeast/BarcodeScanner/#using-the-plugin + * This property should only be used in automated tests. + **/ + wasCancelled: wasCancelled, + + scan: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error scanning.'); + } else { + defer.resolve({text: this.scannedText, format: this.scannedFormat, cancelled: this.wasCancelled}); + } + + return defer.promise; + }, + + encode: function (type, data) { + this.scannedFormat = type; + this.scannedText = data; + + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error encoding the data.'); + } else { + defer.resolve(); + } + + return defer.promise; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaBLE @@ -115,46 +117,46 @@ ngCordovaMocks.factory('$cordovaBarcodeScanner', ['$q', function($q) { * @description * A service for ble features * in an app build with ngCordova. -**/ -ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', function($q, $timeout) { - var deviceScan = { - "name": "Test Device", - "id": "AA:BB:CC:DD:EE:FF", - "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], - "rssi": -55 + **/ +ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', function ($q, $timeout) { + var deviceScan = { + name: 'Test Device', + id: 'AA:BB:CC:DD:EE:FF', + advertising: [2, 1, 6, 3, 3, 15, 24, 8, 9, 66, 97, 116, 116, 101, 114, 121], + rssi: -55 }; var deviceConnect = { - "name": "Test Device", - "id": "AA:BB:CC:DD:EE:FF", - "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], - "rssi": -55, - "services": [ - "1800", - "1801", - "180f" + name: 'Test Device', + id: 'AA:BB:CC:DD:EE:FF', + advertising: [2, 1, 6, 3, 3, 15, 24, 8, 9, 66, 97, 116, 116, 101, 114, 121], + rssi: -55, + services: [ + '1800', + '1801', + '180f' ], - "characteristics": [ + characteristics: [ { - "service": "1800", - "characteristic": "2a00", - "properties": [ "Read" ] + service: '1800', + characteristic: '2a00', + properties: ['Read'] }, { - "service": "1800", - "characteristic": "2a01", - "properties": [ "Read" ] + service: '1800', + characteristic: '2a01', + properties: ['Read'] }, { - "service": "1801", - "characteristic": "2a05", - "properties": [ "Read" ] + service: '1801', + characteristic: '2a05', + properties: ['Read'] }, { - "service": "180f", - "characteristic": "2a19", - "properties": [ "Read" ], - "descriptors": [ { "uuid": "2901" }, { "uuid": "2904" } ] + service: '180f', + characteristic: '2a19', + properties: ['Read'], + descriptors: [{'uuid': '2901'}, {'uuid': '2904'}] } ] }; @@ -167,7 +169,7 @@ ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', function($q, $timeout) var q = $q.defer(); $timeout(function () { q.resolve(deviceScan); - }, seconds*1000); + }, seconds * 1000); return q.promise; }, @@ -238,9 +240,33 @@ ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', function($q, $timeout) q.resolve(true); return q.promise; } - }; + }; }]); +ngCordovaMocks.factory('$cordovaBrightness', ['$q', function ($q) { + var currentBrightness = 100; + + return { + get: function () { + var q = $q.defer(); + q.resolve(currentBrightness); + return q.promise; + }, + + set: function (data) { + var q = $q.defer(); + currentBrightness = data; + q.resolve('OK'); + return q.promise; + }, + + setKeepScreenOn: function (bool) { + var q = $q.defer(); + q.resolve('OK'); + return q.promise; + } + }; +}]); /** * @ngdoc service * @name ngCordovaMocks.cordovaCamera @@ -248,23 +274,23 @@ ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', function($q, $timeout) * @description * A service for testing camera features * in an app build with ngCordova. -**/ -ngCordovaMocks.factory('$cordovaCamera', ['$q', function($q) { - var throwsError = false; + **/ +ngCordovaMocks.factory('$cordovaCamera', ['$q', function ($q) { + var throwsError = false; var imageData = ''; - return { + return { /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaCamera - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaCamera + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, /** * @ngdoc property @@ -277,20 +303,21 @@ ngCordovaMocks.factory('$cordovaCamera', ['$q', function($q) { **/ imageData: imageData, - getPicture: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the picture.'); - } else { - if (options) { - options = options; // This is just to get by JSHint. - } + getPicture: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the picture.'); + } else { + if (options) { + options = options; // This is just to get by JSHint. + } defer.resolve(this.imageData); - } - return defer.promise; - } - }; + } + + return defer.promise; + } + }; }]); /** @@ -303,52 +330,56 @@ ngCordovaMocks.factory('$cordovaCamera', ['$q', function($q) { * * @example */ -ngCordovaMocks.factory('$cordovaCapture', ['$q', function($q) { - var throwsError = false; +ngCordovaMocks.factory('$cordovaCapture', ['$q', function ($q) { + var throwsError = false; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaCapture - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - captureAudio : function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error capturing the audio.'); - } else { - defer.resolve(); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaCapture + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, - captureImage: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error capturing the image.'); - } else { - defer.resolve(); - } - return defer.promise; - }, + captureAudio: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error capturing the audio.'); + } else { + defer.resolve(); + } - captureVideo: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error capturing the video.'); - } else { - defer.resolve(); - } - return defer.promise; - } - }; + return defer.promise; + }, + + captureImage: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error capturing the image.'); + } else { + defer.resolve(); + } + + return defer.promise; + }, + + captureVideo: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error capturing the video.'); + } else { + defer.resolve(); + } + + return defer.promise; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaContacts @@ -356,115 +387,120 @@ ngCordovaMocks.factory('$cordovaCapture', ['$q', function($q) { * @description * A service for testing features related with contacts * in an app build with ngCordova. -**/ -ngCordovaMocks.factory('$cordovaContacts', ['$q', function($q) { - var throwsError = false; - var contacts = []; + **/ +ngCordovaMocks.factory('$cordovaContacts', ['$q', function ($q) { + var throwsError = false; + var contacts = []; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaContacts - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc contacts - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaContacts - * - * @description - * An in-memory collection of contacts. - * This property should only be used in automated tests. - **/ - contacts: contacts, - - save: function(contact) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error saving the contact.'); - } else { - var existingIndex = null; - for (var i=0; i<this.contacts.length; i++) { - // The actual implementation relies on the entire object match. - // we're gong to rely on the ID. - if (this.contacts[i].id === contact.id) { - existingIndex = i; - break; - } - } - - if (existingIndex === null) { - this.contacts.push(contact); - defer.resolve(); - } else { - defer.reject('Contact already exists.'); - } - } - return defer.promise; - }, + return { + /** + @ngdoc property + @name throwsError + @propertyOf ngCordovaMocks.cordovaContacts + + @description + A flag that signals whether a promise should be rejected or not. + This property should only be used in automated tests. + */ + throwsError: throwsError, - remove: function(contact) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error saving the contact.'); - } else { - var toRemove = null; - for (var i=0; i<this.contacts.length; i++) { - // The actual implementation relies on the entire object match. - // we're gong to rely on the ID. - if (this.contacts[i].id === contact.id) { - toRemove = i; - break; - } - } - - if (toRemove === null) { - defer.reject('Unable to find contact.'); - } else { - this.contacts.splice(toRemove, 1); - defer.resolve(); - } - } - return defer.promise; - }, + /** + @ngdoc contacts + @name throwsError + @propertyOf ngCordovaMocks.cordovaContacts - find: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error finding the contact.'); - } else { - var fields = options.fields || ['id', 'displayName']; - delete options.fields; - - if (!fields) { - defer.reject('ContactError.INVALID_ARGUMENT_ERROR'); - } else { - if (fields === '*') { - defer.resolve(this.contacts); - } else { - // Implement a very rudimentary search approach for testing purposes. - // This is NOT exhaustive. - var results = []; - for (var i=0; i<this.contacts.length; i++) { - for(var key in this.contacts[i]) { - var propertyValue = this.contacts[i][key]; - } - } - // TODO: Search by individual fields - defer.resolve(results); - } - } - } - return defer.promise; - } - }; + @description + An in-memory collection of contacts. + This property should only be used in automated tests. + */ + contacts: contacts, + + save: function (contact) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error saving the contact.'); + } else { + var existingIndex = null; + for (var i = 0; i < this.contacts.length; i++) { + // The actual implementation relies on the entire object match. + // we're gong to rely on the ID. + if (this.contacts[i].id === contact.id) { + existingIndex = i; + break; + } + } + + if (existingIndex === null) { + this.contacts.push(contact); + defer.resolve(); + } else { + defer.reject('Contact already exists.'); + } + } + + return defer.promise; + }, + + remove: function (contact) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error saving the contact.'); + } else { + var toRemove = null; + for (var i = 0; i < this.contacts.length; i++) { + // The actual implementation relies on the entire object match. + // we're gong to rely on the ID. + if (this.contacts[i].id === contact.id) { + toRemove = i; + break; + } + } + + if (toRemove === null) { + defer.reject('Unable to find contact.'); + } else { + this.contacts.splice(toRemove, 1); + defer.resolve(); + } + } + + return defer.promise; + }, + + find: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error finding the contact.'); + } else { + var fields = options.fields || ['id', 'displayName']; + delete options.fields; + + if (!fields) { + defer.reject('ContactError.INVALID_ARGUMENT_ERROR'); + } else { + if (fields === '*') { + defer.resolve(this.contacts); + } else { + // Implement a very rudimentary search approach for testing purposes. + // This is NOT exhaustive. + var results = []; + for (var i = 0; i < this.contacts.length; i++) { + for (var key in this.contacts[i]) { + var propertyValue = this.contacts[i][key]; + } + } + + // TODO: Search by individual fields + defer.resolve(results); + } + } + } + + return defer.promise; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaDatePicker @@ -491,107 +527,108 @@ ngCordovaMocks.factory('$cordovaDatePicker', ['$q', function ($q) { * @description * A service for testing device information * in an app build with ngCordova. -**/ + **/ ngCordovaMocks.factory('$cordovaDevice', function () { - var device = ''; - var cordova = ''; - var model = ''; - var platform = ''; - var uuid = ''; - var version = ''; + var device = ''; + var cordova = ''; + var model = ''; + var platform = ''; + var uuid = ''; + var version = ''; - return { - /** - * @ngdoc property - * @name device - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The name of the 'device'. - * This property should only be used in automated tests. - **/ - device: device, - - /** - * @ngdoc property - * @name cordova - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The version of cordova in use. - * This property should only be used in automated tests. - **/ - cordova: cordova, - - /** - * @ngdoc property - * @name model - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The model of the device using the app. - * This property should only be used in automated tests. - **/ - model: model, - - /** - * @ngdoc property - * @name platform - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The name of the operating system in use. - * This property should only be used in automated tests. - **/ - platform: platform, - - /** - * @ngdoc property - * @name uuid - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The unique identifier of a device. - * This property should only be used in automated tests. - **/ - uuid: uuid, - - /** - * @ngdoc property - * @name version - * @propertyOf ngCordovaMocks.cordovaDevice - * - * @description - * The version of the operating system. - * This property should only be used in automated tests. - **/ - version: version, - - getDevice: function () { - return this.device; - }, + return { + /** + @ngdoc property + @name device + @propertyOf ngCordovaMocks.cordovaDevice - getCordova: function () { - return this.cordova; - }, + @description + The name of the 'device'. + This property should only be used in automated tests. + */ + device: device, - getModel: function () { - return this.model; - }, + /** + @ngdoc property + @name cordova + @propertyOf ngCordovaMocks.cordovaDevice - getPlatform: function() { - return this.platform; - }, + @description + The version of cordova in use. + This property should only be used in automated tests. + */ + cordova: cordova, - getUUID: function() { - return this.uuid; - }, + /** + @ngdoc property + @name model + @propertyOf ngCordovaMocks.cordovaDevice - getVersion: function() { - return this.version; - } - }; + @description + The model of the device using the app. + This property should only be used in automated tests. + */ + model: model, + + /** + @ngdoc property + @name platform + @propertyOf ngCordovaMocks.cordovaDevice + + @description + The name of the operating system in use. + This property should only be used in automated tests. + */ + platform: platform, + + /** + @ngdoc property + @name uuid + @propertyOf ngCordovaMocks.cordovaDevice + + @description + The unique identifier of a device. + This property should only be used in automated tests. + */ + uuid: uuid, + + /** + @ngdoc property + @name version + @propertyOf ngCordovaMocks.cordovaDevice + + @description + The version of the operating system. + This property should only be used in automated tests. + */ + version: version, + + getDevice: function () { + return this.device; + }, + + getCordova: function () { + return this.cordova; + }, + + getModel: function () { + return this.model; + }, + + getPlatform: function () { + return this.platform; + }, + + getUUID: function () { + return this.uuid; + }, + + getVersion: function () { + return this.version; + } + }; }); + /** * @ngdoc service * @name ngCordovaMocks.cordovaDeviceMotion @@ -599,135 +636,138 @@ ngCordovaMocks.factory('$cordovaDevice', function () { * @description * A service for mocking the accelerometer * in an app build with ngCordova. -**/ + **/ ngCordovaMocks.factory('$cordovaDeviceMotion', ['$interval', '$q', function ($interval, $q) { - var currentAcceleration = null; - var throwsError = false; - var positions = []; - var watchIntervals = []; + var currentAcceleration = null; + var throwsError = false; + var positions = []; + var watchIntervals = []; - return { - /** - * @ngdoc property - * @name currentAcceleration - * @propertyOf ngCordovaMocks.cordovaDeviceMotion - * - * @description - * The current acceleration. - * This property should only be used in automated tests. - **/ - currentAcceleration: currentAcceleration, - - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaDeviceMotion - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name positions - * @propertyOf ngCordovaMocks.cordovaDeviceMotion - * - * @description - * The collection of 'positions' that have been logged. - * This property should only be used in automated tests. - **/ - positions: positions, - - /** - * @ngdoc property - * @name watchIntervals - * @propertyOf ngCordovaMocks.cordovaDeviceMotion - * - * @description - * The collection of watchers that are currently active. - * This property should only be used in automated tests. - **/ - watchIntervals: watchIntervals, - - getCurrentAcceleration: function () { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the current acceleration.'); - } else { - defer.resolve(this.currentAcceleration); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name currentAcceleration + * @propertyOf ngCordovaMocks.cordovaDeviceMotion + * + * @description + * The current acceleration. + * This property should only be used in automated tests. + **/ + currentAcceleration: currentAcceleration, - watchAcceleration : function (options) { - var defer = $q.defer(); - var watchId = Math.floor((Math.random() * 1000000) + 1); - - this.positions = []; - self = this; - - if (this.throwsError) { - defer.reject('There was an error watching the current acceleration.'); - } else { - var delay = 10000; // The default based on https://github.com/apache/cordova-plugin-device-motion/blob/master/doc/index.md - if (options && options.frequency) { - delay = options.frequency; - } - - this.watchIntervals.push($interval( - function() { - if (self.throwsError) { - defer.reject('There was an error watching the acceleration.'); - } - - // Generate a random position - var randomX = Math.floor((Math.random() * 100) + 1); - var randomY = Math.floor((Math.random() * 100) + 1); - var randomZ = Math.floor((Math.random() * 100) + 1); - var result = { x: randomX, y: randomY, z:randomZ, timestamp:Date.now() }; - - self.positions.push(result); - defer.notify(result); - }, - delay - )); - } - - return { - watchId: watchId, - promise: defer.promise - }; - }, + /** + @ngdoc property + @name throwsError + @propertyOf ngCordovaMocks.cordovaDeviceMotion + + @description + A flag that signals whether a promise should be rejected or not. + This property should only be used in automated tests. + */ + throwsError: throwsError, - clearWatch: function (watchId) { - var defer = $q.defer(); - if (watchId) { - if (this.throwsError) { - defer.reject('Unable to clear watch.'); - } else { - var removed = -1; - for (var i=0; i<this.watchIntervals.length; i++) { - if (this.watchIntervals[i].watchId === watchId) { - $interval.cancel(watchIntervals[i].interval); - removed = i; - break; - } - } - - if (removed !== -1) { - this.watchIntervals.splice(removed, 1); - } - } - } else { - defer.reject('Unable to clear watch. No watch ID provided.'); - } - return defer.promise; - } - }; + /** + @ngdoc property + @name positions + @propertyOf ngCordovaMocks.cordovaDeviceMotion + + @description + The collection of 'positions' that have been logged. + This property should only be used in automated tests. + */ + positions: positions, + + /** + @ngdoc property + @name watchIntervals + @propertyOf ngCordovaMocks.cordovaDeviceMotion + + @description + The collection of watchers that are currently active. + This property should only be used in automated tests. + */ + watchIntervals: watchIntervals, + + getCurrentAcceleration: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the current acceleration.'); + } else { + defer.resolve(this.currentAcceleration); + } + + return defer.promise; + }, + + watchAcceleration: function (options) { + var defer = $q.defer(); + var watchId = Math.floor((Math.random() * 1000000) + 1); + + this.positions = []; + self = this; + + if (this.throwsError) { + defer.reject('There was an error watching the current acceleration.'); + } else { + var delay = 10000; // The default based on https://github.com/apache/cordova-plugin-device-motion + if (options && options.frequency) { + delay = options.frequency; + } + + this.watchIntervals.push($interval( + function () { + if (self.throwsError) { + defer.reject('There was an error watching the acceleration.'); + } + + // Generate a random position + var randomX = Math.floor((Math.random() * 100) + 1); + var randomY = Math.floor((Math.random() * 100) + 1); + var randomZ = Math.floor((Math.random() * 100) + 1); + var result = {x: randomX, y: randomY, z: randomZ, timestamp: Date.now()}; + + self.positions.push(result); + defer.notify(result); + }, + delay + )); + } + + return { + watchId: watchId, + promise: defer.promise + }; + }, + + clearWatch: function (watchId) { + var defer = $q.defer(); + if (watchId) { + if (this.throwsError) { + defer.reject('Unable to clear watch.'); + } else { + var removed = -1; + for (var i = 0; i < this.watchIntervals.length; i++) { + if (this.watchIntervals[i].watchId === watchId) { + $interval.cancel(watchIntervals[i].interval); + removed = i; + break; + } + } + + if (removed !== -1) { + this.watchIntervals.splice(removed, 1); + } + } + } else { + defer.reject('Unable to clear watch. No watch ID provided.'); + } + + return defer.promise; + } + }; }]); - /** + +/** * @ngdoc service * @name ngCordovaMocks.cordovaDeviceOrientation * @@ -736,156 +776,158 @@ ngCordovaMocks.factory('$cordovaDeviceMotion', ['$interval', '$q', function ($in * in an app build with ngCordova. */ ngCordovaMocks.factory('$cordovaDeviceOrientation', ['$interval', '$q', function ($interval, $q) { - var currentHeading = null; - var throwsError = false; - var readings = []; - var watchIntervals = []; + var currentHeading = null; + var throwsError = false; + var readings = []; + var watchIntervals = []; - return { - /** - * @ngdoc property - * @name currentHeading - * @propertyOf ngCordovaMocks.cordovaDeviceOrientation - * - * @description - * The current heading. - * This property should only be used in automated tests. - **/ - currentHeading: currentHeading, - - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaDeviceOrientation - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name positions - * @propertyOf ngCordovaMocks.cordovaDeviceOrientation - * - * @description - * The collection of compass 'readings' that have been logged. - * This property should only be used in automated tests. - **/ - readings: readings, - - /** - * @ngdoc property - * @name watchIntervals - * @propertyOf ngCordovaMocks.cordovaDeviceOrientation - * - * @description - * The collection of watchers that are currently active. - * This property should only be used in automated tests. - **/ - watchIntervals: watchIntervals, - - getCurrentHeading: function () { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the current heading.'); - } else { - defer.resolve(this.currentHeading); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name currentHeading + * @propertyOf ngCordovaMocks.cordovaDeviceOrientation + * + * @description + * The current heading. + * This property should only be used in automated tests. + **/ + currentHeading: currentHeading, + + /** + @ngdoc property + @name throwsError + @propertyOf ngCordovaMocks.cordovaDeviceOrientation + + @description + A flag that signals whether a promise should be rejected or not. + This property should only be used in automated tests. + */ + throwsError: throwsError, + + /** + @ngdoc property + @name positions + @propertyOf ngCordovaMocks.cordovaDeviceOrientation + + @description + The collection of compass 'readings' that have been logged. + This property should only be used in automated tests. + */ + readings: readings, + + /** + @ngdoc property + @name watchIntervals + @propertyOf ngCordovaMocks.cordovaDeviceOrientation + + @description + The collection of watchers that are currently active. + This property should only be used in automated tests. + */ + watchIntervals: watchIntervals, + + getCurrentHeading: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the current heading.'); + } else { + defer.resolve(this.currentHeading); + } + + return defer.promise; + }, + + watchHeading: function (options) { + var defer = $q.defer(); + var watchID = Math.floor((Math.random() * 1000000) + 1); + var self = this; - watchHeading: function (options) { - var defer = $q.defer(); - var watchID = Math.floor((Math.random() * 1000000) + 1); - var self = this; - - self.readings = []; - - if (self.throwsError) { - defer.reject('There was an error getting the compass heading.'); - } else { - var delay = 100; // The default based on https://github.com/apache/cordova-plugin-device-orientation/blob/master/doc/index.md - if (options && options.frequency) { - delay = options.frequency; - } - - self.watchIntervals.push({ - watchID: watchID, - interval: $interval( - function() { - if (self.throwsError) { - defer.reject('There was an error watching the acceleration.'); - } - - // Generate a random position - var magneticHeading = (Math.random() * 359.99) + 1; - var trueHeading = (Math.random() * 359.99) + 1; - var headingAccuracy = Math.floor((Math.random() * 360) + 1); - var result = { magneticHeading: magneticHeading, trueHeading: trueHeading, headingAccuracy:headingAccuracy, timestamp:Date.now() }; - - self.readings.push(result); - defer.notify(result); - }, - delay - ) - }); - } - - var cancel = function(id) { - var removed = -1; - for (var i=0; i<self.watchIntervals.length; i++) { - if (self.watchIntervals[i].watchID === id) { - $interval.cancel(watchIntervals[i].interval); - removed = i; - break; - } - } - - if (removed !== -1) { - self.watchIntervals.splice(removed, 1); - } - }; - - defer.promise.cancel = function() { - cancel(watchID); + self.readings = []; + + if (self.throwsError) { + defer.reject('There was an error getting the compass heading.'); + } else { + var delay = 100; // The default based on https://github.com/apache/cordova-plugin-device-orientation + if (options && options.frequency) { + delay = options.frequency; + } + + self.watchIntervals.push({ + watchID: watchID, + interval: $interval( + function () { + if (self.throwsError) { + defer.reject('There was an error watching the acceleration.'); + } + + // Generate a random position + var magneticHeading = (Math.random() * 359.99) + 1; + var trueHeading = (Math.random() * 359.99) + 1; + var headingAccuracy = Math.floor((Math.random() * 360) + 1); + var result = {magneticHeading: magneticHeading, trueHeading: trueHeading, headingAccuracy: headingAccuracy, timestamp: Date.now()}; + + self.readings.push(result); + defer.notify(result); + }, + delay + ) + }); + } + + var cancel = function (id) { + var removed = -1; + for (var i = 0; i < self.watchIntervals.length; i++) { + if (self.watchIntervals[i].watchID === id) { + $interval.cancel(watchIntervals[i].interval); + removed = i; + break; + } + } + + if (removed !== -1) { + self.watchIntervals.splice(removed, 1); + } }; - defer.promise.clearWatch = function(id) { - cancel(id || watchID); + defer.promise.cancel = function () { + cancel(watchID); + }; + + defer.promise.clearWatch = function (id) { + cancel(id || watchID); }; defer.promise.watchID = watchID; return defer.promise; - }, + }, - clearWatch: function (watchId) { - var defer = $q.defer(); - if (watchId) { - if (this.throwsError) { - defer.reject('Unable to clear watch.'); - } else { - var removed = -1; - for (var i=0; i<this.watchIntervals.length; i++) { - if (this.watchIntervals[i].watchId === watchId) { - $interval.cancel(watchIntervals[i].interval); - removed = i; - break; - } - } - - if (removed !== -1) { - this.watchIntervals.splice(removed, 1); - } - } - } else { - defer.reject('Unable to clear watch. No watch ID provided.'); - } - return defer.promise; - } - }; + clearWatch: function (watchId) { + var defer = $q.defer(); + if (watchId) { + if (this.throwsError) { + defer.reject('Unable to clear watch.'); + } else { + var removed = -1; + for (var i = 0; i < this.watchIntervals.length; i++) { + if (this.watchIntervals[i].watchId === watchId) { + $interval.cancel(watchIntervals[i].interval); + removed = i; + break; + } + } + + if (removed !== -1) { + this.watchIntervals.splice(removed, 1); + } + } + } else { + defer.reject('Unable to clear watch. No watch ID provided.'); + } + + return defer.promise; + } + }; }]); /** @@ -897,153 +939,154 @@ ngCordovaMocks.factory('$cordovaDeviceOrientation', ['$interval', '$q', function * in an app build with ngCordova. */ ngCordovaMocks.factory('$cordovaDialogs', ['$q', function ($q) { - var dialogText = false; - var dialogTitle = ''; - var defaultValue = ''; - var promptResponse = ''; - var beepCount = 0; - var useHostAbilities = true; + var dialogText = false; + var dialogTitle = ''; + var defaultValue = ''; + var promptResponse = ''; + var beepCount = 0; + var useHostAbilities = true; - return { - /** - * @ngdoc property - * @name dialogText - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * The main content in the dialog. - * This property should only be used in automated tests. - **/ - dialogText: dialogText, - - /** - * @ngdoc property - * @name dialogTitle - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * The title of the dialog. - * This property should only be used in automated tests. - **/ - dialogTitle: dialogTitle, - - /** - * @ngdoc property - * @name defaultValue - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * The default value to be used in a prompt. - * This property should only be used in automated tests. - **/ - defaultValue: defaultValue, - - /** - * @ngdoc property - * @name promptResponse - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * Used to simulate a user's response to a prompt. - * This property should only be used in automated tests. - **/ - promptResponse: promptResponse, - - /** - * @ngdoc property - * @name buttonLabels - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * An array of the text of each button in the dialog. - * This property should only be used in automated tests. - **/ - buttonLabels: [], - - /** - * @ngdoc property - * @name beepCount - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * The number of times a beep has occurred. - * This property should only be used in automated tests. - **/ - beepCount: beepCount, - - /** - * @ngdoc property - * @name useHostAbilities - * @propertyOf ngCordovaMocks.cordovaDialogs - * - * @description - * A flag that signals whether or not to try and use the host's - * (browser or otherwise) prompting capabilities. - * This property should only be used in automated tests. - **/ - useHostAbilities: useHostAbilities, - - alert: function(message, title, buttonName) { - var d = $q.defer(); - - if (this.useHostAbilities) { - // NOTE: The window.alert method doesn't support a title or callbacks. - alert(message); - d.resolve(); - } else { - this.dialogText = message; - this.dialogTitle = title; - this.buttonLabels.push(buttonName); - d.resolve(); - } - - return d.promise; - }, + return { + /** + @ngdoc property + @name dialogText + @propertyOf ngCordovaMocks.cordovaDialogs - confirm: function(message, title, buttonName) { - var d = $q.defer(); - - if (this.useHostAbilities) { - // NOTE: The window.confirm method doesn't support a title or custom button naming. - var result = confirm(message); - d.resolve(result ? 2 : 1); - } else { - this.dialogText = message; - this.dialogTitle = title; - this.buttonLabels.push(buttonName); - d.resolve(0); - } - - return d.promise; - }, + @description + The main content in the dialog. + This property should only be used in automated tests. + */ + dialogText: dialogText, - prompt: function(message, title, buttonLabels, defaultText) { - var d = $q.defer(); + /** + @ngdoc property + @name dialogTitle + @propertyOf ngCordovaMocks.cordovaDialogs - if (this.useHostAbilities) { - // NOTE: The window.prompt method doesn't support a title or custom button naming. - var result = prompt(message, defaultText); - d.resolve(result); - } else { - this.dialogText = message; - this.dialogTitle = title; - this.defaultValue = defaultText; + @description + The title of the dialog. + This property should only be used in automated tests. + */ + dialogTitle: dialogTitle, - for (var i=0; i<buttonLabels.length; i++) { - this.buttonLabels.push(buttonLabels[i]); - } + /** + @ngdoc property + @name defaultValue + @propertyOf ngCordovaMocks.cordovaDialogs - d.resolve(this.promptResponse); - } + @description + The default value to be used in a prompt. + This property should only be used in automated tests. + */ + defaultValue: defaultValue, - return d.promise; - }, + /** + @ngdoc property + @name promptResponse + @propertyOf ngCordovaMocks.cordovaDialogs - beep: function(times) { - this.beepCount = times; - } - }; + @description + Used to simulate a user's response to a prompt. + This property should only be used in automated tests. + */ + promptResponse: promptResponse, + + /** + @ngdoc property + @name buttonLabels + @propertyOf ngCordovaMocks.cordovaDialogs + + @description + An array of the text of each button in the dialog. + This property should only be used in automated tests. + */ + buttonLabels: [], + + /** + @ngdoc property + @name beepCount + @propertyOf ngCordovaMocks.cordovaDialogs + + @description + The number of times a beep has occurred. + This property should only be used in automated tests. + */ + beepCount: beepCount, + + /** + @ngdoc property + @name useHostAbilities + @propertyOf ngCordovaMocks.cordovaDialogs + + @description + A flag that signals whether or not to try and use the host's + (browser or otherwise) prompting capabilities. + This property should only be used in automated tests. + */ + useHostAbilities: useHostAbilities, + + alert: function (message, title, buttonName) { + var d = $q.defer(); + + if (this.useHostAbilities) { + // NOTE: The window.alert method doesn't support a title or callbacks. + alert(message); + d.resolve(); + } else { + this.dialogText = message; + this.dialogTitle = title; + this.buttonLabels.push(buttonName); + d.resolve(); + } + + return d.promise; + }, + + confirm: function (message, title, buttonName) { + var d = $q.defer(); + + if (this.useHostAbilities) { + // NOTE: The window.confirm method doesn't support a title or custom button naming. + var result = confirm(message); + d.resolve(result ? 2 : 1); + } else { + this.dialogText = message; + this.dialogTitle = title; + this.buttonLabels.push(buttonName); + d.resolve(0); + } + + return d.promise; + }, + + prompt: function (message, title, buttonLabels, defaultText) { + var d = $q.defer(); + + if (this.useHostAbilities) { + // NOTE: The window.prompt method doesn't support a title or custom button naming. + var result = prompt(message, defaultText); + d.resolve(result); + } else { + this.dialogText = message; + this.dialogTitle = title; + this.defaultValue = defaultText; + + for (var i = 0; i < buttonLabels.length; i++) { + this.buttonLabels.push(buttonLabels[i]); + } + + d.resolve(this.promptResponse); + } + + return d.promise; + }, + + beep: function (times) { + this.beepCount = times; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaFile @@ -1052,192 +1095,197 @@ ngCordovaMocks.factory('$cordovaDialogs', ['$q', function ($q) { * A service for testing interaction with device directories and files * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaFile', ['$q', function($q) { - var throwsError = false; - var fileSystem = {}; - var shouldMockFiles = false; - var files = {}; - - var mockIt = function(errorMessage) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject(errorMessage); - } else { - defer.resolve(); - } - return defer.promise; - }; +ngCordovaMocks.factory('$cordovaFile', ['$q', function ($q) { + var throwsError = false; + var fileSystem = {}; + var shouldMockFiles = false; + var files = {}; + + var mockIt = function (errorMessage) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject(errorMessage); + } else { + defer.resolve(); + } - return { + return defer.promise; + }; + + return { /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaFile - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name fileSystem - * @propertyOf ngCordovaMocks.cordovaFile - * - * @description - * A fake, in-memory file system. This is incomplete at this time. - * This property should only be used in automated tests. - **/ - fileSystem: fileSystem, - - /** - * @ngdoc property - * @name shouldMockFiles - * @propertyOf ngCordovaMocks.cordovaFile - * - * @description - * A flag that signals whether one wish to mock files. - * This is useful if you need mocks specific file scenarios. - * This property should only be used in automated tests. - **/ - shouldMockFiles: shouldMockFiles, - - /** - * @ngdoc property - * @name files - * @propertyOf ngCordovaMocks.cordovaFile - * - * @description - * An object that may be used for mocking files on the device. - * This property should only be used in automated tests. - * - * **/ - files : files, - - checkDir: function(directory) { - if(this.shouldMockFiles){ - var defer = $q.defer(); - if(this.files[directory] && !this.files[directory].isFile){ - defer.resolve(); - } - else{ - defer.reject(); - } - return defer.promise; - } + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaFile + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, - return mockIt.call(this, 'There was an error checking the directory.'); - }, + /** + * @ngdoc property + * @name fileSystem + * @propertyOf ngCordovaMocks.cordovaFile + * + * @description + * A fake, in-memory file system. This is incomplete at this time. + * This property should only be used in automated tests. + **/ + fileSystem: fileSystem, - createDir: function(directory, overwrite) { - if(this.shouldMockFiles ){ - var defer = $q.defer(); - this.files[directory] = { isFile : false}; - defer.resolve(); - return defer.promise; - } - return mockIt.call(this, 'There was an error creating the directory.'); - }, + /** + * @ngdoc property + * @name shouldMockFiles + * @propertyOf ngCordovaMocks.cordovaFile + * + * @description + * A flag that signals whether one wish to mock files. + * This is useful if you need mocks specific file scenarios. + * This property should only be used in automated tests. + **/ + shouldMockFiles: shouldMockFiles, - listDir: function(filePath) { - return mockIt.call(this, 'There was an error listing the directory'); - }, + /** + * @ngdoc property + * @name files + * @propertyOf ngCordovaMocks.cordovaFile + * + * @description + * An object that may be used for mocking files on the device. + * This property should only be used in automated tests. + * + * **/ + files: files, + + checkDir: function (directory) { + if (this.shouldMockFiles) { + var defer = $q.defer(); + if (this.files[directory] && !this.files[directory].isFile) { + defer.resolve(); + } else { + defer.reject(); + } - checkFile: function(filePath) { - if(this.shouldMockFiles){ - var defer = $q.defer(); - if(this.files[filePath] && this.files[filePath].isFile){ - defer.resolve(); - } - else{ - defer.reject(); - } - return defer.promise; - } - return mockIt.call(this, 'There was an error checking for the file.'); - }, - - - createFile: function(filePath,overwrite) { - if(this.shouldMockFiles){ - var defer = $q.defer(); - this.files[filePath] = { - isFile : true, - fileContent : '' - }; - defer.resolve(); - return defer.promise; - } + return defer.promise; + } - return mockIt.call(this, 'There was an error creating the file.'); - }, + return mockIt.call(this, 'There was an error checking the directory.'); + }, - removeFile: function(directory, file) { - return mockIt.call(this,'There was an error removng the file.'); - }, + createDir: function (directory, overwrite) { + if (this.shouldMockFiles) { + var defer = $q.defer(); + this.files[directory] = {isFile: false}; + defer.resolve(); + return defer.promise; + } - writeFile: function(filePath,data,options) { - if(this.shouldMockFiles && filePath && data){ - this.files[filePath] = { - isFile : true, - fileContent : data - }; - } - return mockIt.call(this,'There was an error writing the file.'); - }, - - readFile: function(filePath) { - return this.readAsText(filePath); - }, - - readAsText: function (filePath) { - if(this.shouldMockFiles){ - var defer = $q.defer(); - if(files[filePath] && files[filePath].isFile){ - defer.resolve(files[filePath].fileContent); - } - else{ - defer.reject(); - } - return defer.promise; - } - return mockIt.call(this, 'There was an error reading the file as text.'); - }, + return mockIt.call(this, 'There was an error creating the directory.'); + }, - readAsDataURL: function (filePath) { - return mockIt.call(this, 'There was an error reading the file as a data url.'); - }, + listDir: function (filePath) { + return mockIt.call(this, 'There was an error listing the directory'); + }, - readAsBinaryString: function (filePath) { - return mockIt.call(this, 'There was an error reading the file as a binary string.'); - }, + checkFile: function (filePath) { + if (this.shouldMockFiles) { + var defer = $q.defer(); + if (this.files[filePath] && this.files[filePath].isFile) { + defer.resolve(); + } else { + defer.reject(); + } - readAsArrayBuffer: function (filePath) { - return mockIt.call(this, 'There was an error reading the file as an array buffer.'); - }, + return defer.promise; + } - readFileMetadata: function (filePath) { - return mockIt.call(this, 'There was an error reading the file metadata'); - }, + return mockIt.call(this, 'There was an error checking for the file.'); + }, - readFileAbsolute: function (filePath) { - return mockIt.call(this, 'There was an error reading the file from the absolute path'); - }, + createFile: function (filePath, overwrite) { + if (this.shouldMockFiles) { + var defer = $q.defer(); + this.files[filePath] = { + isFile: true, + fileContent: '' + }; + defer.resolve(); + return defer.promise; + } - readFileMetadataAbsolute: function (filePath) { - return mockIt.call(this, 'There was an error reading the file metadta from the absolute path'); - }, + return mockIt.call(this, 'There was an error creating the file.'); + }, - downloadFile: function(source, filePath, trust, options) { - return mockIt.call(this, 'There was an error downloading the file.'); - }, + removeFile: function (directory, file) { + return mockIt.call(this, 'There was an error removng the file.'); + }, - uploadFile: function(server, filePath, options) { - return mockIt.call(this, 'There was an error uploading the file.'); - } - }; + writeFile: function (filePath, data, options) { + if (this.shouldMockFiles && filePath && data) { + this.files[filePath] = { + isFile: true, + fileContent: data + }; + } + + return mockIt.call(this, 'There was an error writing the file.'); + }, + + readFile: function (filePath) { + return this.readAsText(filePath); + }, + + readAsText: function (filePath) { + if (this.shouldMockFiles) { + var defer = $q.defer(); + if (files[filePath] && files[filePath].isFile) { + defer.resolve(files[filePath].fileContent); + } else { + defer.reject(); + } + + return defer.promise; + } + + return mockIt.call(this, 'There was an error reading the file as text.'); + }, + + readAsDataURL: function (filePath) { + return mockIt.call(this, 'There was an error reading the file as a data url.'); + }, + + readAsBinaryString: function (filePath) { + return mockIt.call(this, 'There was an error reading the file as a binary string.'); + }, + + readAsArrayBuffer: function (filePath) { + return mockIt.call(this, 'There was an error reading the file as an array buffer.'); + }, + + readFileMetadata: function (filePath) { + return mockIt.call(this, 'There was an error reading the file metadata'); + }, + + readFileAbsolute: function (filePath) { + return mockIt.call(this, 'There was an error reading the file from the absolute path'); + }, + + readFileMetadataAbsolute: function (filePath) { + return mockIt.call(this, 'There was an error reading the file metadta from the absolute path'); + }, + + downloadFile: function (source, filePath, trust, options) { + return mockIt.call(this, 'There was an error downloading the file.'); + }, + + uploadFile: function (server, filePath, options) { + return mockIt.call(this, 'There was an error uploading the file.'); + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaFileOpener2 @@ -1267,7 +1315,7 @@ ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { var defer = $q.defer(); - if(this.throwError) { + if (this.throwError) { defer.reject({ status: 0, message: 'There was an error capturing the file.' @@ -1284,7 +1332,7 @@ ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { var defer = $q.defer(); - if(this.throwError) { + if (this.throwError) { defer.reject({ status: 0, message: 'There was an error capturing the packageId.' @@ -1301,7 +1349,7 @@ ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { var defer = $q.defer(); - if(this.throwError) { + if (this.throwError) { defer.reject({ status: 0, message: 'There was an error capturing the packageId.' @@ -1327,235 +1375,237 @@ ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { * A service for testing location services * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaGeolocation', ['$interval', '$q', function($interval, $q) { - var throwsError = false; - var useHostAbilities = true; +ngCordovaMocks.factory('$cordovaGeolocation', ['$interval', '$q', function ($interval, $q) { + var throwsError = false; + var useHostAbilities = true; - var watchIntervals = []; - var locations = []; - var currentPosition = null; - var nextPosition = null; + var watchIntervals = []; + var locations = []; + var currentPosition = null; + var nextPosition = null; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name watchIntervals - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * The collection of watchers that are currently active. - * This property should only be used in automated tests. - **/ - watchIntervals: watchIntervals, - - /** - * @ngdoc property - * @name locations - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * The collection of 'locations' that have been logged. - * This property should only be used in automated tests. - **/ - locations: locations, - - /** - * @ngdoc property - * @name currentPosition - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * The last location logged. - * This property should only be used in automated tests. - **/ - currentPosition: currentPosition, - - /** - * @ngdoc property - * @name nextPosition - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * The position to be logged the next time that a watcher - * gets the location. - * This property should only be used in automated tests. - **/ - nextPosition: nextPosition, - - /** - * @ngdoc property - * @name useHostAbilities - * @propertyOf ngCordovaMocks.cordovaGeolocation - * - * @description - * A flag that signals whether or not to try and use the host's - * (browser or otherwise) geolocation capabilities. - * This property should only be used in automated tests. - **/ - useHostAbilities: useHostAbilities, - - getCurrentPosition: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the location.'); - } else { - if (options) { - options = options; // This is just to get by JSHint. - } - - if (this.useHostAbilities) { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition( - function(position) { - this.currentPosition = position; - defer.resolve(this.currentPosition); - }, - function(error) { - defer.reject(error); - } - ); - } else { - defer.reject('Geolocation is not supported by this browser.'); - } - } else { - defer.resolve(this.currentPosition); - } - } - return defer.promise; - }, + return { + /** + @ngdoc property + @name throwsError + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + A flag that signals whether a promise should be rejected or not. + This property should only be used in automated tests. + */ + throwsError: throwsError, - watchPosition: function(options) { - var defer = $q.defer(); - var watchID = Math.floor((Math.random() * 1000000) + 1); - var self = this; - - self.locations = []; - - if (self.throwsError) { - defer.reject('There was an error getting the geolocation.'); - } else { - var delay = 1000; - if (options && options.timeout) { - delay = options.timeout; - } - - self.watchIntervals.push({ - watchID: watchID, - interval: $interval( - function() { - if (self.throwsError) { - defer.reject('There was an error watching the geolocation.'); - } - - // Attempt to use nextPosition. - var result = self.nextPosition; - if (result === null) { - // Determine whether to use the host's geolocation capabilities or not - if (self.useHostAbilities) { - if (navigator.geolocation) { - navigator.geolocation.getCurrentPosition( - function(position) { - self.currentPosition = position; - self.locations.push(position); - defer.resolve(position); - }, - function(error) { - defer.reject(error); - } - ); - } else { - defer.reject('Geolocation is not supported by this browser.'); - } - } else { - result = { - coords: { - latitude: ((Math.random() * 180) + 1) - 90, - longitude: ((Math.random() * 360) + 1) - 180, - altitude: ((Math.random() * 100) + 1), - - accuracy: ((Math.random() * 10) + 1), - altitudeAccuracy: ((Math.random() * 10) + 1), - heading: ((Math.random() * 360) + 1), - speed: ((Math.random() * 100) + 1) - }, - timestamp: Date.now() - }; - - self.currentPosition = result; - self.locations.push(result); - defer.notify(result); - } - } - }, - delay - ) - }); - } - - var cancel = function(id) { - var removed = -1; - for (var i=0; i<self.watchIntervals.length; i++) { - if (self.watchIntervals[i].watchID === id) { - $interval.cancel(watchIntervals[i].interval); - removed = i; - break; - } - } - - if (removed !== -1) { - self.watchIntervals.splice(removed, 1); - } - }; - - defer.promise.cancel = function() { - cancel(watchID); + /** + @ngdoc property + @name watchIntervals + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + The collection of watchers that are currently active. + This property should only be used in automated tests. + */ + watchIntervals: watchIntervals, + + /** + @ngdoc property + @name locations + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + The collection of 'locations' that have been logged. + This property should only be used in automated tests. + */ + locations: locations, + + /** + @ngdoc property + @name currentPosition + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + The last location logged. + This property should only be used in automated tests. + */ + currentPosition: currentPosition, + + /** + @ngdoc property + @name nextPosition + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + The position to be logged the next time that a watcher + gets the location. + This property should only be used in automated tests. + */ + nextPosition: nextPosition, + + /** + @ngdoc property + @name useHostAbilities + @propertyOf ngCordovaMocks.cordovaGeolocation + + @description + A flag that signals whether or not to try and use the host's + (browser or otherwise) geolocation capabilities. + This property should only be used in automated tests. + */ + useHostAbilities: useHostAbilities, + + getCurrentPosition: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the location.'); + } else { + if (options) { + options = options; // This is just to get by JSHint. + } + + if (this.useHostAbilities) { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + function (position) { + this.currentPosition = position; + defer.resolve(this.currentPosition); + }, + function (error) { + defer.reject(error); + } + ); + } else { + defer.reject('Geolocation is not supported by this browser.'); + } + } else { + defer.resolve(this.currentPosition); + } + } + + return defer.promise; + }, + + watchPosition: function (options) { + var defer = $q.defer(); + var watchID = Math.floor((Math.random() * 1000000) + 1); + var self = this; + + self.locations = []; + + if (self.throwsError) { + defer.reject('There was an error getting the geolocation.'); + } else { + var delay = 1000; + if (options && options.timeout) { + delay = options.timeout; + } + + self.watchIntervals.push({ + watchID: watchID, + interval: $interval( + function () { + if (self.throwsError) { + defer.reject('There was an error watching the geolocation.'); + } + + // Attempt to use nextPosition. + var result = self.nextPosition; + if (result === null) { + // Determine whether to use the host's geolocation capabilities or not + if (self.useHostAbilities) { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + function (position) { + self.currentPosition = position; + self.locations.push(position); + defer.resolve(position); + }, + function (error) { + defer.reject(error); + } + ); + } else { + defer.reject('Geolocation is not supported by this browser.'); + } + } else { + result = { + coords: { + latitude: ((Math.random() * 180) + 1) - 90, + longitude: ((Math.random() * 360) + 1) - 180, + altitude: ((Math.random() * 100) + 1), + + accuracy: ((Math.random() * 10) + 1), + altitudeAccuracy: ((Math.random() * 10) + 1), + heading: ((Math.random() * 360) + 1), + speed: ((Math.random() * 100) + 1) + }, + timestamp: Date.now() + }; + + self.currentPosition = result; + self.locations.push(result); + defer.notify(result); + } + } + }, + delay + ) + }); + } + + var cancel = function (id) { + var removed = -1; + for (var i = 0; i < self.watchIntervals.length; i++) { + if (self.watchIntervals[i].watchID === id) { + $interval.cancel(watchIntervals[i].interval); + removed = i; + break; + } + } + + if (removed !== -1) { + self.watchIntervals.splice(removed, 1); + } + }; + + defer.promise.cancel = function () { + cancel(watchID); }; - defer.promise.clearWatch = function(id) { - cancel(id || watchID); + defer.promise.clearWatch = function (id) { + cancel(id || watchID); }; defer.promise.watchID = watchID; return defer.promise; - }, + }, - clearWatch: function (watchID) { - var defer = $q.defer(); - if (watchID) { - if (this.throwsError) { - defer.reject('Unable to clear watch.'); - } else { - var removed = -1; - for (var i=0; i<this.watchIntervals.length; i++) { - if (this.watchIntervals[i].watchID === watchID) { - $interval.cancel(watchIntervals[i].interval); - removed = i; - break; - } - } - - if (removed !== -1) { - this.watchIntervals.splice(removed, 1); - } - } - } else { - defer.reject('Unable to clear watch. No watch ID provided.'); - } - return defer.promise; - } - }; + clearWatch: function (watchID) { + var defer = $q.defer(); + if (watchID) { + if (this.throwsError) { + defer.reject('Unable to clear watch.'); + } else { + var removed = -1; + for (var i = 0; i < this.watchIntervals.length; i++) { + if (this.watchIntervals[i].watchID === watchID) { + $interval.cancel(watchIntervals[i].interval); + removed = i; + break; + } + } + + if (removed !== -1) { + this.watchIntervals.splice(removed, 1); + } + } + } else { + defer.reject('Unable to clear watch. No watch ID provided.'); + } + + return defer.promise; + } + }; }]); /** @@ -1566,236 +1616,258 @@ ngCordovaMocks.factory('$cordovaGeolocation', ['$interval', '$q', function($inte * A service for testing features related to a user's locale and timezone. * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaGlobalization', ['$q', function($q) { - var throwsError = false; - var language = (navigator.language) ? navigator.language : "en-US"; - var preferredLanguage = {value: language}; - var firstDayOfWeek = 'Sunday'; - var localeName = {value: language}; +ngCordovaMocks.factory('$cordovaGlobalization', ['$q', function ($q) { + var throwsError = false; + var language = (navigator.language) ? navigator.language : 'en-US'; + var preferredLanguage = {value: language}; + var firstDayOfWeek = 'Sunday'; + var localeName = {value: language}; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaGlobalization - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name preferredLanguage - * @propertyOf ngCordovaMocks.cordovaGlobalization - * - * @description - * The user's preferred language. - * This property should only be used in automated tests. - **/ - preferredLanguage: preferredLanguage, - - /** - * @ngdoc property - * @name localeName - * @propertyOf ngCordovaMocks.cordovaGlobalization - * - * @description - * The name of the user's locale. - * This property should only be used in automated tests. - **/ - localeName: localeName, - - /** - * @ngdoc property - * @name firstDayOfWeek - * @propertyOf ngCordovaMocks.cordovaGlobalization - * - * @description - * The first day of the week based on the user's locale. - * This property should only be used in automated tests. - **/ - firstDayOfWeek: firstDayOfWeek, - - getPreferredLanguage: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the preferred language.'); - } else { - defer.resolve(this.preferredLanguage); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaGlobalization + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, - getLocaleName: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the locale name.'); - } else { - defer.resolve(this.localeName); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name preferredLanguage + * @propertyOf ngCordovaMocks.cordovaGlobalization + * + * @description + * The user's preferred language. + * This property should only be used in automated tests. + **/ + preferredLanguage: preferredLanguage, - getFirstDayOfWeek: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the first day of week.'); - } else { - defer.resolve(this.firstDayOfWeek); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name localeName + * @propertyOf ngCordovaMocks.cordovaGlobalization + * + * @description + * The name of the user's locale. + * This property should only be used in automated tests. + **/ + localeName: localeName, - dateToString: function(date, options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the string from the date.'); - } else { - var result = ''; - - // TODO: Review - date = date; - options = options; - // END TODO: Review - - defer.resolve(result); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name firstDayOfWeek + * @propertyOf ngCordovaMocks.cordovaGlobalization + * + * @description + * The first day of the week based on the user's locale. + * This property should only be used in automated tests. + **/ + firstDayOfWeek: firstDayOfWeek, - stringToDate: function(dateString, options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the date from the string.'); - } else { - var result = ''; - - // TODO: Review - dateString = dateString; - options = options; - // END TODO: Review - - defer.resolve(result); - } - return defer.promise; - }, + getPreferredLanguage: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the preferred language.'); + } else { + defer.resolve(this.preferredLanguage); + } - getDatePattern: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the date pattern.'); - } else { - var result = ''; + return defer.promise; + }, - // TODO: Review - options = options; - // END TODO: Review + getLocaleName: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the locale name.'); + } else { + defer.resolve(this.localeName); + } - defer.resolve(result); - } - return defer.promise; - }, + return defer.promise; + }, - getDateNames: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting the date names.'); - } else { - var result = ''; + getFirstDayOfWeek: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the first day of week.'); + } else { + defer.resolve(this.firstDayOfWeek); + } - // TODO: Review - options = options; - // END TODO: Review + return defer.promise; + }, - defer.resolve(result); - } - return defer.promise; - }, + dateToString: function (date, options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the string from the date.'); + } else { + var result = ''; - isDayLightSavingsTime: function(date) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error getting if this is in daylight savings time mode.'); - } else { - var result = ''; + // TODO: Review + date = date; + options = options; - // TODO: Review - date = date; - // END TODO: Review + // END TODO: Review - defer.resolve(result); - } - return defer.promise; - }, + defer.resolve(result); + } - numberToString: function(number, options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error convertng the number to a string.'); - } else { - var result = ''; - - // TODO: Review - number = number; - options = options; - // END TODO: Review - - defer.resolve(result); - } - return defer.promise; - }, + return defer.promise; + }, + + stringToDate: function (dateString, options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the date from the string.'); + } else { + var result = ''; - stringToNumber: function(numberString, options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error convertng the string to a number.'); - } else { - var result = ''; + // TODO: Review + dateString = dateString; + options = options; - // TODO: Review - options = options; - // END TODO: Review + // END TODO: Review - defer.resolve(result); - } - return defer.promise; - }, + defer.resolve(result); + } - getNumberPattern: function(options) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error convertng the string to a number.'); - } else { - var result = ''; + return defer.promise; + }, - // TODO: Review - options = options; - // END TODO: Review + getDatePattern: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the date pattern.'); + } else { + var result = ''; - defer.resolve(result); - } - return defer.promise; - }, + // TODO: Review + options = options; - getCurrencyPattern: function(currencyCode) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error convertng the string to a number.'); - } else { - var result = ''; + // END TODO: Review - // TODO: Review - currencyCode = currencyCode; - // END TODO: Review + defer.resolve(result); + } - defer.resolve(result); - } - return defer.promise; - } - }; + return defer.promise; + }, + + getDateNames: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the date names.'); + } else { + var result = ''; + + // TODO: Review + options = options; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + }, + + isDayLightSavingsTime: function (date) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting if this is in daylight savings time mode.'); + } else { + var result = ''; + + // TODO: Review + date = date; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + }, + + numberToString: function (number, options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error convertng the number to a string.'); + } else { + var result = ''; + + // TODO: Review + number = number; + options = options; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + }, + + stringToNumber: function (numberString, options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error convertng the string to a number.'); + } else { + var result = ''; + + // TODO: Review + options = options; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + }, + + getNumberPattern: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error convertng the string to a number.'); + } else { + var result = ''; + + // TODO: Review + options = options; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + }, + + getCurrencyPattern: function (currencyCode) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error convertng the string to a number.'); + } else { + var result = ''; + + // TODO: Review + currencyCode = currencyCode; + + // END TODO: Review + + defer.resolve(result); + } + + return defer.promise; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaGoogleAnalytics @@ -1804,11 +1876,11 @@ ngCordovaMocks.factory('$cordovaGlobalization', ['$q', function($q) { * A service for testing google analytics services * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function($q) { +ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function ($q) { var throwsError = false; var methods = {}; - /** + /** * @ngdoc property * @name throwsError * @propertyOf ngCordovaMocks.cordovaGeolocation @@ -1816,7 +1888,7 @@ ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function($q) { * @description * A flag that signals whether a promise should be rejected or not. * This property should only be used in automated tests. - **/ + **/ methods.throwsError = throwsError; var methodsName = [ @@ -1826,12 +1898,14 @@ ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function($q) { 'trackView', 'addCustomDimension', 'trackEvent', + 'trackException', + 'trackTiming', 'addTransaction', 'addTransactionItem' ]; - methodsName.forEach(function(funcName) { - methods[funcName] = function() { + methodsName.forEach(function (funcName) { + methods[funcName] = function () { var defer = $q.defer(); (this.throwsError) ? @@ -1847,7 +1921,6 @@ ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function($q) { 'use strict'; - /** * @ngdoc service * @name ngCordovaMocks.googlePlayGame @@ -1857,143 +1930,154 @@ ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function($q) { * in an app build with ngCordova. */ ngCordovaMocks.factory('$cordovaGooglePlayGame', ['$q', function ($q) { - var throwsError = false; - var isSignedIn = false; - var displayName = ''; - - return { - - /** - * @ngdoc property - * @name _throwsError - * @propertyOf ngCordovaMocks.googlePlayGame - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - _throwsError: throwsError, - - /** - * @ngdoc property - * @name _isSignedIn - * @propertyOf ngCordovaMocks.googlePlayGame - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - _isSignedIn: isSignedIn, - - /** - * @ngdoc property - * @name _displayName - * @propertyOf ngCordovaMocks.googlePlayGame - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - _displayName: displayName, - - auth: function() { - var defer = $q.defer(); - if (this._throwsError) { - defer.reject('There was a auth error.'); - } else { - this.isSignedIn = true; - defer.resolve('SIGN IN SUCCESS'); - } - return defer.promise; - }, - signout: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was a signout error.'); - } else { - defer.resolve(); - } - return defer.promise; - }, - isSignedIn: function() { - var defer = $q.defer(); - if (this._throwsError) { - defer.reject('There was a isSignedIn error.'); - } else { - defer.resolve({ - 'isSignedIn': this._isSignedIn - }); - } - return defer.promise; - }, - showPlayer: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was a showPlayer error.'); - } else { - defer.resolve({ - 'displayName': this._displayName - }); - } - return defer.promise; - }, - submitScore: function(data) { - var defer = $q.defer(); - if (this._throwsError) { - defer.reject('There was a submitScore error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - }, - showAllLeaderboards: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was a showAllLeaderboards error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - }, - showLeaderboard: function(data) { - var defer = $q.defer(); - if (this._throwsError) { - defer.reject('There was a showLeaderboard error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - }, - unlockAchievement: function(data) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was a unlockAchievement error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - }, - incrementAchievement: function(data) { - var defer = $q.defer(); - if (this._throwsError) { - defer.reject('There was a incrementAchievement error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - }, - showAchievements: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was a showAchievements error.'); - } else { - defer.resolve('OK'); - } - return defer.promise; - } - }; - - }]); + var throwsError = false; + var isSignedIn = false; + var displayName = ''; + + return { + + /** + * @ngdoc property + * @name _throwsError + * @propertyOf ngCordovaMocks.googlePlayGame + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + _throwsError: throwsError, + + /** + * @ngdoc property + * @name _isSignedIn + * @propertyOf ngCordovaMocks.googlePlayGame + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + _isSignedIn: isSignedIn, + + /** + * @ngdoc property + * @name _displayName + * @propertyOf ngCordovaMocks.googlePlayGame + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + _displayName: displayName, + + auth: function () { + var defer = $q.defer(); + if (this._throwsError) { + defer.reject('There was a auth error.'); + } else { + this.isSignedIn = true; + defer.resolve('SIGN IN SUCCESS'); + } + + return defer.promise; + }, + signout: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a signout error.'); + } else { + defer.resolve(); + } + + return defer.promise; + }, + isSignedIn: function () { + var defer = $q.defer(); + if (this._throwsError) { + defer.reject('There was a isSignedIn error.'); + } else { + defer.resolve({ + 'isSignedIn': this._isSignedIn + }); + } + + return defer.promise; + }, + showPlayer: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a showPlayer error.'); + } else { + defer.resolve({ + 'displayName': this._displayName + }); + } + + return defer.promise; + }, + submitScore: function (data) { + var defer = $q.defer(); + if (this._throwsError) { + defer.reject('There was a submitScore error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + }, + showAllLeaderboards: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a showAllLeaderboards error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + }, + showLeaderboard: function (data) { + var defer = $q.defer(); + if (this._throwsError) { + defer.reject('There was a showLeaderboard error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + }, + unlockAchievement: function (data) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a unlockAchievement error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + }, + incrementAchievement: function (data) { + var defer = $q.defer(); + if (this._throwsError) { + defer.reject('There was a incrementAchievement error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + }, + showAchievements: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a showAchievements error.'); + } else { + defer.resolve('OK'); + } + + return defer.promise; + } + }; + +}]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaKeyboard @@ -2001,11 +2085,11 @@ ngCordovaMocks.factory('$cordovaGooglePlayGame', ['$q', function ($q) { * @description * A service for testing device keyboard features * in an app build with ngCordova. -**/ -ngCordovaMocks.factory('$cordovaKeyboard', function() { - var isVisible=false; + **/ +ngCordovaMocks.factory('$cordovaKeyboard', function () { + var isVisible = false; - return { + return { hideAccessoryBar: function (bool) { }, @@ -2024,7 +2108,7 @@ ngCordovaMocks.factory('$cordovaKeyboard', function() { return isVisible; } - }; + }; }); /** @@ -2035,7 +2119,7 @@ ngCordovaMocks.factory('$cordovaKeyboard', function() { * A service for testing Keychain features * in an app built with ngCordova. **/ -ngCordovaMocks.factory('$cordovaKeychain', ['$q', function($q) { +ngCordovaMocks.factory('$cordovaKeychain', ['$q', function ($q) { var keychains = {}; return { @@ -2099,46 +2183,47 @@ ngCordovaMocks.factory('$cordovaKeychain', ['$q', function($q) { * in an app build with ngCordova. */ ngCordovaMocks.factory('$cordovaNetwork', function () { - var connectionType = 'WiFi connection'; - var isConnected = true; + var connectionType = 'WiFi connection'; + var isConnected = true; - return { - /** - * @ngdoc property - * @name connectionType - * @propertyOf ngCordovaMocks.cordovaNetwork - * - * @description - * They type of connection. Values should match those found at - * https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md - * This property should only be used in automated tests. - **/ - connectionType: connectionType, - - /** - * @ngdoc property - * @name isConnected - * @propertyOf ngCordovaMocks.cordovaNetwork - * - * @description - * A flag that signals whether the app is connected to a network. - * This property should only be used in automated tests. - **/ - isConnected: isConnected, - - getNetwork: function () { - return this.connectionType; - }, + return { + /** + * @ngdoc property + * @name connectionType + * @propertyOf ngCordovaMocks.cordovaNetwork + * + * @description + * They type of connection. Values should match those found at + * https://github.com/apache/cordova-plugin-network-information + * This property should only be used in automated tests. + **/ + connectionType: connectionType, - isOnline: function () { - return this.isConnected; - }, + /** + * @ngdoc property + * @name isConnected + * @propertyOf ngCordovaMocks.cordovaNetwork + * + * @description + * A flag that signals whether the app is connected to a network. + * This property should only be used in automated tests. + **/ + isConnected: isConnected, - isOffline: function () { - return !this.isConnected; - } - }; + getNetwork: function () { + return this.connectionType; + }, + + isOnline: function () { + return this.isConnected; + }, + + isOffline: function () { + return !this.isConnected; + } + }; }); + 'use strict'; /** @@ -2149,13 +2234,13 @@ ngCordovaMocks.factory('$cordovaNetwork', function () { * A service for testing push notifications features * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function($q, $timeout, $rootScope) { +ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function ($q, $timeout, $rootScope) { var throwsError = false; var deviceToken = ''; return { - /** + /** * @ngdoc property * @name throwsError * @propertyOf ngCordovaMocks.cordovaPush @@ -2163,10 +2248,10 @@ ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function * @description * A flag that signals whether a promise should be rejected or not. * This property should only be used in automated tests. - **/ + **/ throwsError: throwsError, - /** + /** * @ngdoc property * @name deviceToken * @propertyOf ngCordovaMocks.cordovaPush @@ -2174,7 +2259,7 @@ ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function * @description * Token send when service register device * This property should only be used in automated tests. - **/ + **/ deviceToken: deviceToken, onNotification: function (notification) { @@ -2215,6 +2300,7 @@ ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function }, }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaSocialSharing @@ -2223,261 +2309,262 @@ ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function * A service for testing via social services * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaSocialSharing', ['$q', function($q) { - var throwsError = false; - var message = ''; - var image = ''; - var link = ''; - var number = ''; - - var socialService = ''; - var subject = ''; - var toAddresses = []; - var bccAddresses = []; - var attachments = []; +ngCordovaMocks.factory('$cordovaSocialSharing', ['$q', function ($q) { + var throwsError = false; + var message = ''; + var image = ''; + var link = ''; + var number = ''; - return { - /** - * @ngdoc property - * @name throwsError - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * A flag that signals whether a promise should be rejected or not. - * This property should only be used in automated tests. - **/ - throwsError: throwsError, - - /** - * @ngdoc property - * @name message - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * The message to be shared via a social service. - * This property should only be used in automated tests. - **/ - message: message, - - /** - * @ngdoc property - * @name image - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * An image to be shared via a social service. - * This property should only be used in automated tests. - **/ - image: image, - - /** - * @ngdoc property - * @name link - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * A link to be shared via a social service. - * This property should only be used in automated tests. - **/ - link: link, - - /** - * @ngdoc property - * @name number - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * A comma-delimited list of phone numbers to send a social message to. - * This property should only be used in automated tests. - **/ - number: number, - - /** - * @ngdoc property - * @name subject - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * The subject of an email. - * This property should only be used in automated tests. - **/ - subject: subject, - - /** - * @ngdoc property - * @name toAddresses - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * An array of email addresses to send an email to. - * This property should only be used in automated tests. - **/ - toAddresses: toAddresses, - - /** - * @ngdoc property - * @name bccAddresses - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * An array of email addresses to blind carbon-copy an email to. - * This property should only be used in automated tests. - **/ - bccAddresses: bccAddresses, - - /** - * @ngdoc property - * @name socialService - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * The name of a social service to share content through. - * This property should only be used in automated tests. - **/ - socialService: socialService, - - /** - * @ngdoc property - * @name attachments - * @propertyOf ngCordovaMocks.cordovaSocialSharing - * - * @description - * An array of attachments to include with an email to be sent. - * This property should only be used in automated tests. - **/ - attachments: attachments, - - shareViaTwitter: function(message, image, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via Twitter.'); - } else { - this.message = message; - this.image = image; - this.link = link; - - defer.resolve(); - } - return defer.promise; - }, + var socialService = ''; + var subject = ''; + var toAddresses = []; + var bccAddresses = []; + var attachments = []; - shareViaWhatsApp: function(message, image, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via WhatsApp.'); - } else { - this.message = message; - this.image = image; - this.link = link; - - defer.resolve(); - } - return defer.promise; - }, + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, - shareViaFacebook: function(message, image, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via Facebook.'); - } else { - this.message = message; - this.image = image; - this.link = link; - - defer.resolve(); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name message + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * The message to be shared via a social service. + * This property should only be used in automated tests. + **/ + message: message, - shareViaSMS: function(message, number) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via SMS.'); - } else { - this.message = message; - this.number = number; - - defer.resolve(); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name image + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * An image to be shared via a social service. + * This property should only be used in automated tests. + **/ + image: image, - shareViaEmail: function(message, subject, toArr, bccArr, file) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via SMS.'); - } else { - // These are added to get by JSHINT for now - this.message = message; - this.subject = subject; - this.toAddresses = toArr; - this.bccAddressesc = bccArr; - this.attachments = file; - - defer.resolve(); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name link + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * A link to be shared via a social service. + * This property should only be used in automated tests. + **/ + link: link, - canShareViaEmail: function() { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject(false); - } else { - defer.resolve(true); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name number + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * A comma-delimited list of phone numbers to send a social message to. + * This property should only be used in automated tests. + **/ + number: number, - canShareVia: function(via, message, subject, file, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via SMS.'); - } else { - // These are added to get by JSHINT for now - this.message = message; - this.socialService = via; - this.subject = subject; - this.attachments = file; - this.link = link; - - defer.resolve(); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name subject + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * The subject of an email. + * This property should only be used in automated tests. + **/ + subject: subject, - shareVia: function(via, message, subject, file, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via SMS.'); - } else { - this.socialService = via; - this.message = message; - this.subject = subject; - this.attachments = file; - this.link = link; - - defer.resolve(); - } - return defer.promise; - }, + /** + * @ngdoc property + * @name toAddresses + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * An array of email addresses to send an email to. + * This property should only be used in automated tests. + **/ + toAddresses: toAddresses, - share: function(message, subject, file, link) { - var defer = $q.defer(); - if (this.throwsError) { - defer.reject('There was an error sharing via SMS.'); - } else { - this.message = message; - this.subject = subject; - this.attachments = file; - this.link = link; - - defer.resolve(); - } - return defer.promise; - } - }; + /** + * @ngdoc property + * @name bccAddresses + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * An array of email addresses to blind carbon-copy an email to. + * This property should only be used in automated tests. + **/ + bccAddresses: bccAddresses, + + /** + * @ngdoc property + * @name socialService + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * The name of a social service to share content through. + * This property should only be used in automated tests. + **/ + socialService: socialService, + + /** + * @ngdoc property + * @name attachments + * @propertyOf ngCordovaMocks.cordovaSocialSharing + * + * @description + * An array of attachments to include with an email to be sent. + * This property should only be used in automated tests. + **/ + attachments: attachments, + + shareViaTwitter: function (message, image, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via Twitter.'); + } else { + this.message = message; + this.image = image; + this.link = link; + + defer.resolve(); + } + return defer.promise; + }, + + shareViaWhatsApp: function (message, image, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via WhatsApp.'); + } else { + this.message = message; + this.image = image; + this.link = link; + + defer.resolve(); + } + return defer.promise; + }, + + shareViaFacebook: function (message, image, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via Facebook.'); + } else { + this.message = message; + this.image = image; + this.link = link; + + defer.resolve(); + } + return defer.promise; + }, + + shareViaSMS: function (message, number) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via SMS.'); + } else { + this.message = message; + this.number = number; + + defer.resolve(); + } + return defer.promise; + }, + + shareViaEmail: function (message, subject, toArr, bccArr, file) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via SMS.'); + } else { + // These are added to get by JSHINT for now + this.message = message; + this.subject = subject; + this.toAddresses = toArr; + this.bccAddressesc = bccArr; + this.attachments = file; + + defer.resolve(); + } + return defer.promise; + }, + + canShareViaEmail: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject(false); + } else { + defer.resolve(true); + } + return defer.promise; + }, + + canShareVia: function (via, message, subject, file, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via SMS.'); + } else { + // These are added to get by JSHINT for now + this.message = message; + this.socialService = via; + this.subject = subject; + this.attachments = file; + this.link = link; + + defer.resolve(); + } + return defer.promise; + }, + + shareVia: function (via, message, subject, file, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via SMS.'); + } else { + this.socialService = via; + this.message = message; + this.subject = subject; + this.attachments = file; + this.link = link; + + defer.resolve(); + } + return defer.promise; + }, + + share: function (message, subject, file, link) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error sharing via SMS.'); + } else { + this.message = message; + this.subject = subject; + this.attachments = file; + this.link = link; + + defer.resolve(); + } + return defer.promise; + } + }; }]); + /** * @ngdoc service * @name ngCordovaMocks.cordovaSplashscreen @@ -2486,35 +2573,36 @@ ngCordovaMocks.factory('$cordovaSocialSharing', ['$q', function($q) { * A service for testing the splash screen * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaSplashscreen', function() { - var isVisible = false; +ngCordovaMocks.factory('$cordovaSplashscreen', function () { + var isVisible = false; - return { - /** - * @ngdoc property - * @name isVisible - * @propertyOf ngCordovaMocks.cordovaSplashscreen - * - * @description - * A flag that signals whether the splash screen is visible or not. - * This property should only be used in automated tests. - **/ - isVisible: isVisible, - - hide: function() { - // do nothing. everything happens behind the scenes in this case. - // its a stub that is present for completeness. - this.isVisible = false; - return true; - }, - show: function() { - // do nothing. everything happens behind the scenes in this case. - // its a stub that is present for completeness. - this.isVisible = true; - return true; - } - }; + return { + /** + * @ngdoc property + * @name isVisible + * @propertyOf ngCordovaMocks.cordovaSplashscreen + * + * @description + * A flag that signals whether the splash screen is visible or not. + * This property should only be used in automated tests. + **/ + isVisible: isVisible, + + hide: function () { + // do nothing. everything happens behind the scenes in this case. + // its a stub that is present for completeness. + this.isVisible = false; + return true; + }, + show: function () { + // do nothing. everything happens behind the scenes in this case. + // its a stub that is present for completeness. + this.isVisible = true; + return true; + } + }; }); + /** * @ngdoc service * @name ngCordovaMocks.cordovaStatusbar @@ -2523,65 +2611,66 @@ ngCordovaMocks.factory('$cordovaSplashscreen', function() { * A service for testing the status bar * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaStatusbar', function() { - var isStatusBarVisible = true; - var canOverlayWebView = true; +ngCordovaMocks.factory('$cordovaStatusbar', function () { + var isStatusBarVisible = true; + var canOverlayWebView = true; - return { - /** - * @ngdoc property - * @name isStatusBarVisible - * @propertyOf ngCordovaMocks.cordovaStatusbar - * - * @description - * A flag that signals whether the status bar is visible or not. - * This property should only be used in automated tests. - **/ - isStatusBarVisible: isStatusBarVisible, - - /** - * @ngdoc property - * @name canOverlayWebView - * @propertyOf ngCordovaMocks.cordovaStatusbar - * - * @description - * A flag that signals whether the status bar can overlay the web view. - * This property should only be used in automated tests. - **/ - canOverlayWebView: canOverlayWebView, - - overlaysWebView: function(bool) { - this.canOverlayWebView = bool; - }, + return { + /** + * @ngdoc property + * @name isStatusBarVisible + * @propertyOf ngCordovaMocks.cordovaStatusbar + * + * @description + * A flag that signals whether the status bar is visible or not. + * This property should only be used in automated tests. + **/ + isStatusBarVisible: isStatusBarVisible, - style: function(style) { - // TODO: Review - return style; - }, + /** + * @ngdoc property + * @name canOverlayWebView + * @propertyOf ngCordovaMocks.cordovaStatusbar + * + * @description + * A flag that signals whether the status bar can overlay the web view. + * This property should only be used in automated tests. + **/ + canOverlayWebView: canOverlayWebView, - styleHex: function(colorHex) { - // TODO: review - return colorHex; - }, + overlaysWebView: function (bool) { + this.canOverlayWebView = bool; + }, - styleColor: function(color) { - // TODO: review - return color; - }, + style: function (style) { + // TODO: Review + return style; + }, - hide: function() { - this.isStatusBarVisible = false; - }, + styleHex: function (colorHex) { + // TODO: review + return colorHex; + }, - show: function() { - this.isStatusBarVisible = true; - }, + styleColor: function (color) { + // TODO: review + return color; + }, - isVisible: function () { - return this.isStatusBarVisible; - } - }; + hide: function () { + this.isStatusBarVisible = false; + }, + + show: function () { + this.isStatusBarVisible = true; + }, + + isVisible: function () { + return this.isStatusBarVisible; + } + }; }); + /** * @ngdoc service * @name ngCordovaMocks.cordovaToast @@ -2681,75 +2770,76 @@ ngCordovaMocks.factory('$cordovaToast', ['$q', function ($q) { * A service for testing vibration * in an app build with ngCordova. */ -ngCordovaMocks.factory('$cordovaVibration', ['$timeout', function($timeout) { - var isVibrating = false; - var vibrateTimer = null; +ngCordovaMocks.factory('$cordovaVibration', ['$timeout', function ($timeout) { + var isVibrating = false; + var vibrateTimer = null; - return { - /** - * @ngdoc property - * @name vibrateTimer - * @propertyOf ngCordovaMocks.cordovaVibration - * - * @description - * Access to the timer associated with vibration. - * This property should only be used in automated tests. - **/ - vibrateTimer: vibrateTimer, - - /** - * @ngdoc property - * @name isVibrating - * @propertyOf ngCordovaMocks.cordovaVibration - * - * @description - * A flag that signals whether vibration is active. - * This property should only be used in automated tests. - **/ - isVibrating: isVibrating, - - vibrate: function(time) { - if (time > 0) { - this.isVibrating = true; - self = this; - - if (time instanceof Array) { - // TODO: Implement pattern here. - // The following is a temporary timer that just looks at the first value - this.vibrateTimer = $timeout( - function() { - self.isVibrating = false; - self.vibrateTimer = null; - }, - time[0] - ); - } else { - this.vibrateTimer = $timeout( - function() { - self.isVibrating = false; - self.vibrateTimer = null; - }, - time - ); - } - } - }, + return { + /** + * @ngdoc property + * @name vibrateTimer + * @propertyOf ngCordovaMocks.cordovaVibration + * + * @description + * Access to the timer associated with vibration. + * This property should only be used in automated tests. + **/ + vibrateTimer: vibrateTimer, - /* jshint ignore:start */ - vibrateWithPattern: function(pattern, repeat) { - // Based on the documentation (https://github.com/apache/cordova-plugin-vibration/blob/master/doc/index.md) - // This method is deprecated. For that reason, this isn't implemented at this time. - }, - /* jshint ignore:end */ - - cancelVibration: function() { - if (this.vibrateTimer !== null) { - if (this.isVibrating === true) { - $timeout.cancel(this.vibrateTimer); - this.isVibrating = false; - } - } - } - }; + /** + * @ngdoc property + * @name isVibrating + * @propertyOf ngCordovaMocks.cordovaVibration + * + * @description + * A flag that signals whether vibration is active. + * This property should only be used in automated tests. + **/ + isVibrating: isVibrating, + + vibrate: function (time) { + if (time > 0) { + this.isVibrating = true; + self = this; + + if (time instanceof Array) { + // TODO: Implement pattern here. + // The following is a temporary timer that just looks at the first value + this.vibrateTimer = $timeout( + function () { + self.isVibrating = false; + self.vibrateTimer = null; + }, + time[0] + ); + } else { + this.vibrateTimer = $timeout( + function () { + self.isVibrating = false; + self.vibrateTimer = null; + }, + time + ); + } + } + }, + + /* jshint ignore:start */ + vibrateWithPattern: function (pattern, repeat) { + // Based on the documentation (https://github.com/apache/cordova-plugin-vibration) + // This method is deprecated. For that reason, this isn't implemented at this time. + }, + /* jshint ignore:end */ + + cancelVibration: function () { + if (this.vibrateTimer !== null) { + if (this.isVibrating === true) { + $timeout.cancel(this.vibrateTimer); + this.isVibrating = false; + } + } + } + }; }]); + })(); diff --git a/www/lib/ngCordova/dist/ng-cordova-mocks.min.js b/www/lib/ngCordova/dist/ng-cordova-mocks.min.js index 1d6d9a5d..64559d76 100644 --- a/www/lib/ngCordova/dist/ng-cordova-mocks.min.js +++ b/www/lib/ngCordova/dist/ng-cordova-mocks.min.js @@ -1,7 +1,7 @@ /*! * ngCordova - * v0.1.15-alpha + * v0.1.17-alpha * Copyright 2014 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */ -!function(){var r=angular.module("ngCordovaMocks",[]);r.factory("$cordovaAppVersion",["$q",function(r){var e=!1;return{throwsError:e,getAppVersion:function(){var e=r.defer();return e.resolve("mock v"),e.promise}}}]),r.factory("$cordovaBarcodeScanner",["$q",function(r){var e=!1,t="",o="",i=!1;return{throwsError:e,scannedText:t,scannedFormat:o,wasCancelled:i,scan:function(){var e=r.defer();return this.throwsError?e.reject("There was an error scanning."):e.resolve({text:this.scannedText,format:this.scannedFormat,cancelled:this.wasCancelled}),e.promise},encode:function(e,t){this.scannedFormat=e,this.scannedText=t;var o=r.defer();return this.throwsError?o.reject("There was an error encoding the data."):o.resolve(),o.promise}}}]),r.factory("$cordovaBLE",["$q","$timeout",function(r,e){var t={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55},o={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55,services:["1800","1801","180f"],characteristics:[{service:"1800",characteristic:"2a00",properties:["Read"]},{service:"1800",characteristic:"2a01",properties:["Read"]},{service:"1801",characteristic:"2a05",properties:["Read"]},{service:"180f",characteristic:"2a19",properties:["Read"],descriptors:[{uuid:"2901"},{uuid:"2904"}]}]},i=new ArrayBuffer(8);return{scan:function(o,i){var n=r.defer();return e(function(){n.resolve(t)},1e3*i),n.promise},connect:function(){var t=r.defer();return e(function(){t.resolve(o)},1500),t.promise},disconnect:function(){var t=r.defer();return e(function(){t.resolve(!0)},500),t.promise},read:function(){var t=r.defer();return e(function(){t.resolve(i)},100),t.promise},write:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},writeCommand:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},notify:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},indicate:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},isConnected:function(){var e=r.defer();return e.resolve(!0),e.promise},isEnabled:function(){var e=r.defer();return e.resolve(!0),e.promise}}}]),r.factory("$cordovaCamera",["$q",function(r){var e=!1,t="";return{throwsError:e,imageData:t,getPicture:function(e){var t=r.defer();return this.throwsError?t.reject("There was an error getting the picture."):(e&&(e=e),t.resolve(this.imageData)),t.promise}}}]),r.factory("$cordovaCapture",["$q",function(r){var e=!1;return{throwsError:e,captureAudio:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the audio."):e.resolve(),e.promise},captureImage:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the image."):e.resolve(),e.promise},captureVideo:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the video."):e.resolve(),e.promise}}}]),r.factory("$cordovaContacts",["$q",function(r){var e=!1,t=[];return{throwsError:e,contacts:t,save:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,i=0;i<this.contacts.length;i++)if(this.contacts[i].id===e.id){o=i;break}null===o?(this.contacts.push(e),t.resolve()):t.reject("Contact already exists.")}return t.promise},remove:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,i=0;i<this.contacts.length;i++)if(this.contacts[i].id===e.id){o=i;break}null===o?t.reject("Unable to find contact."):(this.contacts.splice(o,1),t.resolve())}return t.promise},find:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error finding the contact.");else{var o=e.fields||["id","displayName"];if(delete e.fields,o)if("*"===o)t.resolve(this.contacts);else{for(var i=[],n=0;n<this.contacts.length;n++)for(var s in this.contacts[n])var a=this.contacts[n][s];t.resolve(i)}else t.reject("ContactError.INVALID_ARGUMENT_ERROR")}return t.promise}}}]),r.factory("$cordovaDatePicker",["$q",function(r){return{show:function(e){var t=r.defer();return e=e||{date:new Date,mode:"date"},t.resolve(e.date),t.promise}}}]),r.factory("$cordovaDevice",function(){var r="",e="",t="",o="",i="",n="";return{device:r,cordova:e,model:t,platform:o,uuid:i,version:n,getDevice:function(){return this.device},getCordova:function(){return this.cordova},getModel:function(){return this.model},getPlatform:function(){return this.platform},getUUID:function(){return this.uuid},getVersion:function(){return this.version}}}),r.factory("$cordovaDeviceMotion",["$interval","$q",function(r,e){var t=null,o=!1,i=[],n=[];return{currentAcceleration:t,throwsError:o,positions:i,watchIntervals:n,getCurrentAcceleration:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the current acceleration."):r.resolve(this.currentAcceleration),r.promise},watchAcceleration:function(t){var o=e.defer(),i=Math.floor(1e6*Math.random()+1);if(this.positions=[],self=this,this.throwsError)o.reject("There was an error watching the current acceleration.");else{var n=1e4;t&&t.frequency&&(n=t.frequency),this.watchIntervals.push(r(function(){self.throwsError&&o.reject("There was an error watching the acceleration.");var r=Math.floor(100*Math.random()+1),e=Math.floor(100*Math.random()+1),t=Math.floor(100*Math.random()+1),i={x:r,y:e,z:t,timestamp:Date.now()};self.positions.push(i),o.notify(i)},n))}return{watchId:i,promise:o.promise}},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var i=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){r.cancel(n[s].interval),i=s;break}-1!==i&&this.watchIntervals.splice(i,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaDeviceOrientation",["$interval","$q",function(r,e){var t=null,o=!1,i=[],n=[];return{currentHeading:t,throwsError:o,readings:i,watchIntervals:n,getCurrentHeading:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the current heading."):r.resolve(this.currentHeading),r.promise},watchHeading:function(t){var o=e.defer(),i=Math.floor(1e6*Math.random()+1),s=this;if(s.readings=[],s.throwsError)o.reject("There was an error getting the compass heading.");else{var a=100;t&&t.frequency&&(a=t.frequency),s.watchIntervals.push({watchID:i,interval:r(function(){s.throwsError&&o.reject("There was an error watching the acceleration.");var r=359.99*Math.random()+1,e=359.99*Math.random()+1,t=Math.floor(360*Math.random()+1),i={magneticHeading:r,trueHeading:e,headingAccuracy:t,timestamp:Date.now()};s.readings.push(i),o.notify(i)},a)})}var c=function(e){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===e){r.cancel(n[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(i)},o.promise.clearWatch=function(r){c(r||i)},o.promise.watchID=i,o.promise},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var i=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){r.cancel(n[s].interval),i=s;break}-1!==i&&this.watchIntervals.splice(i,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaDialogs",["$q",function(r){var e=!1,t="",o="",i="",n=0,s=!0;return{dialogText:e,dialogTitle:t,defaultValue:o,promptResponse:i,buttonLabels:[],beepCount:n,useHostAbilities:s,alert:function(e,t,o){var i=r.defer();return this.useHostAbilities?(alert(e),i.resolve()):(this.dialogText=e,this.dialogTitle=t,this.buttonLabels.push(o),i.resolve()),i.promise},confirm:function(e,t,o){var i=r.defer();if(this.useHostAbilities){var n=confirm(e);i.resolve(n?2:1)}else this.dialogText=e,this.dialogTitle=t,this.buttonLabels.push(o),i.resolve(0);return i.promise},prompt:function(e,t,o,i){var n=r.defer();if(this.useHostAbilities){var s=prompt(e,i);n.resolve(s)}else{this.dialogText=e,this.dialogTitle=t,this.defaultValue=i;for(var a=0;a<o.length;a++)this.buttonLabels.push(o[a]);n.resolve(this.promptResponse)}return n.promise},beep:function(r){this.beepCount=r}}}]),r.factory("$cordovaFile",["$q",function(r){var e=!1,t={},o=!1,i={},n=function(e){var t=r.defer();return this.throwsError?t.reject(e):t.resolve(),t.promise};return{throwsError:e,fileSystem:t,shouldMockFiles:o,files:i,checkDir:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]&&!this.files[e].isFile?t.resolve():t.reject(),t.promise}return n.call(this,"There was an error checking the directory.")},createDir:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]={isFile:!1},t.resolve(),t.promise}return n.call(this,"There was an error creating the directory.")},listDir:function(){return n.call(this,"There was an error listing the directory")},checkFile:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]&&this.files[e].isFile?t.resolve():t.reject(),t.promise}return n.call(this,"There was an error checking for the file.")},createFile:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]={isFile:!0,fileContent:""},t.resolve(),t.promise}return n.call(this,"There was an error creating the file.")},removeFile:function(){return n.call(this,"There was an error removng the file.")},writeFile:function(r,e){return this.shouldMockFiles&&r&&e&&(this.files[r]={isFile:!0,fileContent:e}),n.call(this,"There was an error writing the file.")},readFile:function(r){return this.readAsText(r)},readAsText:function(e){if(this.shouldMockFiles){var t=r.defer();return i[e]&&i[e].isFile?t.resolve(i[e].fileContent):t.reject(),t.promise}return n.call(this,"There was an error reading the file as text.")},readAsDataURL:function(){return n.call(this,"There was an error reading the file as a data url.")},readAsBinaryString:function(){return n.call(this,"There was an error reading the file as a binary string.")},readAsArrayBuffer:function(){return n.call(this,"There was an error reading the file as an array buffer.")},readFileMetadata:function(){return n.call(this,"There was an error reading the file metadata")},readFileAbsolute:function(){return n.call(this,"There was an error reading the file from the absolute path")},readFileMetadataAbsolute:function(){return n.call(this,"There was an error reading the file metadta from the absolute path")},downloadFile:function(){return n.call(this,"There was an error downloading the file.")},uploadFile:function(){return n.call(this,"There was an error uploading the file.")}}}]),r.factory("$cordovaFileOpener2",["$q",function(r){var e=!1;return{throwsError:e,open:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the file."}):e.resolve(),e.promise},uninstall:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the packageId."}):e.resolve(),e.promise},appIsInstalled:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the packageId."}):e.resolve(),e.promise}}}]),r.factory("$cordovaGeolocation",["$interval","$q",function(r,e){var t=!1,o=!0,i=[],n=[],s=null,a=null;return{throwsError:t,watchIntervals:i,locations:n,currentPosition:s,nextPosition:a,useHostAbilities:o,getCurrentPosition:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error getting the location."):(r&&(r=r),this.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(r){this.currentPosition=r,t.resolve(this.currentPosition)},function(r){t.reject(r)}):t.reject("Geolocation is not supported by this browser."):t.resolve(this.currentPosition)),t.promise},watchPosition:function(t){var o=e.defer(),n=Math.floor(1e6*Math.random()+1),s=this;if(s.locations=[],s.throwsError)o.reject("There was an error getting the geolocation.");else{var a=1e3;t&&t.timeout&&(a=t.timeout),s.watchIntervals.push({watchID:n,interval:r(function(){s.throwsError&&o.reject("There was an error watching the geolocation.");var r=s.nextPosition;null===r&&(s.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(r){s.currentPosition=r,s.locations.push(r),o.resolve(r)},function(r){o.reject(r)}):o.reject("Geolocation is not supported by this browser."):(r={coords:{latitude:180*Math.random()+1-90,longitude:360*Math.random()+1-180,altitude:100*Math.random()+1,accuracy:10*Math.random()+1,altitudeAccuracy:10*Math.random()+1,heading:360*Math.random()+1,speed:100*Math.random()+1},timestamp:Date.now()},s.currentPosition=r,s.locations.push(r),o.notify(r)))},a)})}var c=function(e){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===e){r.cancel(i[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(n)},o.promise.clearWatch=function(r){c(r||n)},o.promise.watchID=n,o.promise},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var n=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchID===t){r.cancel(i[s].interval),n=s;break}-1!==n&&this.watchIntervals.splice(n,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaGlobalization",["$q",function(r){var e=!1,t=navigator.language?navigator.language:"en-US",o={value:t},i="Sunday",n={value:t};return{throwsError:e,preferredLanguage:o,localeName:n,firstDayOfWeek:i,getPreferredLanguage:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the preferred language."):e.resolve(this.preferredLanguage),e.promise},getLocaleName:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the locale name."):e.resolve(this.localeName),e.promise},getFirstDayOfWeek:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the first day of week."):e.resolve(this.firstDayOfWeek),e.promise},dateToString:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error getting the string from the date.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},stringToDate:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error getting the date from the string.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},getDatePattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting the date pattern.");else{var o="";e=e,t.resolve(o)}return t.promise},getDateNames:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting the date names.");else{var o="";e=e,t.resolve(o)}return t.promise},isDayLightSavingsTime:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting if this is in daylight savings time mode.");else{var o="";e=e,t.resolve(o)}return t.promise},numberToString:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error convertng the number to a string.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},stringToNumber:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error convertng the string to a number.");else{var i="";t=t,o.resolve(i)}return o.promise},getNumberPattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";e=e,t.resolve(o)}return t.promise},getCurrencyPattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";e=e,t.resolve(o)}return t.promise}}}]),r.factory("$cordovaGoogleAnalytics",["$q",function(r){var e=!1,t={};t.throwsError=e;var o=["startTrackerWithId","setUserId","debugMode","trackView","addCustomDimension","trackEvent","addTransaction","addTransactionItem"];return o.forEach(function(e){t[e]=function(){var e=r.defer();return this.throwsError?e.reject():e.resolve(),e.promise}}),t}]),r.factory("$cordovaGooglePlayGame",["$q",function(r){var e=!1,t=!1,o="";return{_throwsError:e,_isSignedIn:t,_displayName:o,auth:function(){var e=r.defer();return this._throwsError?e.reject("There was a auth error."):(this.isSignedIn=!0,e.resolve("SIGN IN SUCCESS")),e.promise},signout:function(){var e=r.defer();return this.throwsError?e.reject("There was a signout error."):e.resolve(),e.promise},isSignedIn:function(){var e=r.defer();return this._throwsError?e.reject("There was a isSignedIn error."):e.resolve({isSignedIn:this._isSignedIn}),e.promise},showPlayer:function(){var e=r.defer();return this.throwsError?e.reject("There was a showPlayer error."):e.resolve({displayName:this._displayName}),e.promise},submitScore:function(){var e=r.defer();return this._throwsError?e.reject("There was a submitScore error."):e.resolve("OK"),e.promise},showAllLeaderboards:function(){var e=r.defer();return this.throwsError?e.reject("There was a showAllLeaderboards error."):e.resolve("OK"),e.promise},showLeaderboard:function(){var e=r.defer();return this._throwsError?e.reject("There was a showLeaderboard error."):e.resolve("OK"),e.promise},unlockAchievement:function(){var e=r.defer();return this.throwsError?e.reject("There was a unlockAchievement error."):e.resolve("OK"),e.promise},incrementAchievement:function(){var e=r.defer();return this._throwsError?e.reject("There was a incrementAchievement error."):e.resolve("OK"),e.promise},showAchievements:function(){var e=r.defer();return this.throwsError?e.reject("There was a showAchievements error."):e.resolve("OK"),e.promise}}}]),r.factory("$cordovaKeyboard",function(){var r=!1;return{hideAccessoryBar:function(){},close:function(){r=!1},show:function(){r=!0},disableScroll:function(){},isVisible:function(){return r}}}),r.factory("$cordovaKeychain",["$q",function(r){var e={};return{keychains:e,getForKey:function(e,t){var o=r.defer();return this.keychains[t]?o.resolve(this.keychains[t][e]):o.reject(),o.promise},setForKey:function(e,t,o){var i=r.defer();return this.keychains[t]||(this.keychains[t]={}),this.keychains[t][e]=o,i.resolve(),i.promise},removeForKey:function(e,t){var o=r.defer();return this.keychains[t]&&delete this.keychains[t][e],o.resolve(),o.promise}}}]),r.factory("$cordovaNetwork",function(){var r="WiFi connection",e=!0;return{connectionType:r,isConnected:e,getNetwork:function(){return this.connectionType},isOnline:function(){return this.isConnected},isOffline:function(){return!this.isConnected}}}),r.factory("$cordovaPush",["$q","$timeout","$rootScope",function(r,e,t){var o=!1,i="";return{throwsError:o,deviceToken:i,onNotification:function(r){e(function(){t.$broadcast("$cordovaPush:notificationReceived",r)})},register:function(e){var t=this,o=r.defer();return void 0!==e&&void 0===e.ecb&&(e.ecb=this.onNotification),this.throwsError?o.reject("There was a register error."):(o.resolve(this.deviceToken),e&&e.ecb&&e.ecb({event:"registered",regid:t.deviceToken})),o.promise},unregister:function(){var e=r.defer();return this.throwsError?e.reject("There was a register error."):e.resolve(),e.promise}}}]),r.factory("$cordovaSocialSharing",["$q",function(r){var e=!1,t="",o="",i="",n="",s="",a="",c=[],h=[],u=[];return{throwsError:e,message:t,image:o,link:i,number:n,subject:a,toAddresses:c,bccAddresses:h,socialService:s,attachments:u,shareViaTwitter:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via Twitter."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaWhatsApp:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via WhatsApp."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaFacebook:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via Facebook."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaSMS:function(e,t){var o=r.defer();return this.throwsError?o.reject("There was an error sharing via SMS."):(this.message=e,this.number=t,o.resolve()),o.promise},shareViaEmail:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=e,this.subject=t,this.toAddresses=o,this.bccAddressesc=i,this.attachments=n,s.resolve()),s.promise},canShareViaEmail:function(){var e=r.defer();return this.throwsError?e.reject(!1):e.resolve(!0),e.promise},canShareVia:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=t,this.socialService=e,this.subject=o,this.attachments=i,this.link=n,s.resolve()),s.promise},shareVia:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.socialService=e,this.message=t,this.subject=o,this.attachments=i,this.link=n,s.resolve()),s.promise},share:function(e,t,o,i){var n=r.defer();return this.throwsError?n.reject("There was an error sharing via SMS."):(this.message=e,this.subject=t,this.attachments=o,this.link=i,n.resolve()),n.promise}}}]),r.factory("$cordovaSplashscreen",function(){var r=!1;return{isVisible:r,hide:function(){return this.isVisible=!1,!0},show:function(){return this.isVisible=!0,!0}}}),r.factory("$cordovaStatusbar",function(){var r=!0,e=!0;return{isStatusBarVisible:r,canOverlayWebView:e,overlaysWebView:function(r){this.canOverlayWebView=r},style:function(r){return r},styleHex:function(r){return r},styleColor:function(r){return r},hide:function(){this.isStatusBarVisible=!1},show:function(){this.isStatusBarVisible=!0},isVisible:function(){return this.isStatusBarVisible}}}),r.factory("$cordovaToast",["$q",function(r){var e=!1;return{throwsError:e,showShortTop:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showShortCenter:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showShortBottom:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongTop:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongCenter:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongBottom:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},show:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise}}}]),r.factory("$cordovaVibration",["$timeout",function(r){var e=!1,t=null;return{vibrateTimer:t,isVibrating:e,vibrate:function(e){e>0&&(this.isVibrating=!0,self=this,this.vibrateTimer=e instanceof Array?r(function(){self.isVibrating=!1,self.vibrateTimer=null},e[0]):r(function(){self.isVibrating=!1,self.vibrateTimer=null},e))},vibrateWithPattern:function(){},cancelVibration:function(){null!==this.vibrateTimer&&this.isVibrating===!0&&(r.cancel(this.vibrateTimer),this.isVibrating=!1)}}}])}(); +!function(){var r=angular.module("ngCordovaMocks",[]);r.factory("$cordovaAppVersion",["$q",function(r){var e=!1;return{throwsError:e,getAppVersion:function(){var e=r.defer();return e.resolve("mock v"),e.promise}}}]),r.factory("$cordovaBarcodeScanner",["$q",function(r){var e=!1,t="",o="",i=!1;return{throwsError:e,scannedText:t,scannedFormat:o,wasCancelled:i,scan:function(){var e=r.defer();return this.throwsError?e.reject("There was an error scanning."):e.resolve({text:this.scannedText,format:this.scannedFormat,cancelled:this.wasCancelled}),e.promise},encode:function(e,t){this.scannedFormat=e,this.scannedText=t;var o=r.defer();return this.throwsError?o.reject("There was an error encoding the data."):o.resolve(),o.promise}}}]),r.factory("$cordovaBLE",["$q","$timeout",function(r,e){var t={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55},o={name:"Test Device",id:"AA:BB:CC:DD:EE:FF",advertising:[2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],rssi:-55,services:["1800","1801","180f"],characteristics:[{service:"1800",characteristic:"2a00",properties:["Read"]},{service:"1800",characteristic:"2a01",properties:["Read"]},{service:"1801",characteristic:"2a05",properties:["Read"]},{service:"180f",characteristic:"2a19",properties:["Read"],descriptors:[{uuid:"2901"},{uuid:"2904"}]}]},i=new ArrayBuffer(8);return{scan:function(o,i){var n=r.defer();return e(function(){n.resolve(t)},1e3*i),n.promise},connect:function(){var t=r.defer();return e(function(){t.resolve(o)},1500),t.promise},disconnect:function(){var t=r.defer();return e(function(){t.resolve(!0)},500),t.promise},read:function(){var t=r.defer();return e(function(){t.resolve(i)},100),t.promise},write:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},writeCommand:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},notify:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},indicate:function(){var t=r.defer();return e(function(){t.resolve(!0)},100),t.promise},isConnected:function(){var e=r.defer();return e.resolve(!0),e.promise},isEnabled:function(){var e=r.defer();return e.resolve(!0),e.promise}}}]),r.factory("$cordovaBrightness",["$q",function(r){var e=100;return{get:function(){var t=r.defer();return t.resolve(e),t.promise},set:function(t){var o=r.defer();return e=t,o.resolve("OK"),o.promise},setKeepScreenOn:function(){var e=r.defer();return e.resolve("OK"),e.promise}}}]),r.factory("$cordovaCamera",["$q",function(r){var e=!1,t="";return{throwsError:e,imageData:t,getPicture:function(e){var t=r.defer();return this.throwsError?t.reject("There was an error getting the picture."):(e&&(e=e),t.resolve(this.imageData)),t.promise}}}]),r.factory("$cordovaCapture",["$q",function(r){var e=!1;return{throwsError:e,captureAudio:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the audio."):e.resolve(),e.promise},captureImage:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the image."):e.resolve(),e.promise},captureVideo:function(){var e=r.defer();return this.throwsError?e.reject("There was an error capturing the video."):e.resolve(),e.promise}}}]),r.factory("$cordovaContacts",["$q",function(r){var e=!1,t=[];return{throwsError:e,contacts:t,save:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,i=0;i<this.contacts.length;i++)if(this.contacts[i].id===e.id){o=i;break}null===o?(this.contacts.push(e),t.resolve()):t.reject("Contact already exists.")}return t.promise},remove:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,i=0;i<this.contacts.length;i++)if(this.contacts[i].id===e.id){o=i;break}null===o?t.reject("Unable to find contact."):(this.contacts.splice(o,1),t.resolve())}return t.promise},find:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error finding the contact.");else{var o=e.fields||["id","displayName"];if(delete e.fields,o)if("*"===o)t.resolve(this.contacts);else{for(var i=[],n=0;n<this.contacts.length;n++)for(var s in this.contacts[n])var a=this.contacts[n][s];t.resolve(i)}else t.reject("ContactError.INVALID_ARGUMENT_ERROR")}return t.promise}}}]),r.factory("$cordovaDatePicker",["$q",function(r){return{show:function(e){var t=r.defer();return e=e||{date:new Date,mode:"date"},t.resolve(e.date),t.promise}}}]),r.factory("$cordovaDevice",function(){var r="",e="",t="",o="",i="",n="";return{device:r,cordova:e,model:t,platform:o,uuid:i,version:n,getDevice:function(){return this.device},getCordova:function(){return this.cordova},getModel:function(){return this.model},getPlatform:function(){return this.platform},getUUID:function(){return this.uuid},getVersion:function(){return this.version}}}),r.factory("$cordovaDeviceMotion",["$interval","$q",function(r,e){var t=null,o=!1,i=[],n=[];return{currentAcceleration:t,throwsError:o,positions:i,watchIntervals:n,getCurrentAcceleration:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the current acceleration."):r.resolve(this.currentAcceleration),r.promise},watchAcceleration:function(t){var o=e.defer(),i=Math.floor(1e6*Math.random()+1);if(this.positions=[],self=this,this.throwsError)o.reject("There was an error watching the current acceleration.");else{var n=1e4;t&&t.frequency&&(n=t.frequency),this.watchIntervals.push(r(function(){self.throwsError&&o.reject("There was an error watching the acceleration.");var r=Math.floor(100*Math.random()+1),e=Math.floor(100*Math.random()+1),t=Math.floor(100*Math.random()+1),i={x:r,y:e,z:t,timestamp:Date.now()};self.positions.push(i),o.notify(i)},n))}return{watchId:i,promise:o.promise}},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var i=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){r.cancel(n[s].interval),i=s;break}-1!==i&&this.watchIntervals.splice(i,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaDeviceOrientation",["$interval","$q",function(r,e){var t=null,o=!1,i=[],n=[];return{currentHeading:t,throwsError:o,readings:i,watchIntervals:n,getCurrentHeading:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the current heading."):r.resolve(this.currentHeading),r.promise},watchHeading:function(t){var o=e.defer(),i=Math.floor(1e6*Math.random()+1),s=this;if(s.readings=[],s.throwsError)o.reject("There was an error getting the compass heading.");else{var a=100;t&&t.frequency&&(a=t.frequency),s.watchIntervals.push({watchID:i,interval:r(function(){s.throwsError&&o.reject("There was an error watching the acceleration.");var r=359.99*Math.random()+1,e=359.99*Math.random()+1,t=Math.floor(360*Math.random()+1),i={magneticHeading:r,trueHeading:e,headingAccuracy:t,timestamp:Date.now()};s.readings.push(i),o.notify(i)},a)})}var c=function(e){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===e){r.cancel(n[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(i)},o.promise.clearWatch=function(r){c(r||i)},o.promise.watchID=i,o.promise},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var i=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchId===t){r.cancel(n[s].interval),i=s;break}-1!==i&&this.watchIntervals.splice(i,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaDialogs",["$q",function(r){var e=!1,t="",o="",i="",n=0,s=!0;return{dialogText:e,dialogTitle:t,defaultValue:o,promptResponse:i,buttonLabels:[],beepCount:n,useHostAbilities:s,alert:function(e,t,o){var i=r.defer();return this.useHostAbilities?(alert(e),i.resolve()):(this.dialogText=e,this.dialogTitle=t,this.buttonLabels.push(o),i.resolve()),i.promise},confirm:function(e,t,o){var i=r.defer();if(this.useHostAbilities){var n=confirm(e);i.resolve(n?2:1)}else this.dialogText=e,this.dialogTitle=t,this.buttonLabels.push(o),i.resolve(0);return i.promise},prompt:function(e,t,o,i){var n=r.defer();if(this.useHostAbilities){var s=prompt(e,i);n.resolve(s)}else{this.dialogText=e,this.dialogTitle=t,this.defaultValue=i;for(var a=0;a<o.length;a++)this.buttonLabels.push(o[a]);n.resolve(this.promptResponse)}return n.promise},beep:function(r){this.beepCount=r}}}]),r.factory("$cordovaFile",["$q",function(r){var e=!1,t={},o=!1,i={},n=function(e){var t=r.defer();return this.throwsError?t.reject(e):t.resolve(),t.promise};return{throwsError:e,fileSystem:t,shouldMockFiles:o,files:i,checkDir:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]&&!this.files[e].isFile?t.resolve():t.reject(),t.promise}return n.call(this,"There was an error checking the directory.")},createDir:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]={isFile:!1},t.resolve(),t.promise}return n.call(this,"There was an error creating the directory.")},listDir:function(){return n.call(this,"There was an error listing the directory")},checkFile:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]&&this.files[e].isFile?t.resolve():t.reject(),t.promise}return n.call(this,"There was an error checking for the file.")},createFile:function(e){if(this.shouldMockFiles){var t=r.defer();return this.files[e]={isFile:!0,fileContent:""},t.resolve(),t.promise}return n.call(this,"There was an error creating the file.")},removeFile:function(){return n.call(this,"There was an error removng the file.")},writeFile:function(r,e){return this.shouldMockFiles&&r&&e&&(this.files[r]={isFile:!0,fileContent:e}),n.call(this,"There was an error writing the file.")},readFile:function(r){return this.readAsText(r)},readAsText:function(e){if(this.shouldMockFiles){var t=r.defer();return i[e]&&i[e].isFile?t.resolve(i[e].fileContent):t.reject(),t.promise}return n.call(this,"There was an error reading the file as text.")},readAsDataURL:function(){return n.call(this,"There was an error reading the file as a data url.")},readAsBinaryString:function(){return n.call(this,"There was an error reading the file as a binary string.")},readAsArrayBuffer:function(){return n.call(this,"There was an error reading the file as an array buffer.")},readFileMetadata:function(){return n.call(this,"There was an error reading the file metadata")},readFileAbsolute:function(){return n.call(this,"There was an error reading the file from the absolute path")},readFileMetadataAbsolute:function(){return n.call(this,"There was an error reading the file metadta from the absolute path")},downloadFile:function(){return n.call(this,"There was an error downloading the file.")},uploadFile:function(){return n.call(this,"There was an error uploading the file.")}}}]),r.factory("$cordovaFileOpener2",["$q",function(r){var e=!1;return{throwsError:e,open:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the file."}):e.resolve(),e.promise},uninstall:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the packageId."}):e.resolve(),e.promise},appIsInstalled:function(){var e=r.defer();return this.throwError?e.reject({status:0,message:"There was an error capturing the packageId."}):e.resolve(),e.promise}}}]),r.factory("$cordovaGeolocation",["$interval","$q",function(r,e){var t=!1,o=!0,i=[],n=[],s=null,a=null;return{throwsError:t,watchIntervals:i,locations:n,currentPosition:s,nextPosition:a,useHostAbilities:o,getCurrentPosition:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error getting the location."):(r&&(r=r),this.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(r){this.currentPosition=r,t.resolve(this.currentPosition)},function(r){t.reject(r)}):t.reject("Geolocation is not supported by this browser."):t.resolve(this.currentPosition)),t.promise},watchPosition:function(t){var o=e.defer(),n=Math.floor(1e6*Math.random()+1),s=this;if(s.locations=[],s.throwsError)o.reject("There was an error getting the geolocation.");else{var a=1e3;t&&t.timeout&&(a=t.timeout),s.watchIntervals.push({watchID:n,interval:r(function(){s.throwsError&&o.reject("There was an error watching the geolocation.");var r=s.nextPosition;null===r&&(s.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(r){s.currentPosition=r,s.locations.push(r),o.resolve(r)},function(r){o.reject(r)}):o.reject("Geolocation is not supported by this browser."):(r={coords:{latitude:180*Math.random()+1-90,longitude:360*Math.random()+1-180,altitude:100*Math.random()+1,accuracy:10*Math.random()+1,altitudeAccuracy:10*Math.random()+1,heading:360*Math.random()+1,speed:100*Math.random()+1},timestamp:Date.now()},s.currentPosition=r,s.locations.push(r),o.notify(r)))},a)})}var c=function(e){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===e){r.cancel(i[o].interval),t=o;break}-1!==t&&s.watchIntervals.splice(t,1)};return o.promise.cancel=function(){c(n)},o.promise.clearWatch=function(r){c(r||n)},o.promise.watchID=n,o.promise},clearWatch:function(t){var o=e.defer();if(t)if(this.throwsError)o.reject("Unable to clear watch.");else{for(var n=-1,s=0;s<this.watchIntervals.length;s++)if(this.watchIntervals[s].watchID===t){r.cancel(i[s].interval),n=s;break}-1!==n&&this.watchIntervals.splice(n,1)}else o.reject("Unable to clear watch. No watch ID provided.");return o.promise}}}]),r.factory("$cordovaGlobalization",["$q",function(r){var e=!1,t=navigator.language?navigator.language:"en-US",o={value:t},i="Sunday",n={value:t};return{throwsError:e,preferredLanguage:o,localeName:n,firstDayOfWeek:i,getPreferredLanguage:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the preferred language."):e.resolve(this.preferredLanguage),e.promise},getLocaleName:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the locale name."):e.resolve(this.localeName),e.promise},getFirstDayOfWeek:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the first day of week."):e.resolve(this.firstDayOfWeek),e.promise},dateToString:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error getting the string from the date.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},stringToDate:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error getting the date from the string.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},getDatePattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting the date pattern.");else{var o="";e=e,t.resolve(o)}return t.promise},getDateNames:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting the date names.");else{var o="";e=e,t.resolve(o)}return t.promise},isDayLightSavingsTime:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error getting if this is in daylight savings time mode.");else{var o="";e=e,t.resolve(o)}return t.promise},numberToString:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error convertng the number to a string.");else{var i="";e=e,t=t,o.resolve(i)}return o.promise},stringToNumber:function(e,t){var o=r.defer();if(this.throwsError)o.reject("There was an error convertng the string to a number.");else{var i="";t=t,o.resolve(i)}return o.promise},getNumberPattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";e=e,t.resolve(o)}return t.promise},getCurrencyPattern:function(e){var t=r.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";e=e,t.resolve(o)}return t.promise}}}]),r.factory("$cordovaGoogleAnalytics",["$q",function(r){var e=!1,t={};t.throwsError=e;var o=["startTrackerWithId","setUserId","debugMode","trackView","addCustomDimension","trackEvent","trackException","trackTiming","addTransaction","addTransactionItem"];return o.forEach(function(e){t[e]=function(){var e=r.defer();return this.throwsError?e.reject():e.resolve(),e.promise}}),t}]),r.factory("$cordovaGooglePlayGame",["$q",function(r){var e=!1,t=!1,o="";return{_throwsError:e,_isSignedIn:t,_displayName:o,auth:function(){var e=r.defer();return this._throwsError?e.reject("There was a auth error."):(this.isSignedIn=!0,e.resolve("SIGN IN SUCCESS")),e.promise},signout:function(){var e=r.defer();return this.throwsError?e.reject("There was a signout error."):e.resolve(),e.promise},isSignedIn:function(){var e=r.defer();return this._throwsError?e.reject("There was a isSignedIn error."):e.resolve({isSignedIn:this._isSignedIn}),e.promise},showPlayer:function(){var e=r.defer();return this.throwsError?e.reject("There was a showPlayer error."):e.resolve({displayName:this._displayName}),e.promise},submitScore:function(){var e=r.defer();return this._throwsError?e.reject("There was a submitScore error."):e.resolve("OK"),e.promise},showAllLeaderboards:function(){var e=r.defer();return this.throwsError?e.reject("There was a showAllLeaderboards error."):e.resolve("OK"),e.promise},showLeaderboard:function(){var e=r.defer();return this._throwsError?e.reject("There was a showLeaderboard error."):e.resolve("OK"),e.promise},unlockAchievement:function(){var e=r.defer();return this.throwsError?e.reject("There was a unlockAchievement error."):e.resolve("OK"),e.promise},incrementAchievement:function(){var e=r.defer();return this._throwsError?e.reject("There was a incrementAchievement error."):e.resolve("OK"),e.promise},showAchievements:function(){var e=r.defer();return this.throwsError?e.reject("There was a showAchievements error."):e.resolve("OK"),e.promise}}}]),r.factory("$cordovaKeyboard",function(){var r=!1;return{hideAccessoryBar:function(){},close:function(){r=!1},show:function(){r=!0},disableScroll:function(){},isVisible:function(){return r}}}),r.factory("$cordovaKeychain",["$q",function(r){var e={};return{keychains:e,getForKey:function(e,t){var o=r.defer();return this.keychains[t]?o.resolve(this.keychains[t][e]):o.reject(),o.promise},setForKey:function(e,t,o){var i=r.defer();return this.keychains[t]||(this.keychains[t]={}),this.keychains[t][e]=o,i.resolve(),i.promise},removeForKey:function(e,t){var o=r.defer();return this.keychains[t]&&delete this.keychains[t][e],o.resolve(),o.promise}}}]),r.factory("$cordovaNetwork",function(){var r="WiFi connection",e=!0;return{connectionType:r,isConnected:e,getNetwork:function(){return this.connectionType},isOnline:function(){return this.isConnected},isOffline:function(){return!this.isConnected}}}),r.factory("$cordovaPush",["$q","$timeout","$rootScope",function(r,e,t){var o=!1,i="";return{throwsError:o,deviceToken:i,onNotification:function(r){e(function(){t.$broadcast("$cordovaPush:notificationReceived",r)})},register:function(e){var t=this,o=r.defer();return void 0!==e&&void 0===e.ecb&&(e.ecb=this.onNotification),this.throwsError?o.reject("There was a register error."):(o.resolve(this.deviceToken),e&&e.ecb&&e.ecb({event:"registered",regid:t.deviceToken})),o.promise},unregister:function(){var e=r.defer();return this.throwsError?e.reject("There was a register error."):e.resolve(),e.promise}}}]),r.factory("$cordovaSocialSharing",["$q",function(r){var e=!1,t="",o="",i="",n="",s="",a="",c=[],h=[],u=[];return{throwsError:e,message:t,image:o,link:i,number:n,subject:a,toAddresses:c,bccAddresses:h,socialService:s,attachments:u,shareViaTwitter:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via Twitter."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaWhatsApp:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via WhatsApp."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaFacebook:function(e,t,o){var i=r.defer();return this.throwsError?i.reject("There was an error sharing via Facebook."):(this.message=e,this.image=t,this.link=o,i.resolve()),i.promise},shareViaSMS:function(e,t){var o=r.defer();return this.throwsError?o.reject("There was an error sharing via SMS."):(this.message=e,this.number=t,o.resolve()),o.promise},shareViaEmail:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=e,this.subject=t,this.toAddresses=o,this.bccAddressesc=i,this.attachments=n,s.resolve()),s.promise},canShareViaEmail:function(){var e=r.defer();return this.throwsError?e.reject(!1):e.resolve(!0),e.promise},canShareVia:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=t,this.socialService=e,this.subject=o,this.attachments=i,this.link=n,s.resolve()),s.promise},shareVia:function(e,t,o,i,n){var s=r.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.socialService=e,this.message=t,this.subject=o,this.attachments=i,this.link=n,s.resolve()),s.promise},share:function(e,t,o,i){var n=r.defer();return this.throwsError?n.reject("There was an error sharing via SMS."):(this.message=e,this.subject=t,this.attachments=o,this.link=i,n.resolve()),n.promise}}}]),r.factory("$cordovaSplashscreen",function(){var r=!1;return{isVisible:r,hide:function(){return this.isVisible=!1,!0},show:function(){return this.isVisible=!0,!0}}}),r.factory("$cordovaStatusbar",function(){var r=!0,e=!0;return{isStatusBarVisible:r,canOverlayWebView:e,overlaysWebView:function(r){this.canOverlayWebView=r},style:function(r){return r},styleHex:function(r){return r},styleColor:function(r){return r},hide:function(){this.isStatusBarVisible=!1},show:function(){this.isStatusBarVisible=!0},isVisible:function(){return this.isStatusBarVisible}}}),r.factory("$cordovaToast",["$q",function(r){var e=!1;return{throwsError:e,showShortTop:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showShortCenter:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showShortBottom:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongTop:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongCenter:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},showLongBottom:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise},show:function(){var e=r.defer();return this.throwsError?e.reject("There was an error showing the toast."):e.resolve(),e.promise}}}]),r.factory("$cordovaVibration",["$timeout",function(r){var e=!1,t=null;return{vibrateTimer:t,isVibrating:e,vibrate:function(e){e>0&&(this.isVibrating=!0,self=this,this.vibrateTimer=e instanceof Array?r(function(){self.isVibrating=!1,self.vibrateTimer=null},e[0]):r(function(){self.isVibrating=!1,self.vibrateTimer=null},e))},vibrateWithPattern:function(){},cancelVibration:function(){null!==this.vibrateTimer&&this.isVibrating===!0&&(r.cancel(this.vibrateTimer),this.isVibrating=!1)}}}])}(); diff --git a/www/lib/ngCordova/dist/ng-cordova.js b/www/lib/ngCordova/dist/ng-cordova.js index 76f3fa6e..4f749d9f 100644 --- a/www/lib/ngCordova/dist/ng-cordova.js +++ b/www/lib/ngCordova/dist/ng-cordova.js @@ -1,6 +1,6 @@ /*! * ngCordova - * v0.1.15-alpha + * v0.1.17-alpha * Copyright 2014 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */ @@ -133,7 +133,6 @@ angular.module('ngCordova.plugins.appRate', []) .provider("$cordovaAppRate", [function () { - this.setPreferences = function (defaults) { if (!defaults || !angular.isObject(defaults)) { return; @@ -151,7 +150,6 @@ angular.module('ngCordova.plugins.appRate', []) AppRate.preferences.storeAppURL.windows8 = defaults.windowsURL || null; }; - this.setCustomLocale = function (customObj) { var strings = { title: 'Rate %@', @@ -279,9 +277,10 @@ angular.module('ngCordova.plugins.backgroundGeolocation', []) } }; } + ]); -// install : cordova plugin add de.appplant.cordova.plugin.badge +// install : cordova plugin add https://github.com/katzer/cordova-plugin-badge.git // link : https://github.com/katzer/cordova-plugin-badge angular.module('ngCordova.plugins.badge', []) @@ -294,8 +293,7 @@ angular.module('ngCordova.plugins.badge', []) cordova.plugins.notification.badge.hasPermission(function (permission) { if (permission) { q.resolve(true); - } - else { + } else { q.reject("You do not have permission"); } }); @@ -313,8 +311,7 @@ angular.module('ngCordova.plugins.badge', []) cordova.plugins.notification.badge.hasPermission(function (permission) { if (permission) { q.resolve(cordova.plugins.notification.badge.set(number)); - } - else { + } else { q.reject("You do not have permission to set Badge"); } }); @@ -342,8 +339,7 @@ angular.module('ngCordova.plugins.badge', []) cordova.plugins.notification.badge.hasPermission(function (permission) { if (permission) { q.resolve(cordova.plugins.notification.badge.clear()); - } - else { + } else { q.reject("You do not have permission to clear Badge"); } }); @@ -357,7 +353,7 @@ angular.module('ngCordova.plugins.badge', []) }]); // install : cordova plugin add https://github.com/wildabeast/BarcodeScanner.git -// link : https://github.com/wildabeast/BarcodeScanner/#using-the-plugin +// link : https://github.com/wildabeast/BarcodeScanner angular.module('ngCordova.plugins.barcodeScanner', []) @@ -391,8 +387,8 @@ angular.module('ngCordova.plugins.barcodeScanner', []) }; }]); -// install : cordova plugin add org.apache.cordova.battery-status -// link : https://github.com/apache/cordova-plugin-battery-status/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-battery-status +// link : https://github.com/apache/cordova-plugin-battery-status angular.module('ngCordova.plugins.batteryStatus', []) @@ -429,7 +425,7 @@ angular.module('ngCordova.plugins.batteryStatus', []) .run(['$cordovaBatteryStatus', function ($cordovaBatteryStatus) { }]); -// install : cordova plugin add https://github.com/don/cordova-plugin-ble-central#:/plugin +// install : cordova plugin add https://github.com/don/cordova-plugin-ble-central.git // link : https://github.com/don/cordova-plugin-ble-central angular.module('ngCordova.plugins.ble', []) @@ -497,9 +493,9 @@ angular.module('ngCordova.plugins.ble', []) return q.promise; }, - notify: function (deviceID, serviceUUID, characteristicUUID) { + startNotification: function (deviceID, serviceUUID, characteristicUUID) { var q = $q.defer(); - ble.notify(deviceID, serviceUUID, characteristicUUID, function (result) { + ble.startNotification(deviceID, serviceUUID, characteristicUUID, function (result) { q.resolve(result); }, function (error) { q.reject(error); @@ -507,9 +503,9 @@ angular.module('ngCordova.plugins.ble', []) return q.promise; }, - indicate: function (deviceID, serviceUUID, characteristicUUID) { + stopNotification: function (deviceID, serviceUUID, characteristicUUID) { var q = $q.defer(); - ble.indicate(deviceID, serviceUUID, characteristicUUID, function (result) { + ble.stopNotification(deviceID, serviceUUID, characteristicUUID, function (result) { q.resolve(result); }, function (error) { q.reject(error); @@ -539,7 +535,7 @@ angular.module('ngCordova.plugins.ble', []) }; }]); -// install : cordova plugin add com.megster.cordova.bluetoothserial +// install : cordova plugin add https://github.com/don/BluetoothSerial.git // link : https://github.com/don/BluetoothSerial angular.module('ngCordova.plugins.bluetoothSerial', []) @@ -568,7 +564,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - disconnect: function () { var q = $q.defer(); $window.bluetoothSerial.disconnect(function () { @@ -579,7 +574,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - list: function () { var q = $q.defer(); $window.bluetoothSerial.list(function (data) { @@ -590,7 +584,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - discoverUnpaired: function () { var q = $q.defer(); $window.bluetoothSerial.discoverUnpaired(function (data) { @@ -601,7 +594,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - setDeviceDiscoveredListener: function () { var q = $q.defer(); $window.bluetoothSerial.setDeviceDiscoveredListener(function (data) { @@ -610,11 +602,10 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - clearDeviceDiscoveredListener: function() { + clearDeviceDiscoveredListener: function () { $window.bluetoothSerial.clearDeviceDiscoveredListener(); }, - showBluetoothSettings: function () { var q = $q.defer(); $window.bluetoothSerial.showBluetoothSettings(function () { @@ -625,7 +616,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - isEnabled: function () { var q = $q.defer(); $window.bluetoothSerial.isEnabled(function () { @@ -636,7 +626,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - enable: function () { var q = $q.defer(); $window.bluetoothSerial.enable(function () { @@ -647,7 +636,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - isConnected: function () { var q = $q.defer(); $window.bluetoothSerial.isConnected(function () { @@ -658,7 +646,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - available: function () { var q = $q.defer(); $window.bluetoothSerial.available(function (data) { @@ -669,7 +656,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - read: function () { var q = $q.defer(); $window.bluetoothSerial.read(function (data) { @@ -690,7 +676,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - write: function (data) { var q = $q.defer(); $window.bluetoothSerial.write(data, function () { @@ -701,7 +686,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - subscribe: function (delimiter) { var q = $q.defer(); $window.bluetoothSerial.subscribe(delimiter, function (data) { @@ -722,7 +706,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - unsubscribe: function () { var q = $q.defer(); $window.bluetoothSerial.unsubscribe(function () { @@ -743,7 +726,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - clear: function () { var q = $q.defer(); $window.bluetoothSerial.clear(function () { @@ -754,7 +736,6 @@ angular.module('ngCordova.plugins.bluetoothSerial', []) return q.promise; }, - readRSSI: function () { var q = $q.defer(); $window.bluetoothSerial.readRSSI(function (data) { @@ -814,8 +795,6 @@ angular.module('ngCordova.plugins.brightness', []) }]); - - // install : cordova plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git // link : https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin @@ -1111,8 +1090,8 @@ angular.module('ngCordova.plugins.calendar', []) }; }]); -// install : cordova plugin add org.apache.cordova.camera -// link : https://github.com/apache/cordova-plugin-camera/blob/master/doc/index.md#orgapachecordovacamera +// install : cordova plugin add cordova-plugin-camera +// link : https://github.com/apache/cordova-plugin-camera angular.module('ngCordova.plugins.camera', []) @@ -1150,8 +1129,8 @@ angular.module('ngCordova.plugins.camera', []) }; }]); -// install : cordova plugin add org.apache.cordova.media-capture -// link : https://github.com/apache/cordova-plugin-media-capture/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-media-capture +// link : https://github.com/apache/cordova-plugin-media-capture angular.module('ngCordova.plugins.capture', []) @@ -1209,7 +1188,7 @@ angular.module('ngCordova.plugins.capture', []) }; }]); -// install : cordova plugin add https://github.com/VersoSolutions/CordovaClipboard +// install : cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git // link : https://github.com/VersoSolutions/CordovaClipboard angular.module('ngCordova.plugins.clipboard', []) @@ -1244,8 +1223,8 @@ angular.module('ngCordova.plugins.clipboard', []) }; }]); -// install : cordova plugin add org.apache.cordova.contacts -// link : https://github.com/apache/cordova-plugin-contacts/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-contacts +// link : https://github.com/apache/cordova-plugin-contacts angular.module('ngCordova.plugins.contacts', []) @@ -1332,8 +1311,8 @@ angular.module('ngCordova.plugins.datePicker', []) }; }]); -// install : cordova plugin add org.apache.cordova.device -// link : https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-device +// link : https://github.com/apache/cordova-plugin-device angular.module('ngCordova.plugins.device', []) @@ -1342,7 +1321,7 @@ angular.module('ngCordova.plugins.device', []) return { /** * Returns the whole device object. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md + * @see https://github.com/apache/cordova-plugin-device * @returns {Object} The device object. */ getDevice: function () { @@ -1351,7 +1330,7 @@ angular.module('ngCordova.plugins.device', []) /** * Returns the Cordova version. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md#devicecordova + * @see https://github.com/apache/cordova-plugin-device#devicecordova * @returns {String} The Cordova version. */ getCordova: function () { @@ -1360,7 +1339,7 @@ angular.module('ngCordova.plugins.device', []) /** * Returns the name of the device's model or product. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md#devicemodel + * @see https://github.com/apache/cordova-plugin-device#devicemodel * @returns {String} The name of the device's model or product. */ getModel: function () { @@ -1377,7 +1356,7 @@ angular.module('ngCordova.plugins.device', []) /** * Returns the device's operating system name. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md#deviceplatform + * @see https://github.com/apache/cordova-plugin-device#deviceplatform * @returns {String} The device's operating system name. */ getPlatform: function () { @@ -1386,7 +1365,7 @@ angular.module('ngCordova.plugins.device', []) /** * Returns the device's Universally Unique Identifier. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md#deviceuuid + * @see https://github.com/apache/cordova-plugin-device#deviceuuid * @returns {String} The device's Universally Unique Identifier */ getUUID: function () { @@ -1395,7 +1374,7 @@ angular.module('ngCordova.plugins.device', []) /** * Returns the operating system version. - * @see https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md#deviceversion + * @see https://github.com/apache/cordova-plugin-device#deviceversion * @returns {String} */ getVersion: function () { @@ -1404,8 +1383,8 @@ angular.module('ngCordova.plugins.device', []) }; }]); -// install : cordova plugin add org.apache.cordova.device-motion -// link : https://github.com/apache/cordova-plugin-device-motion/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-device-motion +// link : https://github.com/apache/cordova-plugin-device-motion angular.module('ngCordova.plugins.deviceMotion', []) @@ -1452,13 +1431,15 @@ angular.module('ngCordova.plugins.deviceMotion', []) }; }]); -// install : cordova plugin add org.apache.cordova.device-orientation -// link : https://github.com/apache/cordova-plugin-device-orientation/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-device-orientation +// link : https://github.com/apache/cordova-plugin-device-orientation angular.module('ngCordova.plugins.deviceOrientation', []) .factory('$cordovaDeviceOrientation', ['$q', function ($q) { - + var defaultOptions = { + frequency: 3000 // every 3s + }; return { getCurrentHeading: function () { var q = $q.defer(); @@ -1475,11 +1456,12 @@ angular.module('ngCordova.plugins.deviceOrientation', []) watchHeading: function (options) { var q = $q.defer(); + var _options = angular.extend(defaultOptions, options); var watchID = navigator.compass.watchHeading(function (result) { q.notify(result); }, function (err) { q.reject(err); - }, options); + }, _options); q.promise.cancel = function () { navigator.compass.clearWatch(watchID); @@ -1500,8 +1482,8 @@ angular.module('ngCordova.plugins.deviceOrientation', []) }; }]); -// install : cordova plugin add org.apache.cordova.dialogs -// link : https://github.com/apache/cordova-plugin-dialogs/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-dialogs +// link : https://github.com/apache/cordova-plugin-dialogs angular.module('ngCordova.plugins.dialogs', []) @@ -1514,8 +1496,7 @@ angular.module('ngCordova.plugins.dialogs', []) if (!$window.navigator.notification) { $window.alert(message); q.resolve(); - } - else { + } else { navigator.notification.alert(message, function () { q.resolve(); }, title, buttonName); @@ -1530,12 +1511,10 @@ angular.module('ngCordova.plugins.dialogs', []) if (!$window.navigator.notification) { if ($window.confirm(message)) { q.resolve(1); - } - else { + } else { q.resolve(2); } - } - else { + } else { navigator.notification.confirm(message, function (buttonIndex) { q.resolve(buttonIndex); }, title, buttonLabels); @@ -1551,12 +1530,10 @@ angular.module('ngCordova.plugins.dialogs', []) var res = $window.prompt(message, defaultText); if (res !== null) { q.resolve({input1: res, buttonIndex: 1}); - } - else { + } else { q.resolve({input1: res, buttonIndex: 2}); } - } - else { + } else { navigator.notification.prompt(message, function (result) { q.resolve(result); }, title, buttonLabels, defaultText); @@ -1570,7 +1547,7 @@ angular.module('ngCordova.plugins.dialogs', []) }; }]); -// install : cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git@0.8.2 +// install : cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git // link : https://github.com/katzer/cordova-plugin-email-composer angular.module('ngCordova.plugins.emailComposer', []) @@ -1582,7 +1559,11 @@ angular.module('ngCordova.plugins.emailComposer', []) var q = $q.defer(); cordova.plugins.email.isAvailable(function (isAvailable) { - isAvailable ? q.resolve() : q.reject(); + if (isAvailable) { + q.resolve(); + } else { + q.reject(); + } }); return q.promise; @@ -1604,7 +1585,7 @@ angular.module('ngCordova.plugins.emailComposer', []) }; }]); -// install : cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication" +// install : cordova -d plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="123456789" --variable APP_NAME="myApplication" // link : https://github.com/Wizcorp/phonegap-facebook-plugin angular.module('ngCordova.plugins.facebook', []) @@ -1788,8 +1769,8 @@ angular.module('ngCordova.plugins.facebookAds', []) }; }]); -// install : cordova plugin add org.apache.cordova.file -// link : https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-file +// link : https://github.com/apache/cordova-plugin-file angular.module('ngCordova.plugins.file', []) @@ -1814,21 +1795,21 @@ angular.module('ngCordova.plugins.file', []) return { - getFreeDiskSpace: function() { - var q = $q.defer(); - cordova.exec(function(result) { - q.resolve(result); - }, function(error) { - q.reject(error); - }, "File", "getFreeDiskSpace", []); - return q.promise; + getFreeDiskSpace: function () { + var q = $q.defer(); + cordova.exec(function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }, "File", "getFreeDiskSpace", []); + return q.promise; }, checkDir: function (path, dir) { var q = $q.defer(); if ((/^\//.test(dir))) { - q.reject("directory cannot start with \/") + q.reject("directory cannot start with \/"); } try { @@ -1851,12 +1832,11 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - checkFile: function (path, file) { var q = $q.defer(); if ((/^\//.test(file))) { - q.reject("directory cannot start with \/") + q.reject("directory cannot start with \/"); } try { @@ -1883,7 +1863,7 @@ angular.module('ngCordova.plugins.file', []) var q = $q.defer(); if ((/^\//.test(dirName))) { - q.reject("directory cannot start with \/") + q.reject("directory cannot start with \/"); } replaceBool = replaceBool ? false : true; @@ -1917,7 +1897,7 @@ angular.module('ngCordova.plugins.file', []) var q = $q.defer(); if ((/^\//.test(fileName))) { - q.reject("file-name cannot start with \/") + q.reject("file-name cannot start with \/"); } replaceBool = replaceBool ? false : true; @@ -1946,12 +1926,11 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - removeDir: function (path, dirName) { var q = $q.defer(); if ((/^\//.test(dirName))) { - q.reject("file-name cannot start with \/") + q.reject("file-name cannot start with \/"); } try { @@ -2013,7 +1992,7 @@ angular.module('ngCordova.plugins.file', []) var q = $q.defer(); if ((/^\//.test(dirName))) { - q.reject("file-name cannot start with \/") + q.reject("file-name cannot start with \/"); } try { @@ -2069,8 +2048,7 @@ angular.module('ngCordova.plugins.file', []) writer.onwriteend = function (evt) { if (this.error) { q.reject(this.error); - } - else { + } else { q.resolve(evt); } }; @@ -2097,7 +2075,6 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - writeExistingFile: function (path, fileName, text) { var q = $q.defer(); @@ -2114,8 +2091,7 @@ angular.module('ngCordova.plugins.file', []) writer.onwriteend = function (evt) { if (this.error) { q.reject(this.error); - } - else { + } else { q.resolve(evt); } }; @@ -2142,7 +2118,6 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - readAsText: function (path, file) { var q = $q.defer(); @@ -2157,13 +2132,11 @@ angular.module('ngCordova.plugins.file', []) var reader = new FileReader(); reader.onloadend = function (evt) { - if (evt.target._result !== undefined || evt.target._result !== null) { - q.resolve(evt.target._result); - } - else if (evt.target._error !== undefined || evt.target._error !== null) { - q.reject(evt.target._error); - } - else { + if (evt.target.result !== undefined || evt.target.result !== null) { + q.resolve(evt.target.result); + } else if (evt.target.error !== undefined || evt.target.error !== null) { + q.reject(evt.target.error); + } else { q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); } }; @@ -2186,7 +2159,6 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - readAsDataURL: function (path, file) { var q = $q.defer(); @@ -2200,13 +2172,11 @@ angular.module('ngCordova.plugins.file', []) fileEntry.file(function (fileData) { var reader = new FileReader(); reader.onloadend = function (evt) { - if (evt.target._result !== undefined || evt.target._result !== null) { - q.resolve(evt.target._result); - } - else if (evt.target._error !== undefined || evt.target._error !== null) { - q.reject(evt.target._error); - } - else { + if (evt.target.result !== undefined || evt.target.result !== null) { + q.resolve(evt.target.result); + } else if (evt.target.error !== undefined || evt.target.error !== null) { + q.reject(evt.target.error); + } else { q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); } }; @@ -2241,13 +2211,11 @@ angular.module('ngCordova.plugins.file', []) fileEntry.file(function (fileData) { var reader = new FileReader(); reader.onloadend = function (evt) { - if (evt.target._result !== undefined || evt.target._result !== null) { - q.resolve(evt.target._result); - } - else if (evt.target._error !== undefined || evt.target._error !== null) { - q.reject(evt.target._error); - } - else { + if (evt.target.result !== undefined || evt.target.result !== null) { + q.resolve(evt.target.result); + } else if (evt.target.error !== undefined || evt.target.error !== null) { + q.reject(evt.target.error); + } else { q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); } }; @@ -2282,13 +2250,11 @@ angular.module('ngCordova.plugins.file', []) fileEntry.file(function (fileData) { var reader = new FileReader(); reader.onloadend = function (evt) { - if (evt.target._result !== undefined || evt.target._result !== null) { - q.resolve(evt.target._result); - } - else if (evt.target._error !== undefined || evt.target._error !== null) { - q.reject(evt.target._error); - } - else { + if (evt.target.result !== undefined || evt.target.result !== null) { + q.resolve(evt.target.result); + } else if (evt.target.error !== undefined || evt.target.error !== null) { + q.reject(evt.target.error); + } else { q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); } }; @@ -2310,7 +2276,6 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - moveFile: function (path, fileName, newPath, newFileName) { var q = $q.defer(); @@ -2377,7 +2342,6 @@ angular.module('ngCordova.plugins.file', []) return q.promise; }, - copyDir: function (path, dirName, newPath, newDirName) { var q = $q.defer(); @@ -2498,7 +2462,7 @@ angular.module('ngCordova.plugins.file', []) }]; }]); -// install : cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2 +// install : cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2.git // link : https://github.com/pwlin/cordova-plugin-file-opener2 angular.module('ngCordova.plugins.fileOpener2', []) @@ -2542,8 +2506,8 @@ angular.module('ngCordova.plugins.fileOpener2', []) }; }]); -// install : cordova plugin add org.apache.cordova.file-transfer -// link : https://github.com/apache/cordova-plugin-file-transfer/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-file-transfer +// link : https://github.com/apache/cordova-plugin-file-transfer angular.module('ngCordova.plugins.fileTransfer', []) @@ -2822,8 +2786,8 @@ angular.module('ngCordova.plugins.ga', []) }; }]); -// install : cordova plugin add org.apache.cordova.geolocation -// link : https://github.com/apache/cordova-plugin-geolocation/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-geolocation +// link : https://github.com/apache/cordova-plugin-geolocation angular.module('ngCordova.plugins.geolocation', []) @@ -2870,8 +2834,8 @@ angular.module('ngCordova.plugins.geolocation', []) }; }]); -// install : cordova plugin add org.apache.cordova.globalization -// link : https://github.com/apache/cordova-plugin-globalization/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-globalization +// link : https://github.com/apache/cordova-plugin-globalization angular.module('ngCordova.plugins.globalization', []) @@ -3234,6 +3198,30 @@ angular.module('ngCordova.plugins.googleAnalytics', []) return d.promise; }, + trackException: function (description, fatal) { + var d = $q.defer(); + + $window.analytics.trackException(description, fatal, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + trackTiming: function (category, milliseconds, variable, label) { + var d = $q.defer(); + + $window.analytics.trackTiming(category, milliseconds, variable, label, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + addTransaction: function (transactionId, affiliation, revenue, tax, shipping, currencyCode) { var d = $q.defer(); @@ -3278,8 +3266,7 @@ angular.module('ngCordova.plugins.googleMap', []) if (!$window.plugin.google.maps) { q.reject(null); - } - else { + } else { var div = document.getElementById("map_canvas"); map = $window.plugin.google.maps.Map.getMap(options); map.setDiv(div); @@ -3288,7 +3275,6 @@ angular.module('ngCordova.plugins.googleMap', []) return q.promise; }, - isMapLoaded: function () { // check if an instance of the map exists return !!map; }, @@ -3321,198 +3307,180 @@ angular.module('ngCordova.plugins.googleMap', []) angular.module('ngCordova.plugins.googlePlayGame', []) - .factory('$cordovaGooglePlayGame', ['$q', function ($q) { - - return { - - auth: function() { - var q = $q.defer(); - - googleplaygame.auth(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - signout: function() { - var q = $q.defer(); - - googleplaygame.signout(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - isSignedIn: function() { - var q = $q.defer(); - - googleplaygame.isSignedIn(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - showPlayer: function() { - var q = $q.defer(); - - googleplaygame.showPlayer(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - submitScore: function(data) { - var q = $q.defer(); - - googleplaygame.submitScore(data, function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - showAllLeaderboards: function() { - var q = $q.defer(); - - googleplaygame.showAllLeaderboards(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - showLeaderboard: function(data) { - var q = $q.defer(); - - googleplaygame.showLeaderboard(data, function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - unlockAchievement: function(data) { - var q = $q.defer(); - - googleplaygame.unlockAchievement(data, function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - incrementAchievement: function(data) { - var q = $q.defer(); - - googleplaygame.incrementAchievement(data, function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - }, - showAchievements: function() { - var q = $q.defer(); - - googleplaygame.showAchievements(function(success) { - return q.resolve(success); - }, function(err) { - return q.reject(err); - }); - - return q.promise; - } - }; - - }]); -// install : cordova plugin add nl.x-services.plugins.googleplus + .factory('$cordovaGooglePlayGame', ['$q', function ($q) { + + return { + + auth: function () { + var q = $q.defer(); + + googleplaygame.auth(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + signout: function () { + var q = $q.defer(); + + googleplaygame.signout(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + isSignedIn: function () { + var q = $q.defer(); + + googleplaygame.isSignedIn(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + showPlayer: function () { + var q = $q.defer(); + + googleplaygame.showPlayer(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + submitScore: function (data) { + var q = $q.defer(); + + googleplaygame.submitScore(data, function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + showAllLeaderboards: function () { + var q = $q.defer(); + + googleplaygame.showAllLeaderboards(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + showLeaderboard: function (data) { + var q = $q.defer(); + + googleplaygame.showLeaderboard(data, function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + unlockAchievement: function (data) { + var q = $q.defer(); + + googleplaygame.unlockAchievement(data, function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + incrementAchievement: function (data) { + var q = $q.defer(); + + googleplaygame.incrementAchievement(data, function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + }, + showAchievements: function () { + var q = $q.defer(); + + googleplaygame.showAchievements(function (success) { + return q.resolve(success); + }, function (err) { + return q.reject(err); + }); + + return q.promise; + } + }; + + }]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-googleplus.git // link : https://github.com/EddyVerbruggen/cordova-plugin-googleplus - angular.module('ngCordova.plugins.googleplus', []) +angular.module('ngCordova.plugins.googleplus', []) .factory('$cordovaGooglePlus', ['$q', '$window', function ($q, $window) { return { - login: function(iosKey){ - if(iosKey === undefined){ - iosKey = {}; - } - var q = $q.defer(); - $window.plugins.googleplus.login( - { - 'iOSApiKey': iosKey - // there is no API key for Android; you app is wired to the Google+ API by - //listing your package name in the google dev console and signing your apk - }, - function (response) { - q.resolve(response) - }, - function (error) { - q.reject(error) - } - ); + login: function (iosKey) { + var q = $q.defer(); + + if (iosKey === undefined) { + iosKey = {}; + } + $window.plugins.googleplus.login({'iOSApiKey': iosKey}, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); return q.promise; }, - silentLogin: function(iosKey){ + silentLogin: function (iosKey) { + var q = $q.defer(); - if(iosKey === undefined){ - iosKey = {}; - } - var q = $q.defer(); - $window.plugins.googleplus.trySilentLogin( - { - 'iOSApiKey': iosKey - // there is no API key for Android; you app is wired to the Google+ API by - //listing your package name in the google dev console and signing your apk - }, - function (response) { - q.resolve(response) - }, - function (error) { - q.reject(error) - } - ); + if (iosKey === undefined) { + iosKey = {}; + } + $window.plugins.googleplus.trySilentLogin({'iOSApiKey': iosKey}, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); return q.promise; }, - logout: function(){ + logout: function () { var q = $q.defer(); - $window.plugins.googleplus.logout( - function (response) { - q.resolve(response); - } - ); + $window.plugins.googleplus.logout(function (response) { + q.resolve(response); + }); }, - disconnect: function(){ + disconnect: function () { var q = $q.defer(); - $window.plugins.googleplus.disconnect( - function (response) { - q.resolve(response); - } - ); + $window.plugins.googleplus.disconnect(function (response) { + q.resolve(response); + }); } }; }]); -// install : cordova plugin add https://github.com/Telerik-Verified-Plugins/HealthKit +// install : cordova plugin add https://github.com/Telerik-Verified-Plugins/HealthKit.git // link : https://github.com/Telerik-Verified-Plugins/HealthKit angular.module('ngCordova.plugins.healthKit', []) @@ -3925,8 +3893,8 @@ angular.module('ngCordova.plugins.imagePicker', []) }; }]); -// install : cordova plugin add org.apache.cordova.inappbrowser -// link : https://github.com/apache/cordova-plugin-inappbrowser/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-inappbrowser +// link : https://github.com/apache/cordova-plugin-inappbrowser angular.module('ngCordova.plugins.inAppBrowser', []) @@ -4033,10 +4001,11 @@ angular.module('ngCordova.plugins.insomnia', []) allowSleepAgain: function () { return $window.plugins.insomnia.allowSleepAgain(); } - } + }; }]); -// install : cordova plugins add https://github.com/vstirbu/InstagramPlugin + +// install : cordova plugins add https://github.com/vstirbu/InstagramPlugin.git // link : https://github.com/vstirbu/InstagramPlugin angular.module('ngCordova.plugins.instagram', []) @@ -4053,7 +4022,7 @@ angular.module('ngCordova.plugins.instagram', []) return q.promise; } - Instagram.share(options.image, options.caption, function(err) { + Instagram.share(options.image, options.caption, function (err) { if(err) { q.reject(err); } else { @@ -4088,16 +4057,16 @@ angular.module('ngCordova.plugins.instagram', []) angular.module('ngCordova.plugins.keyboard', []) - .factory('$cordovaKeyboard', [function () { + .factory('$cordovaKeyboard', ['$rootScope', '$timeout', function ($rootScope, $timeout) { var keyboardShowEvent = function () { - $timeout(function () { + $rootScope.$evalAsync(function () { $rootScope.$broadcast('$cordovaKeyboard:show'); }); }; var keyboardHideEvent = function () { - $timeout(function () { + $rootScope.$evalAsync(function () { $rootScope.$broadcast('$cordovaKeyboard:hide'); }); }; @@ -4118,6 +4087,10 @@ angular.module('ngCordova.plugins.keyboard', []) return cordova.plugins.Keyboard.close(); }, + show: function () { + return cordova.plugins.Keyboard.show(); + }, + disableScroll: function (bool) { return cordova.plugins.Keyboard.disableScroll(bool); }, @@ -4143,15 +4116,12 @@ angular.module('ngCordova.plugins.keyboard', []) angular.module('ngCordova.plugins.keychain', []) - .factory('$cordovaKeychain', ['$q', '$window', function ($q, $window) { - - if ('Keychain' in $window) { - var kc = new Keychain(); - } + .factory('$cordovaKeychain', ['$q', function ($q) { return { getForKey: function (key, serviceName) { - var defer = $q.defer(); + var defer = $q.defer(), + kc = new Keychain(); kc.getForKey(defer.resolve, defer.reject, key, serviceName); @@ -4159,7 +4129,8 @@ angular.module('ngCordova.plugins.keychain', []) }, setForKey: function (key, serviceName, value) { - var defer = $q.defer(); + var defer = $q.defer(), + kc = new Keychain(); kc.setForKey(defer.resolve, defer.reject, key, serviceName, value); @@ -4167,7 +4138,8 @@ angular.module('ngCordova.plugins.keychain', []) }, removeForKey: function (key, serviceName) { - var defer = $q.defer(); + var defer = $q.defer(), + kc = new Keychain(); kc.removeForKey(defer.resolve, defer.reject, key, serviceName); @@ -4176,91 +4148,191 @@ angular.module('ngCordova.plugins.keychain', []) }; }]); -// install : cordova plugin add de.appplant.cordova.plugin.local-notification -// link : https://github.com/katzer/cordova-plugin-local-notifications/ +// install : cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git +// link : https://github.com/katzer/cordova-plugin-local-notifications angular.module('ngCordova.plugins.localNotification', []) .factory('$cordovaLocalNotification', ['$q', '$window', '$rootScope', '$timeout', function ($q, $window, $rootScope, $timeout) { - document.addEventListener("deviceready", function () { - if ($window.plugin && $window.plugin.notification) { - $window.plugin.notification.local.on("cancel", function (id, state, json) { - var notification = { - id: id, - state: state, - json: json - }; + document.addEventListener('deviceready', function () { + if ($window.cordova && + $window.cordova.plugins && + $window.cordova.plugins.notification && + $window.cordova.plugins.notification.local) { + // ----- "Scheduling" events + + // A local notification was scheduled + $window.cordova.plugins.notification.local.on('schedule', function (notification, state) { $timeout(function () { - $rootScope.$broadcast("$cordovaLocalNotification:canceled", notification); + $rootScope.$broadcast('$cordovaLocalNotification:schedule', notification, state); }); }); - $window.plugin.notification.local.on("click", function (id, state, json) { - var notification = { - id: id, - state: state, - json: json - }; + // A local notification was triggered + $window.cordova.plugins.notification.local.on('trigger', function (notification, state) { $timeout(function () { - $rootScope.$broadcast("$cordovaLocalNotification:clicked", notification); + $rootScope.$broadcast('$cordovaLocalNotification:trigger', notification, state); }); }); - $window.plugin.notification.local.on("trigger", function (id, state, json) { - var notification = { - id: id, - state: state, - json: json - }; + // ----- "Update" events + + // A local notification was updated + $window.cordova.plugins.notification.local.on('update', function (notification, state) { $timeout(function () { - $rootScope.$broadcast("$cordovaLocalNotification:triggered", notification); + $rootScope.$broadcast('$cordovaLocalNotification:update', notification, state); }); }); - $window.plugin.notification.local.on("add", function (id, state, json) { - var notification = { - id: id, - state: state, - json: json - }; + // ----- "Clear" events + + // A local notification was cleared from the notification center + $window.cordova.plugins.notification.local.on('clear', function (notification, state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:clear', notification, state); + }); + }); + + // All local notifications were cleared from the notification center + $window.cordova.plugins.notification.local.on('clearall', function (state) { $timeout(function () { - $rootScope.$broadcast("$cordovaLocalNotification:added", notification); + $rootScope.$broadcast('$cordovaLocalNotification:clearall', state); + }); + }); + + // ----- "Cancel" events + + // A local notification was cancelled + $window.cordova.plugins.notification.local.on('cancel', function (notification, state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:cancel', notification, state); + }); + }); + + // All local notifications were cancelled + $window.cordova.plugins.notification.local.on('cancelall', function (state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:cancelall', state); + }); + }); + + // ----- Other events + + // A local notification was clicked + $window.cordova.plugins.notification.local.on('click', function (notification, state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:click', notification, state); }); }); } }, false); return { + schedule: function (options, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.schedule(options, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + add: function (options, scope) { + console.warn('Deprecated: use "schedule" instead.'); + + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.schedule(options, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + update: function (options, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.update(options, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + clear: function (ids, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.clear(ids, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + clearAll: function (scope) { var q = $q.defer(); scope = scope || null; - $window.plugin.notification.local.add(options, function (result) { + + $window.cordova.plugins.notification.local.clearAll(function (result) { q.resolve(result); }, scope); + return q.promise; }, - cancel: function (id, scope) { + cancel: function (ids, scope) { var q = $q.defer(); scope = scope || null; - $window.plugin.notification.local.cancel(id, function (result) { + + $window.cordova.plugins.notification.local.cancel(ids, function (result) { q.resolve(result); }, scope); + return q.promise; }, cancelAll: function (scope) { var q = $q.defer(); scope = scope || null; - $window.plugin.notification.local.cancelAll(function (result) { + + $window.cordova.plugins.notification.local.cancelAll(function (result) { q.resolve(result); }, scope); + + return q.promise; + }, + + isPresent: function (id, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.isPresent(id, function (result) { + q.resolve(result); + }, scope); + return q.promise; }, isScheduled: function (id, scope) { var q = $q.defer(); scope = scope || null; - $window.plugin.notification.local.isScheduled(id, function (result) { + + $window.cordova.plugins.notification.local.isScheduled(id, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + isTriggered: function (id, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.isTriggered(id, function (result) { q.resolve(result); }, scope); @@ -4269,58 +4341,167 @@ angular.module('ngCordova.plugins.localNotification', []) hasPermission: function (scope) { var q = $q.defer(); - $window.plugin.notification.local.hasPermission(function (result) { - result ? q.resolve(result) : q.reject(result); + scope = scope || null; + + $window.cordova.plugins.notification.local.hasPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } }, scope); + return q.promise; }, - promptForPermission: function () { + registerPermission: function (scope) { var q = $q.defer(); - $window.plugin.notification.local.promptForPermission(function (result) { - result ? q.resolve(result) : q.reject(result); - }); + scope = scope || null; + + $window.cordova.plugins.notification.local.registerPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } + }, scope); + return q.promise; }, - registerPermission: function () { + promptForPermission: function (scope) { + console.warn('Deprecated: use "registerPermission" instead.'); + var q = $q.defer(); - $window.plugin.notification.local.registerPermission(function (result) { - result ? q.resolve(result) : q.reject(result); - }); + scope = scope || null; + + $window.cordova.plugins.notification.local.registerPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } + }, scope); + return q.promise; }, - getScheduledIds: function (scope) { + getAllIds: function (scope) { var q = $q.defer(); - $window.plugin.notification.local.getScheduledIds(function (result) { + scope = scope || null; + + $window.cordova.plugins.notification.local.getAllIds(function (result) { q.resolve(result); }, scope); + return q.promise; }, - isTriggered: function (id, scope) { + getIds: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getIds(function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + getScheduledIds: function (scope) { var q = $q.defer(); - $window.plugin.notification.local.isTriggered(id, function (result) { + scope = scope || null; + + $window.cordova.plugins.notification.local.getScheduledIds(function (result) { q.resolve(result); }, scope); + return q.promise; }, getTriggeredIds: function (scope) { var q = $q.defer(); - $window.plugin.notification.local.getTriggeredIds(function (result) { + scope = scope || null; + + $window.cordova.plugins.notification.local.getTriggeredIds(function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + get: function (ids, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.get(ids, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + getAll: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getAll(function (result) { q.resolve(result); }, scope); + + return q.promise; + }, + + getScheduled: function (ids, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getScheduled(ids, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + getAllScheduled: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getAllScheduled(function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + getTriggered: function (ids, scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getTriggered(ids, function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + getAllTriggered: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getAllTriggered(function (result) { + q.resolve(result); + }, scope); + return q.promise; }, getDefaults: function () { - return $window.plugin.notification.local.getDefaults(); + return $window.cordova.plugins.notification.local.getDefaults(); }, setDefaults: function (Object) { - $window.plugin.notification.local.setDefaults(Object); + $window.cordova.plugins.notification.local.setDefaults(Object); } }; }]); @@ -4430,7 +4611,7 @@ angular.module('ngCordova.plugins.mMediaAds', []) }; }]); -// install : cordova plugin add org.apache.cordova.media +// install : cordova plugin add cordova-plugin-media // link : https://github.com/apache/cordova-plugin-media angular.module('ngCordova.plugins.media', []) @@ -4877,8 +5058,8 @@ angular.module('ngCordova.plugins.nativeAudio', []) }; }]); -// install : cordova plugin add org.apache.cordova.network-information -// link : https://github.com/apache/cordova-plugin-network-information/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-network-information +// link : https://github.com/apache/cordova-plugin-network-information angular.module('ngCordova.plugins.network', []) @@ -4968,925 +5149,938 @@ angular.module("ngCordova.plugins.oauth", ["ngCordova.plugins.oauthUtility"]) return { - /* - * Sign into the ADFS service (ADFS 3.0 onwards) - * - * @param string clientId (client registered in ADFS, with redirect_uri configured to: http://localhost/callback) - * @param string adfsServer (url of the ADFS Server) - * @param string relyingPartyId (url of the Relying Party (resource relying on ADFS for authentication) configured in ADFS) - * @return promise - */ - adfs: function(clientId, adfsServer, relyingPartyId) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open(adfsServer + '/adfs/oauth2/authorize?response_type=code&client_id=' + clientId +'&redirect_uri=http://localhost/callback&resource=' + relyingPartyId, '_blank', 'location=no'); - - browserRef.addEventListener("loadstart", function(event) { - if((event.url).indexOf('http://localhost/callback') === 0) { - var requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + /* + * Sign into the ADFS service (ADFS 3.0 onwards) + * + * @param string clientId (client registered in ADFS, with redirect_uri configured to: http://localhost/callback) + * @param string adfsServer (url of the ADFS Server) + * @param string relyingPartyId (url of the Relying Party (resource relying on ADFS for authentication) configured in ADFS) + * @return promise + */ + adfs: function (clientId, adfsServer, relyingPartyId) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open(adfsServer + '/adfs/oauth2/authorize?response_type=code&client_id=' + clientId + '&redirect_uri=http://localhost/callback&resource=' + relyingPartyId, '_blank', 'location=no'); + + browserRef.addEventListener("loadstart", function (event) { + if ((event.url).indexOf('http://localhost/callback') === 0) { + var requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({method: "post", url: adfsServer + "/adfs/oauth2/token", data: "client_id=" + clientId + "&code=" + requestToken + "&redirect_uri=http://localhost/callback&grant_type=authorization_code"}) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Dropbox service - * - * @param string appKey - * @return promise - */ - dropbox: function(appKey) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open("https://www.dropbox.com/1/oauth2/authorize?client_id=" + appKey + "&redirect_uri=http://localhost/callback" + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); - browserRef.addEventListener("loadstart", function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token, token_type: parameterMap.token_type, uid: parameterMap.uid }); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); + /* + * Sign into the Dropbox service + * + * @param string appKey + * @return promise + */ + dropbox: function (appKey) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open("https://www.dropbox.com/1/oauth2/authorize?client_id=" + appKey + "&redirect_uri=http://localhost/callback" + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); + browserRef.addEventListener("loadstart", function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, - - /* - * Sign into the Digital Ocean service - * - * @param string clientId - * @param string clientSecret - * @return promise - */ - digitalOcean: function(clientId, clientSecret) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id=" + clientId + "&redirect_uri=http://localhost/callback&response_type=code&scope=read%20write", "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); - browserRef.addEventListener("loadstart", function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token, token_type: parameterMap.token_type, uid: parameterMap.uid}); } else { - deferred.reject("Could not find InAppBrowser plugin"); + deferred.reject("Problem authenticating"); } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Google service - * - * @param string clientId - * @param array appScope - * @return promise - */ - google: function(clientId, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://accounts.google.com/o/oauth2/auth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&approval_prompt=force&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener("loadstart", function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token, token_type: parameterMap.token_type, expires_in: parameterMap.expires_in }); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + /* + * Sign into the Digital Ocean service + * + * @param string clientId + * @param string clientSecret + * @return promise + */ + digitalOcean: function (clientId, clientSecret) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id=" + clientId + "&redirect_uri=http://localhost/callback&response_type=code&scope=read%20write", "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); + browserRef.addEventListener("loadstart", function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({ + method: "post", + url: "https://cloud.digitalocean.com/v1/oauth/token", + data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken + }) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the GitHub service - * - * @param string clientId - * @param string clientSecret - * @param array appScope - * @return promise - */ - github: function(clientId, clientSecret, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://github.com/login/oauth/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(","), '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http.defaults.headers.post.accept = 'application/json'; - $http({method: "post", url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); + /* + * Sign into the Google service + * + * @param string clientId + * @param array appScope + * @return promise + */ + google: function (clientId, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://accounts.google.com/o/oauth2/auth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&approval_prompt=force&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener("loadstart", function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, - - /* - * Sign into the Facebook service - * - * @param string clientId - * @param array appScope - * @return promise - */ - facebook: function(clientId, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://www.facebook.com/dialog/oauth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token&scope=' + appScope.join(","), '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token, expires_in: parameterMap.expires_in }); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token, token_type: parameterMap.token_type, expires_in: parameterMap.expires_in}); } else { - deferred.reject("Could not find InAppBrowser plugin"); + deferred.reject("Problem authenticating"); } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the LinkedIn service - * - * @param string clientId - * @param string clientSecret - * @param array appScope - * @param string state - * @return promise - */ - linkedin: function(clientId, clientSecret, appScope, state) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://www.linkedin.com/uas/oauth2/authorization?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&response_type=code&state=' + state, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: "https://www.linkedin.com/uas/oauth2/accessToken", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + /* + * Sign into the GitHub service + * + * @param string clientId + * @param string clientSecret + * @param array appScope + * @return promise + */ + github: function (clientId, clientSecret, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://github.com/login/oauth/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(","), '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http.defaults.headers.post.accept = 'application/json'; + $http({method: "post", url: "https://github.com/login/oauth/access_token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&code=" + requestToken}) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Instagram service - * - * @param string clientId - * @param array appScope - * @return promise - */ - instagram: function(clientId, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://api.instagram.com/oauth/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token }); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); + /* + * Sign into the Facebook service + * + * @param string clientId + * @param array appScope + * @return promise + */ + facebook: function (clientId, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://www.facebook.com/dialog/oauth?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token&scope=' + appScope.join(","), '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, - - /* - * Sign into the Box service - * - * @param string clientId - * @param string clientSecret - * @param string appState - * @return promise - */ - box: function(clientId, clientSecret, appState) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://app.box.com/api/oauth2/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&state=' + appState + '&response_type=code', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: "https://app.box.com/api/oauth2/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token, expires_in: parameterMap.expires_in}); } else { - deferred.reject("Could not find InAppBrowser plugin"); + deferred.reject("Problem authenticating"); } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Reddit service - * - * @param string clientId - * @param string clientSecret - * @param array appScope - * @return promise - */ - reddit: function(clientId, clientSecret, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://ssl.reddit.com/api/v1/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&duration=permanent&state=ngcordovaoauth&scope=' + appScope.join(",") + '&response_type=code', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http.defaults.headers.post.Authorization = 'Basic ' + btoa(clientId + ":" + clientSecret); - $http({method: "post", url: "https://ssl.reddit.com/api/v1/access_token", data: "redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); + /* + * Sign into the LinkedIn service + * + * @param string clientId + * @param string clientSecret + * @param array appScope + * @param string state + * @return promise + */ + linkedin: function (clientId, clientSecret, appScope, state) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://www.linkedin.com/uas/oauth2/authorization?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&response_type=code&state=' + state, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({ + method: "post", + url: "https://www.linkedin.com/uas/oauth2/accessToken", + data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken + }) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, + + /* + * Sign into the Instagram service + * + * @param string clientId + * @param array appScope + * @return promise + */ + instagram: function (clientId, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://api.instagram.com/oauth/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(" ") + '&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token}); } else { - deferred.reject("Could not find InAppBrowser plugin"); + deferred.reject("Problem authenticating"); } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Twitter service - * Note that this service requires jsSHA for generating HMAC-SHA1 Oauth 1.0 signatures - * - * @param string clientId - * @param string clientSecret - * @return promise - */ - twitter: function(clientId, clientSecret) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - if(typeof jsSHA !== "undefined") { - var oauthObject = { - oauth_consumer_key: clientId, - oauth_nonce: $cordovaOauthUtility.createNonce(10), - oauth_signature_method: "HMAC-SHA1", - oauth_timestamp: Math.round((new Date()).getTime() / 1000.0), - oauth_version: "1.0" - }; - var signatureObj = $cordovaOauthUtility.createSignature("POST", "https://api.twitter.com/oauth/request_token", oauthObject, { oauth_callback: "http://localhost/callback" }, clientSecret); - $http({ - method: "post", - url: "https://api.twitter.com/oauth/request_token", - headers: { - "Authorization": signatureObj.authorization_header, - "Content-Type": "application/x-www-form-urlencoded" - }, - data: "oauth_callback=" + encodeURIComponent("http://localhost/callback") + /* + * Sign into the Box service + * + * @param string clientId + * @param string clientSecret + * @param string appState + * @return promise + */ + box: function (clientId, clientSecret, appState) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://app.box.com/api/oauth2/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&state=' + appState + '&response_type=code', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({ + method: "post", + url: "https://app.box.com/api/oauth2/token", + data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken + }) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, + + /* + * Sign into the Reddit service + * + * @param string clientId + * @param string clientSecret + * @param array appScope + * @return promise + */ + reddit: function (clientId, clientSecret, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://ssl.reddit.com/api/v1/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&duration=permanent&state=ngcordovaoauth&scope=' + appScope.join(",") + '&response_type=code', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http.defaults.headers.post.Authorization = 'Basic ' + btoa(clientId + ":" + clientSecret); + $http({method: "post", url: "https://ssl.reddit.com/api/v1/access_token", data: "redirect_uri=http://localhost/callback" + "&grant_type=authorization_code" + "&code=" + requestToken}) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, + + /* + * Sign into the Twitter service + * Note that this service requires jsSHA for generating HMAC-SHA1 Oauth 1.0 signatures + * + * @param string clientId + * @param string clientSecret + * @return promise + */ + twitter: function (clientId, clientSecret) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + if (typeof jsSHA !== "undefined") { + var oauthObject = { + oauth_consumer_key: clientId, + oauth_nonce: $cordovaOauthUtility.createNonce(10), + oauth_signature_method: "HMAC-SHA1", + oauth_timestamp: Math.round((new Date()).getTime() / 1000.0), + oauth_version: "1.0" + }; + var signatureObj = $cordovaOauthUtility.createSignature("POST", "https://api.twitter.com/oauth/request_token", oauthObject, {oauth_callback: "http://localhost/callback"}, clientSecret); + $http({ + method: "post", + url: "https://api.twitter.com/oauth/request_token", + headers: { + "Authorization": signatureObj.authorization_header, + "Content-Type": "application/x-www-form-urlencoded" + }, + data: "oauth_callback=" + encodeURIComponent("http://localhost/callback") + }) + .success(function (requestTokenResult) { + var requestTokenParameters = (requestTokenResult).split("&"); + var parameterMap = {}; + for (var i = 0; i < requestTokenParameters.length; i++) { + parameterMap[requestTokenParameters[i].split("=")[0]] = requestTokenParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_token") === false) { + deferred.reject("Oauth request token was not received"); + } + var browserRef = window.open('https://api.twitter.com/oauth/authenticate?oauth_token=' + parameterMap.oauth_token, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("?")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = {}; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_verifier") === false) { + deferred.reject("Browser authentication failed to complete. No oauth_verifier was returned"); + } + delete oauthObject.oauth_signature; + oauthObject.oauth_token = parameterMap.oauth_token; + var signatureObj = $cordovaOauthUtility.createSignature("POST", "https://api.twitter.com/oauth/access_token", oauthObject, {oauth_verifier: parameterMap.oauth_verifier}, clientSecret); + $http({ + method: "post", + url: "https://api.twitter.com/oauth/access_token", + headers: { + "Authorization": signatureObj.authorization_header + }, + params: { + "oauth_verifier": parameterMap.oauth_verifier + } + }) + .success(function (result) { + var accessTokenParameters = result.split("&"); + var parameterMap = {}; + for (var i = 0; i < accessTokenParameters.length; i++) { + parameterMap[accessTokenParameters[i].split("=")[0]] = accessTokenParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_token_secret") === false) { + deferred.reject("Oauth access token was not received"); + } + deferred.resolve(parameterMap); }) - .success(function(requestTokenResult) { - var requestTokenParameters = (requestTokenResult).split("&"); - var parameterMap = {}; - for(var i = 0; i < requestTokenParameters.length; i++) { - parameterMap[requestTokenParameters[i].split("=")[0]] = requestTokenParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_token") === false) { - deferred.reject("Oauth request token was not received"); - } - var browserRef = window.open('https://api.twitter.com/oauth/authenticate?oauth_token=' + parameterMap.oauth_token, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("?")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = {}; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_verifier") === false) { - deferred.reject("Browser authentication failed to complete. No oauth_verifier was returned"); - } - delete oauthObject.oauth_signature; - oauthObject.oauth_token = parameterMap.oauth_token; - var signatureObj = $cordovaOauthUtility.createSignature("POST", "https://api.twitter.com/oauth/access_token", oauthObject, { oauth_verifier: parameterMap.oauth_verifier }, clientSecret); - $http({ - method: "post", - url: "https://api.twitter.com/oauth/access_token", - headers: { - "Authorization": signatureObj.authorization_header - }, - params: { - "oauth_verifier": parameterMap.oauth_verifier - } - }) - .success(function(result) { - var accessTokenParameters = result.split("&"); - var parameterMap = {}; - for(var i = 0; i < accessTokenParameters.length; i++) { - parameterMap[accessTokenParameters[i].split("=")[0]] = accessTokenParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_token_secret") === false) { - deferred.reject("Oauth access token was not received"); - } - deferred.resolve(parameterMap); - }) - .error(function(error) { - deferred.reject(error); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - }) - .error(function(error) { - deferred.reject(error); - }); - } else { - deferred.reject("Missing jsSHA JavaScript library"); + .error(function (error) { + deferred.reject(error); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); } - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + }) + .error(function (error) { + deferred.reject(error); + }); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.reject("Missing jsSHA JavaScript library"); } - return deferred.promise; - }, + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Meetup service - * - * @param string clientId - * @return promise - */ - meetup: function(clientId) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://secure.meetup.com/oauth2/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = {}; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve(parameterMap); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); + /* + * Sign into the Meetup service + * + * @param string clientId + * @return promise + */ + meetup: function (clientId) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://secure.meetup.com/oauth2/authorize/?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = {}; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; } - } else { - deferred.reject("Cannot authenticate via a web browser"); - } - return deferred.promise; - }, - - /* - * Sign into the Salesforce service - * - * Suggestion: use salesforce oauth with forcetk.js(as SDK) - * - * @param string loginUrl (such as: https://login.salesforce.com ; please notice community login) - * @param string clientId (copy from connection app info) - * @param string redirectUri (callback url in connection app info) - * @return promise - */ - salesforce: function (loginUrl, clientId) { - var redirectUri = 'http://localhost/callback'; - var getAuthorizeUrl = function (loginUrl, clientId, redirectUri) { - return loginUrl+'services/oauth2/authorize?display=touch'+ - '&response_type=token&client_id='+escape(clientId)+ - '&redirect_uri='+escape(redirectUri); - }; - var startWith = function(string, str) { - return (string.substr(0, str.length) === str); - }; - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open(getAuthorizeUrl(loginUrl, clientId, redirectUri), "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); - browserRef.addEventListener("loadstart", function(event) { - if(startWith(event.url, redirectUri)) { - var oauthResponse = {}; - - var fragment = (event.url).split('#')[1]; - - if (fragment) { - var nvps = fragment.split('&'); - for (var nvp in nvps) { - var parts = nvps[nvp].split('='); - oauthResponse[parts[0]] = unescape(parts[1]); - } - } - - if (typeof oauthResponse === 'undefined' || - typeof oauthResponse.access_token === 'undefined') { - deferred.reject("Problem authenticating"); - } else { - deferred.resolve(oauthResponse); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve(parameterMap); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.reject("Problem authenticating"); } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Strava service - * - * @param string clientId - * @param string clientSecret - * @param array appScope - * @return promise - */ - strava: function(clientId, clientSecret, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://www.strava.com/oauth/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(",") + '&response_type=code&approval_prompt=force', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - requestToken = (event.url).split("code=")[1]; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: "https://www.strava.com/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&code=" + requestToken }) - .success(function(data) { - deferred.resolve(data); - }) - .error(function(data, status) { - deferred.reject("Problem authenticating"); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } - } else { - deferred.reject("Cannot authenticate via a web browser"); + /* + * Sign into the Salesforce service + * + * Suggestion: use salesforce oauth with forcetk.js(as SDK) + * + * @param string loginUrl (such as: https://login.salesforce.com ; please notice community login) + * @param string clientId (copy from connection app info) + * @param string redirectUri (callback url in connection app info) + * @return promise + */ + salesforce: function (loginUrl, clientId) { + var redirectUri = 'http://localhost/callback'; + var getAuthorizeUrl = function (loginUrl, clientId, redirectUri) { + return loginUrl + 'services/oauth2/authorize?display=touch' + + '&response_type=token&client_id=' + escape(clientId) + + '&redirect_uri=' + escape(redirectUri); + }; + var startWith = function (string, str) { + return (string.substr(0, str.length) === str); + }; + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open(getAuthorizeUrl(loginUrl, clientId, redirectUri), "_blank", "location=no,clearsessioncache=yes,clearcache=yes"); + browserRef.addEventListener("loadstart", function (event) { + if (startWith(event.url, redirectUri)) { + var oauthResponse = {}; + + var fragment = (event.url).split('#')[1]; + + if (fragment) { + var nvps = fragment.split('&'); + for (var nvp in nvps) { + var parts = nvps[nvp].split('='); + oauthResponse[parts[0]] = unescape(parts[1]); + } } - return deferred.promise; - }, - /* - * Sign into the Foursquare service - * - * @param string clientId - * @return promise - */ - foursquare: function(clientId) { - var deferred = $q.defer(); - if (window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://foursquare.com/oauth2/authenticate?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function (event) { - if ((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for (var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - var promiseResponse = { - access_token: parameterMap.access_token, - expires_in: parameterMap.expires_in - }; - deferred.resolve(promiseResponse); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } + if (typeof oauthResponse === 'undefined' || + typeof oauthResponse.access_token === 'undefined') { + deferred.reject("Problem authenticating"); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.resolve(oauthResponse); } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Magento service - * Note that this service requires jsSHA for generating HMAC-SHA1 Oauth 1.0 signatures - * - * @param string baseUrl - * @param string clientId - * @param string clientSecret - * @return promise - */ - magento: function(baseUrl, clientId, clientSecret) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - if(typeof jsSHA !== "undefined") { - var oauthObject = { - oauth_callback: "http://localhost/callback", - oauth_consumer_key: clientId, - oauth_nonce: $cordovaOauthUtility.createNonce(5), - oauth_signature_method: "HMAC-SHA1", - oauth_timestamp: Math.round((new Date()).getTime() / 1000.0), - oauth_version: "1.0" - }; - var signatureObj = $cordovaOauthUtility.createSignature("POST", baseUrl + "/oauth/initiate", oauthObject, { oauth_callback: "http://localhost/callback" }, clientSecret); - $http.defaults.headers.post.Authorization = signatureObj.authorization_header; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: baseUrl + "/oauth/initiate", data: "oauth_callback=http://localhost/callback" }) - .success(function(requestTokenResult) { - var requestTokenParameters = (requestTokenResult).split("&"); - var parameterMap = {}; - for(var i = 0; i < requestTokenParameters.length; i++) { - parameterMap[requestTokenParameters[i].split("=")[0]] = requestTokenParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_token") === false) { - deferred.reject("Oauth request token was not received"); - } - var tokenSecret = parameterMap.oauth_token_secret; - var browserRef = window.open(baseUrl + '/oauth/authorize?oauth_token=' + parameterMap.oauth_token, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - var callbackResponse = (event.url).split("?")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = {}; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_verifier") === false) { - deferred.reject("Browser authentication failed to complete. No oauth_verifier was returned"); - } - delete oauthObject.oauth_signature; - delete oauthObject.oauth_callback; - oauthObject.oauth_token = parameterMap.oauth_token; - oauthObject.oauth_nonce = $cordovaOauthUtility.createNonce(5); - oauthObject.oauth_verifier = parameterMap.oauth_verifier; - var signatureObj = $cordovaOauthUtility.createSignature("POST", baseUrl + "/oauth/token", oauthObject, {}, clientSecret, tokenSecret); - $http.defaults.headers.post.Authorization = signatureObj.authorization_header; - $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $http({method: "post", url: baseUrl + "/oauth/token" }) - .success(function(result) { - var accessTokenParameters = result.split("&"); - var parameterMap = {}; - for(var i = 0; i < accessTokenParameters.length; i++) { - parameterMap[accessTokenParameters[i].split("=")[0]] = accessTokenParameters[i].split("=")[1]; - } - if(parameterMap.hasOwnProperty("oauth_token_secret") === false) { - deferred.reject("Oauth access token was not received"); - } - deferred.resolve(parameterMap); - }) - .error(function(error) { - deferred.reject(error); - }) - .finally(function() { - setTimeout(function() { - browserRef.close(); - }, 10); - }); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - }) - .error(function(error) { - deferred.reject(error); - }); - } else { - deferred.reject("Missing jsSHA JavaScript library"); - } - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } + /* + * Sign into the Strava service + * + * @param string clientId + * @param string clientSecret + * @param array appScope + * @return promise + */ + strava: function (clientId, clientSecret, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://www.strava.com/oauth/authorize?client_id=' + clientId + '&redirect_uri=http://localhost/callback&scope=' + appScope.join(",") + '&response_type=code&approval_prompt=force', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + requestToken = (event.url).split("code=")[1]; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({method: "post", url: "https://www.strava.com/oauth/token", data: "client_id=" + clientId + "&client_secret=" + clientSecret + "&code=" + requestToken}) + .success(function (data) { + deferred.resolve(data); + }) + .error(function (data, status) { + deferred.reject("Problem authenticating"); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); + }); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, + + /* + * Sign into the Foursquare service + * + * @param string clientId + * @return promise + */ + foursquare: function (clientId) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://foursquare.com/oauth2/authenticate?client_id=' + clientId + '&redirect_uri=http://localhost/callback&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + var promiseResponse = { + access_token: parameterMap.access_token, + expires_in: parameterMap.expires_in + }; + deferred.resolve(promiseResponse); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.reject("Problem authenticating"); } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Vkontakte service - * - * @param string clientId - * @param array appScope (for example: "friends,wall,photos,messages") - * @return promise - */ - vkontakte: function(clientId, appScope) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://oauth.vk.com/authorize?client_id=' + clientId + '&redirect_uri=http://oauth.vk.com/blank.html&response_type=token&scope=' + appScope.join(",") + '&display=touch&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - var tmp = (event.url).split("#"); - if (tmp[0] == 'https://oauth.vk.com/blank.html' || tmp[0] == 'http://oauth.vk.com/blank.html') { - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token, expires_in: parameterMap.expires_in, user_id: parameterMap.user_id }); - } else { - deferred.reject("Problem authenticating"); - } - setTimeout(function() { - browserRef.close(); - }, 10); - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); + /* + * Sign into the Magento service + * Note that this service requires jsSHA for generating HMAC-SHA1 Oauth 1.0 signatures + * + * @param string baseUrl + * @param string clientId + * @param string clientSecret + * @return promise + */ + magento: function (baseUrl, clientId, clientSecret) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + if (typeof jsSHA !== "undefined") { + var oauthObject = { + oauth_callback: "http://localhost/callback", + oauth_consumer_key: clientId, + oauth_nonce: $cordovaOauthUtility.createNonce(5), + oauth_signature_method: "HMAC-SHA1", + oauth_timestamp: Math.round((new Date()).getTime() / 1000.0), + oauth_version: "1.0" + }; + var signatureObj = $cordovaOauthUtility.createSignature("POST", baseUrl + "/oauth/initiate", oauthObject, {oauth_callback: "http://localhost/callback"}, clientSecret); + $http.defaults.headers.post.Authorization = signatureObj.authorization_header; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({method: "post", url: baseUrl + "/oauth/initiate", data: "oauth_callback=http://localhost/callback"}) + .success(function (requestTokenResult) { + var requestTokenParameters = (requestTokenResult).split("&"); + var parameterMap = {}; + for (var i = 0; i < requestTokenParameters.length; i++) { + parameterMap[requestTokenParameters[i].split("=")[0]] = requestTokenParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_token") === false) { + deferred.reject("Oauth request token was not received"); + } + var tokenSecret = parameterMap.oauth_token_secret; + var browserRef = window.open(baseUrl + '/oauth/authorize?oauth_token=' + parameterMap.oauth_token, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + var callbackResponse = (event.url).split("?")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = {}; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_verifier") === false) { + deferred.reject("Browser authentication failed to complete. No oauth_verifier was returned"); + } + delete oauthObject.oauth_signature; + delete oauthObject.oauth_callback; + oauthObject.oauth_token = parameterMap.oauth_token; + oauthObject.oauth_nonce = $cordovaOauthUtility.createNonce(5); + oauthObject.oauth_verifier = parameterMap.oauth_verifier; + var signatureObj = $cordovaOauthUtility.createSignature("POST", baseUrl + "/oauth/token", oauthObject, {}, clientSecret, tokenSecret); + $http.defaults.headers.post.Authorization = signatureObj.authorization_header; + $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; + $http({method: "post", url: baseUrl + "/oauth/token"}) + .success(function (result) { + var accessTokenParameters = result.split("&"); + var parameterMap = {}; + for (var i = 0; i < accessTokenParameters.length; i++) { + parameterMap[accessTokenParameters[i].split("=")[0]] = accessTokenParameters[i].split("=")[1]; + } + if (parameterMap.hasOwnProperty("oauth_token_secret") === false) { + deferred.reject("Oauth access token was not received"); + } + deferred.resolve(parameterMap); + }) + .error(function (error) { + deferred.reject(error); + }) + .finally(function () { + setTimeout(function () { + browserRef.close(); + }, 10); }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + }) + .error(function (error) { + deferred.reject(error); + }); + } else { + deferred.reject("Missing jsSHA JavaScript library"); + } + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, + + /* + * Sign into the Vkontakte service + * + * @param string clientId + * @param array appScope (for example: "friends,wall,photos,messages") + * @return promise + */ + vkontakte: function (clientId, appScope) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://oauth.vk.com/authorize?client_id=' + clientId + '&redirect_uri=http://oauth.vk.com/blank.html&response_type=token&scope=' + appScope.join(",") + '&display=touch&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + var tmp = (event.url).split("#"); + if (tmp[0] == 'https://oauth.vk.com/blank.html' || tmp[0] == 'http://oauth.vk.com/blank.html') { + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token, expires_in: parameterMap.expires_in, user_id: parameterMap.user_id}); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.reject("Problem authenticating"); } - return deferred.promise; - }, + setTimeout(function () { + browserRef.close(); + }, 10); + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + }, - /* - * Sign into the Imgur service - * - * @param string clientId - * @return promise - */ - imgur: function(clientId) { - var deferred = $q.defer(); - if(window.cordova) { - var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; - if(cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { - var browserRef = window.open('https://api.imgur.com/oauth2/authorize?client_id=' + clientId + '&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); - browserRef.addEventListener('loadstart', function(event) { - if((event.url).indexOf("http://localhost/callback") === 0) { - browserRef.removeEventListener("exit",function(event){}); - browserRef.close(); - var callbackResponse = (event.url).split("#")[1]; - var responseParameters = (callbackResponse).split("&"); - var parameterMap = []; - for(var i = 0; i < responseParameters.length; i++) { - parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; - } - if(parameterMap.access_token !== undefined && parameterMap.access_token !== null) { - deferred.resolve({ access_token: parameterMap.access_token, expires_in: parameterMap.expires_in, account_username: parameterMap.account_username }); - } else { - deferred.reject("Problem authenticating"); - } - } - }); - browserRef.addEventListener('exit', function(event) { - deferred.reject("The sign in flow was canceled"); - }); - } else { - deferred.reject("Could not find InAppBrowser plugin"); - } + /* + * Sign into the Imgur service + * + * @param string clientId + * @return promise + */ + imgur: function (clientId) { + var deferred = $q.defer(); + if (window.cordova) { + var cordovaMetadata = cordova.require("cordova/plugin_list").metadata; + if (cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true) { + var browserRef = window.open('https://api.imgur.com/oauth2/authorize?client_id=' + clientId + '&response_type=token', '_blank', 'location=no,clearsessioncache=yes,clearcache=yes'); + browserRef.addEventListener('loadstart', function (event) { + if ((event.url).indexOf("http://localhost/callback") === 0) { + browserRef.removeEventListener("exit", function (event) { + }); + browserRef.close(); + var callbackResponse = (event.url).split("#")[1]; + var responseParameters = (callbackResponse).split("&"); + var parameterMap = []; + for (var i = 0; i < responseParameters.length; i++) { + parameterMap[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1]; + } + if (parameterMap.access_token !== undefined && parameterMap.access_token !== null) { + deferred.resolve({access_token: parameterMap.access_token, expires_in: parameterMap.expires_in, account_username: parameterMap.account_username}); } else { - deferred.reject("Cannot authenticate via a web browser"); + deferred.reject("Problem authenticating"); } - return deferred.promise; - } + } + }); + browserRef.addEventListener('exit', function (event) { + deferred.reject("The sign in flow was canceled"); + }); + } else { + deferred.reject("Could not find InAppBrowser plugin"); + } + } else { + deferred.reject("Cannot authenticate via a web browser"); + } + return deferred.promise; + } }; }]); @@ -5907,59 +6101,59 @@ angular.module("ngCordova.plugins.oauthUtility", []) * @param string secretKey * @return object */ - createSignature: function(method, endPoint, headerParameters, bodyParameters, secretKey, tokenSecret) { - if(typeof jsSHA !== "undefined") { - var headerAndBodyParameters = angular.copy(headerParameters); - var bodyParameterKeys = Object.keys(bodyParameters); - for(var i = 0; i < bodyParameterKeys.length; i++) { - headerAndBodyParameters[bodyParameterKeys[i]] = encodeURIComponent(bodyParameters[bodyParameterKeys[i]]); - } - var signatureBaseString = method + "&" + encodeURIComponent(endPoint) + "&"; - var headerAndBodyParameterKeys = (Object.keys(headerAndBodyParameters)).sort(); - for(i = 0; i < headerAndBodyParameterKeys.length; i++) { - if(i == headerAndBodyParameterKeys.length - 1) { - signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + "=" + headerAndBodyParameters[headerAndBodyParameterKeys[i]]); - } else { - signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + "=" + headerAndBodyParameters[headerAndBodyParameterKeys[i]] + "&"); - } - } - var oauthSignatureObject = new jsSHA(signatureBaseString, "TEXT"); - - var encodedTokenSecret = ''; - if (tokenSecret) { - encodedTokenSecret = encodeURIComponent(tokenSecret); - } - - headerParameters.oauth_signature = encodeURIComponent(oauthSignatureObject.getHMAC(encodeURIComponent(secretKey) + "&" + encodedTokenSecret, "TEXT", "SHA-1", "B64")); - var headerParameterKeys = Object.keys(headerParameters); - var authorizationHeader = 'OAuth '; - for(i = 0; i < headerParameterKeys.length; i++) { - if(i == headerParameterKeys.length - 1) { - authorizationHeader += headerParameterKeys[i] + '="' + headerParameters[headerParameterKeys[i]] + '"'; - } else { - authorizationHeader += headerParameterKeys[i] + '="' + headerParameters[headerParameterKeys[i]] + '",'; - } - } - return { signature_base_string: signatureBaseString, authorization_header: authorizationHeader, signature: headerParameters.oauth_signature }; - } else { - return "Missing jsSHA JavaScript library"; - } - }, + createSignature: function (method, endPoint, headerParameters, bodyParameters, secretKey, tokenSecret) { + if (typeof jsSHA !== "undefined") { + var headerAndBodyParameters = angular.copy(headerParameters); + var bodyParameterKeys = Object.keys(bodyParameters); + for (var i = 0; i < bodyParameterKeys.length; i++) { + headerAndBodyParameters[bodyParameterKeys[i]] = encodeURIComponent(bodyParameters[bodyParameterKeys[i]]); + } + var signatureBaseString = method + "&" + encodeURIComponent(endPoint) + "&"; + var headerAndBodyParameterKeys = (Object.keys(headerAndBodyParameters)).sort(); + for (i = 0; i < headerAndBodyParameterKeys.length; i++) { + if (i == headerAndBodyParameterKeys.length - 1) { + signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + "=" + headerAndBodyParameters[headerAndBodyParameterKeys[i]]); + } else { + signatureBaseString += encodeURIComponent(headerAndBodyParameterKeys[i] + "=" + headerAndBodyParameters[headerAndBodyParameterKeys[i]] + "&"); + } + } + var oauthSignatureObject = new jsSHA(signatureBaseString, "TEXT"); + + var encodedTokenSecret = ''; + if (tokenSecret) { + encodedTokenSecret = encodeURIComponent(tokenSecret); + } + + headerParameters.oauth_signature = encodeURIComponent(oauthSignatureObject.getHMAC(encodeURIComponent(secretKey) + "&" + encodedTokenSecret, "TEXT", "SHA-1", "B64")); + var headerParameterKeys = Object.keys(headerParameters); + var authorizationHeader = 'OAuth '; + for (i = 0; i < headerParameterKeys.length; i++) { + if (i == headerParameterKeys.length - 1) { + authorizationHeader += headerParameterKeys[i] + '="' + headerParameters[headerParameterKeys[i]] + '"'; + } else { + authorizationHeader += headerParameterKeys[i] + '="' + headerParameters[headerParameterKeys[i]] + '",'; + } + } + return {signature_base_string: signatureBaseString, authorization_header: authorizationHeader, signature: headerParameters.oauth_signature}; + } else { + return "Missing jsSHA JavaScript library"; + } + }, - /* - * Create Random String Nonce - * - * @param integer length - * @return string - */ - createNonce: function(length) { + /* + * Create Random String Nonce + * + * @param integer length + * @return string + */ + createNonce: function (length) { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for(var i = 0; i < length; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); + for (var i = 0; i < length; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); } return text; - } + } }; @@ -6020,7 +6214,7 @@ angular.module('ngCordova.plugins.prefs', []) }; }]); -// install : cordova plugin add de.appplant.cordova.plugin.printer +// install : cordova plugin add https://github.com/katzer/cordova-plugin-printer.git // link : https://github.com/katzer/cordova-plugin-printer angular.module('ngCordova.plugins.printer', []) @@ -6048,7 +6242,7 @@ angular.module('ngCordova.plugins.printer', []) }; }]); -// install : cordova plugin add org.pbernasconi.progressindicator +// install : cordova plugin add https://github.com/pbernasconi/cordova-progressIndicator.git // link : http://pbernasconi.github.io/cordova-progressIndicator/ angular.module('ngCordova.plugins.progressIndicator', []) @@ -6056,7 +6250,7 @@ angular.module('ngCordova.plugins.progressIndicator', []) .factory('$cordovaProgress', ['$q', function ($q) { return { - show: function(_message) { + show: function (_message) { var message = _message || "Please wait..."; return ProgressIndicator.show(message); }, @@ -6156,7 +6350,7 @@ angular.module('ngCordova.plugins.push', []) var q = $q.defer(); var injector; if (config !== undefined && config.ecb === undefined) { - if (document.querySelector('[ng-app]') == null) { + if (document.querySelector('[ng-app]') === null) { injector = "document.body"; } else { @@ -6383,8 +6577,8 @@ angular.module('ngCordova.plugins.spinnerDialog', []) }]); -// install : cordova plugin add org.apache.cordova.splashscreen -// link : https://github.com/apache/cordova-plugin-splashscreen/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-splashscreen +// link : https://github.com/apache/cordova-plugin-splashscreen angular.module('ngCordova.plugins.splashscreen', []) @@ -6402,8 +6596,8 @@ angular.module('ngCordova.plugins.splashscreen', []) }]); -// install : cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git -// link : https://github.com/brodysoft/Cordova-SQLitePlugin/blob/master/README.md +// install : cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git +// link : https://github.com/litehelpers/Cordova-sqlite-storage angular.module('ngCordova.plugins.sqlite', []) @@ -6493,8 +6687,8 @@ angular.module('ngCordova.plugins.sqlite', []) }; }]); -// install : cordova plugin add org.apache.cordova.statusbar -// link : https://github.com/apache/cordova-plugin-statusbar/ +// install : cordova plugin add cordova-plugin-statusbar +// link : https://github.com/apache/cordova-plugin-statusbar angular.module('ngCordova.plugins.statusbar', []) @@ -6505,6 +6699,13 @@ angular.module('ngCordova.plugins.statusbar', []) return StatusBar.overlaysWebView(!!bool); }, + STYLES: { + DEFAULT: 0, + LIGHT_CONTENT: 1, + BLACK_TRANSLUCENT: 2, + BLACK_OPAQUE: 3 + }, + style: function (style) { switch (style) { // Default @@ -6675,8 +6876,8 @@ angular.module('ngCordova.plugins.touchid', []) }; }]); -// install : cordova plugin add org.apache.cordova.vibration -// link : https://github.com/apache/cordova-plugin-vibration/blob/master/doc/index.md +// install : cordova plugin add cordova-plugin-vibration +// link : https://github.com/apache/cordova-plugin-vibration angular.module('ngCordova.plugins.vibration', []) diff --git a/www/lib/ngCordova/dist/ng-cordova.min.js b/www/lib/ngCordova/dist/ng-cordova.min.js index 9c372655..25fca1f5 100644 --- a/www/lib/ngCordova/dist/ng-cordova.min.js +++ b/www/lib/ngCordova/dist/ng-cordova.min.js @@ -1,9 +1,10 @@ /*! * ngCordova - * v0.1.15-alpha + * v0.1.17-alpha * Copyright 2014 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */ -!function(){angular.module("ngCordova",["ngCordova.plugins"]),angular.module("ngCordova.plugins.actionSheet",[]).factory("$cordovaActionSheet",["$q","$window",function(e,n){return{show:function(t){var r=e.defer();return n.plugins.actionsheet.show(t,function(e){r.resolve(e)}),r.promise},hide:function(){return n.plugins.actionsheet.hide()}}}]),angular.module("ngCordova.plugins.adMob",[]).factory("$cordovaAdMob",["$q","$window",function(e,n){return{createBannerView:function(t){var r=e.defer();return n.plugins.AdMob.createBannerView(t,function(){r.resolve()},function(){r.reject()}),r.promise},createInterstitialView:function(t){var r=e.defer();return n.plugins.AdMob.createInterstitialView(t,function(){r.resolve()},function(){r.reject()}),r.promise},requestAd:function(t){var r=e.defer();return n.plugins.AdMob.requestAd(t,function(){r.resolve()},function(){r.reject()}),r.promise},showAd:function(t){var r=e.defer();return n.plugins.AdMob.showAd(t,function(){r.resolve()},function(){r.reject()}),r.promise},requestInterstitialAd:function(t){var r=e.defer();return n.plugins.AdMob.requestInterstitialAd(t,function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.appAvailability",[]).factory("$cordovaAppAvailability",["$q",function(e){return{check:function(n){var t=e.defer();return appAvailability.check(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.appRate",[]).provider("$cordovaAppRate",[function(){this.setPreferences=function(e){e&&angular.isObject(e)&&(AppRate.preferences.useLanguage=e.language||null,AppRate.preferences.displayAppName=e.appName||"",AppRate.preferences.promptAgainForEachNewVersion=e.promptForNewVersion||!0,AppRate.preferences.openStoreInApp=e.openStoreInApp||!1,AppRate.preferences.usesUntilPrompt=e.usesUntilPrompt||3,AppRate.preferences.useCustomRateDialog=e.useCustomRateDialog||!1,AppRate.preferences.storeAppURL.ios=e.iosURL||null,AppRate.preferences.storeAppURL.android=e.androidURL||null,AppRate.preferences.storeAppURL.blackberry=e.blackberryURL||null,AppRate.preferences.storeAppURL.windows8=e.windowsURL||null)},this.setCustomLocale=function(e){var n={title:"Rate %@",message:"If you enjoy using %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!",cancelButtonLabel:"No, Thanks",laterButtonLabel:"Remind Me Later",rateButtonLabel:"Rate It Now"};n=angular.extend(n,e),AppRate.preferences.customLocale=n},this.$get=["$q",function(e){return{promptForRating:function(n){var t=e.defer(),r=AppRate.promptForRating(n);return t.resolve(r),t.promise},navigateToAppStore:function(){var n=e.defer(),t=AppRate.navigateToAppStore();return n.resolve(t),n.promise},onButtonClicked:function(e){AppRate.onButtonClicked=function(n){e.call(this,n)}},onRateDialogShow:function(e){AppRate.onRateDialogShow=e()}}}]}]),angular.module("ngCordova.plugins.appVersion",[]).factory("$cordovaAppVersion",["$q",function(e){return{getAppVersion:function(){var n=e.defer();return cordova.getAppVersion(function(e){n.resolve(e)}),n.promise}}}]),angular.module("ngCordova.plugins.backgroundGeolocation",[]).factory("$cordovaBackgroundGeolocation",["$q","$window",function(e,n){return{init:function(){n.navigator.geolocation.getCurrentPosition(function(e){return e})},configure:function(t){this.init();var r=e.defer();return n.plugins.backgroundGeoLocation.configure(function(e){r.notify(e),n.plugins.backgroundGeoLocation.finish()},function(e){r.reject(e)},t),this.start(),r.promise},start:function(){var t=e.defer();return n.plugins.backgroundGeoLocation.start(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},stop:function(){var t=e.defer();return n.plugins.backgroundGeoLocation.stop(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.badge",[]).factory("$cordovaBadge",["$q",function(e){return{hasPermission:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?n.resolve(!0):n.reject("You do not have permission")}),n.promise},promptForPermission:function(){return cordova.plugins.notification.badge.promptForPermission()},set:function(n){var t=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?t.resolve(cordova.plugins.notification.badge.set(n)):t.reject("You do not have permission to set Badge")}),t.promise},get:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?cordova.plugins.notification.badge.get(function(e){n.resolve(e)}):n.reject("You do not have permission to get Badge")}),n.promise},clear:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?n.resolve(cordova.plugins.notification.badge.clear()):n.reject("You do not have permission to clear Badge")}),n.promise},configure:function(e){return cordova.plugins.notification.badge.configure(e)}}}]),angular.module("ngCordova.plugins.barcodeScanner",[]).factory("$cordovaBarcodeScanner",["$q",function(e){return{scan:function(n){var t=e.defer();return cordova.plugins.barcodeScanner.scan(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},encode:function(n,t){var r=e.defer();return n=n||"TEXT_TYPE",cordova.plugins.barcodeScanner.encode(n,t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.batteryStatus",[]).factory("$cordovaBatteryStatus",["$rootScope","$window","$timeout",function(e,n,t){var r=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:status",n)})},o=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:critical",n)})},i=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:low",n)})};return document.addEventListener("deviceready",function(){navigator.battery&&(n.addEventListener("batterystatus",r,!1),n.addEventListener("batterycritical",o,!1),n.addEventListener("batterylow",i,!1))},!1),!0}]).run(["$cordovaBatteryStatus",function(){}]),angular.module("ngCordova.plugins.ble",[]).factory("$cordovaBLE",["$q",function(e){return{scan:function(n,t){var r=e.defer();return ble.scan(n,t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},connect:function(n){var t=e.defer();return ble.connect(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},disconnect:function(n){var t=e.defer();return ble.disconnect(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},read:function(n,t,r){var o=e.defer();return ble.read(n,t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},write:function(n,t,r,o){var i=e.defer();return ble.write(n,t,r,o,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},writeCommand:function(n,t,r,o){var i=e.defer();return ble.writeCommand(n,t,r,o,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},notify:function(n,t,r){var o=e.defer();return ble.notify(n,t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},indicate:function(n,t,r){var o=e.defer();return ble.indicate(n,t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},isConnected:function(n){var t=e.defer();return ble.isConnected(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},isEnabled:function(){var n=e.defer();return ble.isEnabled(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.bluetoothSerial",[]).factory("$cordovaBluetoothSerial",["$q","$window",function(e,n){return{connect:function(t){var r=e.defer();return n.bluetoothSerial.connect(t,function(){r.resolve()},function(e){r.reject(e)}),r.promise},connectInsecure:function(t){var r=e.defer();return n.bluetoothSerial.connectInsecure(t,function(){r.resolve()},function(e){r.reject(e)}),r.promise},disconnect:function(){var t=e.defer();return n.bluetoothSerial.disconnect(function(){t.resolve()},function(e){t.reject(e)}),t.promise},list:function(){var t=e.defer();return n.bluetoothSerial.list(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},discoverUnpaired:function(){var t=e.defer();return n.bluetoothSerial.discoverUnpaired(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},setDeviceDiscoveredListener:function(){var t=e.defer();return n.bluetoothSerial.setDeviceDiscoveredListener(function(e){t.notify(e)}),t.promise},clearDeviceDiscoveredListener:function(){n.bluetoothSerial.clearDeviceDiscoveredListener()},showBluetoothSettings:function(){var t=e.defer();return n.bluetoothSerial.showBluetoothSettings(function(){t.resolve()},function(e){t.reject(e)}),t.promise},isEnabled:function(){var t=e.defer();return n.bluetoothSerial.isEnabled(function(){t.resolve()},function(){t.reject()}),t.promise},enable:function(){var t=e.defer();return n.bluetoothSerial.enable(function(){t.resolve()},function(){t.reject()}),t.promise},isConnected:function(){var t=e.defer();return n.bluetoothSerial.isConnected(function(){t.resolve()},function(){t.reject()}),t.promise},available:function(){var t=e.defer();return n.bluetoothSerial.available(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},read:function(){var t=e.defer();return n.bluetoothSerial.read(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},readUntil:function(t){var r=e.defer();return n.bluetoothSerial.readUntil(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},write:function(t){var r=e.defer();return n.bluetoothSerial.write(t,function(){r.resolve()},function(e){r.reject(e)}),r.promise},subscribe:function(t){var r=e.defer();return n.bluetoothSerial.subscribe(t,function(e){r.notify(e)},function(e){r.reject(e)}),r.promise},subscribeRawData:function(){var t=e.defer();return n.bluetoothSerial.subscribeRawData(function(e){t.notify(e)},function(e){t.reject(e)}),t.promise},unsubscribe:function(){var t=e.defer();return n.bluetoothSerial.unsubscribe(function(){t.resolve()},function(e){t.reject(e)}),t.promise},unsubscribeRawData:function(){var t=e.defer();return n.bluetoothSerial.unsubscribeRawData(function(){t.resolve()},function(e){t.reject(e)}),t.promise},clear:function(){var t=e.defer();return n.bluetoothSerial.clear(function(){t.resolve()},function(e){t.reject(e)}),t.promise},readRSSI:function(){var t=e.defer();return n.bluetoothSerial.readRSSI(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.brightness",[]).factory("$cordovaBrightness",["$q","$window",function(e,n){return{get:function(){var t=e.defer();return n.cordova.plugins.brightness.getBrightness(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},set:function(t){var r=e.defer();return n.cordova.plugins.brightness.setBrightness(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},setKeepScreenOn:function(t){var r=e.defer();return n.cordova.plugins.brightness.setKeepScreenOn(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.calendar",[]).factory("$cordovaCalendar",["$q","$window",function(e,n){return{createCalendar:function(t){var r=e.defer(),o=n.plugins.calendar.getCreateCalendarOptions();return"string"==typeof t?o.calendarName=t:o=angular.extend(o,t),n.plugins.calendar.createCalendar(o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},deleteCalendar:function(t){var r=e.defer();return n.plugins.calendar.deleteCalendar(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},createEvent:function(t){var r=e.defer(),o={title:null,location:null,notes:null,startDate:null,endDate:null};return o=angular.extend(o,t),n.plugins.calendar.createEvent(o.title,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},createEventWithOptions:function(t){var r=e.defer(),o=[],i=window.plugins.calendar.getCalendarOptions(),a={title:null,location:null,notes:null,startDate:null,endDate:null};o=Object.keys(a);for(var c in t)-1===o.indexOf(c)?i[c]=t[c]:a[c]=t[c];return n.plugins.calendar.createEventWithOptions(a.title,a.location,a.notes,new Date(a.startDate),new Date(a.endDate),i,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},createEventInteractively:function(t){var r=e.defer(),o={title:null,location:null,notes:null,startDate:null,endDate:null};return o=angular.extend(o,t),n.plugins.calendar.createEventInteractively(o.title,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},createEventInNamedCalendar:function(t){var r=e.defer(),o={title:null,location:null,notes:null,startDate:null,endDate:null,calendarName:null};return o=angular.extend(o,t),n.plugins.calendar.createEventInNamedCalendar(o.title,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),o.calendarName,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},findEvent:function(t){var r=e.defer(),o={title:null,location:null,notes:null,startDate:null,endDate:null};return o=angular.extend(o,t),n.plugins.calendar.findEvent(o.title,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},listEventsInRange:function(t,r){var o=e.defer();return n.plugins.calendar.listEventsInRange(t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},listCalendars:function(){var t=e.defer();return n.plugins.calendar.listCalendars(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},findAllEventsInNamedCalendar:function(t){var r=e.defer();return n.plugins.calendar.findAllEventsInNamedCalendar(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},modifyEvent:function(t){var r=e.defer(),o={title:null,location:null,notes:null,startDate:null,endDate:null,newTitle:null,newLocation:null,newNotes:null,newStartDate:null,newEndDate:null};return o=angular.extend(o,t),n.plugins.calendar.modifyEvent(o.title,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),o.newTitle,o.newLocation,o.newNotes,new Date(o.newStartDate),new Date(o.newEndDate),function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},deleteEvent:function(t){var r=e.defer(),o={newTitle:null,location:null,notes:null,startDate:null,endDate:null};return o=angular.extend(o,t),n.plugins.calendar.deleteEvent(o.newTitle,o.location,o.notes,new Date(o.startDate),new Date(o.endDate),function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.camera",[]).factory("$cordovaCamera",["$q",function(e){return{getPicture:function(n){var t=e.defer();return navigator.camera?(navigator.camera.getPicture(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},cleanup:function(){var n=e.defer();return navigator.camera.cleanup(function(){n.resolve()},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.capture",[]).factory("$cordovaCapture",["$q",function(e){return{captureAudio:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureAudio(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},captureImage:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureImage(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},captureVideo:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureVideo(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)}}}]),angular.module("ngCordova.plugins.clipboard",[]).factory("$cordovaClipboard",["$q","$window",function(e,n){return{copy:function(t){var r=e.defer();return n.cordova.plugins.clipboard.copy(t,function(){r.resolve()},function(){r.reject()}),r.promise},paste:function(){var t=e.defer();return n.cordova.plugins.clipboard.paste(function(e){t.resolve(e)},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.contacts",[]).factory("$cordovaContacts",["$q",function(e){return{save:function(n){var t=e.defer(),r=navigator.contacts.create(n);return r.save(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},remove:function(n){var t=e.defer(),r=navigator.contacts.create(n);return r.remove(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},clone:function(e){var n=navigator.contacts.create(e);return n.clone(e)},find:function(n){var t=e.defer(),r=n.fields||["id","displayName"];return delete n.fields,navigator.contacts.find(r,function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},pickContact:function(){var n=e.defer();return navigator.contacts.pickContact(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.datePicker",[]).factory("$cordovaDatePicker",["$window","$q",function(e,n){return{show:function(t){var r=n.defer();return t=t||{date:new Date,mode:"date"},e.datePicker.show(t,function(e){r.resolve(e)}),r.promise}}}]),angular.module("ngCordova.plugins.device",[]).factory("$cordovaDevice",[function(){return{getDevice:function(){return device},getCordova:function(){return device.cordova},getModel:function(){return device.model},getName:function(){return device.name},getPlatform:function(){return device.platform},getUUID:function(){return device.uuid},getVersion:function(){return device.version}}}]),angular.module("ngCordova.plugins.deviceMotion",[]).factory("$cordovaDeviceMotion",["$q",function(e){return{getCurrentAcceleration:function(){var n=e.defer();return navigator.accelerometer.getCurrentAcceleration(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},watchAcceleration:function(n){var t=e.defer(),r=navigator.accelerometer.watchAcceleration(function(e){t.notify(e)},function(e){t.reject(e)},n);return t.promise.cancel=function(){navigator.accelerometer.clearWatch(r)},t.promise.clearWatch=function(e){navigator.accelerometer.clearWatch(e||r)},t.promise.watchID=r,t.promise},clearWatch:function(e){return navigator.accelerometer.clearWatch(e)}}}]),angular.module("ngCordova.plugins.deviceOrientation",[]).factory("$cordovaDeviceOrientation",["$q",function(e){return{getCurrentHeading:function(){var n=e.defer();return navigator.compass.getCurrentHeading(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},watchHeading:function(n){var t=e.defer(),r=navigator.compass.watchHeading(function(e){t.notify(e)},function(e){t.reject(e)},n);return t.promise.cancel=function(){navigator.compass.clearWatch(r)},t.promise.clearWatch=function(e){navigator.compass.clearWatch(e||r)},t.promise.watchID=r,t.promise},clearWatch:function(e){return navigator.compass.clearWatch(e)}}}]),angular.module("ngCordova.plugins.dialogs",[]).factory("$cordovaDialogs",["$q","$window",function(e,n){return{alert:function(t,r,o){var i=e.defer();return n.navigator.notification?navigator.notification.alert(t,function(){i.resolve()},r,o):(n.alert(t),i.resolve()),i.promise},confirm:function(t,r,o){var i=e.defer();return n.navigator.notification?navigator.notification.confirm(t,function(e){i.resolve(e)},r,o):i.resolve(n.confirm(t)?1:2),i.promise},prompt:function(t,r,o,i){var a=e.defer();if(n.navigator.notification)navigator.notification.prompt(t,function(e){a.resolve(e)},r,o,i);else{var c=n.prompt(t,i);a.resolve(null!==c?{input1:c,buttonIndex:1}:{input1:c,buttonIndex:2})}return a.promise},beep:function(e){return navigator.notification.beep(e)}}}]),angular.module("ngCordova.plugins.emailComposer",[]).factory("$cordovaEmailComposer",["$q",function(e){return{isAvailable:function(){var n=e.defer();return cordova.plugins.email.isAvailable(function(e){e?n.resolve():n.reject()}),n.promise},open:function(n){var t=e.defer();return cordova.plugins.email.open(n,function(){t.reject()}),t.promise},addAlias:function(e,n){cordova.plugins.email.addAlias(e,n)}}}]),angular.module("ngCordova.plugins.facebook",[]).provider("$cordovaFacebook",[function(){this.browserInit=function(e,n){this.appID=e,this.appVersion=n||"v2.0",facebookConnectPlugin.browserInit(this.appID,this.appVersion)},this.$get=["$q",function(e){return{login:function(n){var t=e.defer();return facebookConnectPlugin.login(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},showDialog:function(n){var t=e.defer();return facebookConnectPlugin.showDialog(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},api:function(n,t){var r=e.defer();return facebookConnectPlugin.api(n,t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},getAccessToken:function(){var n=e.defer();return facebookConnectPlugin.getAccessToken(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getLoginStatus:function(){var n=e.defer();return facebookConnectPlugin.getLoginStatus(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},logout:function(){var n=e.defer();return facebookConnectPlugin.logout(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]}]),angular.module("ngCordova.plugins.facebookAds",[]).factory("$cordovaFacebookAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.FacebookAds.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.FacebookAds.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.FacebookAds.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.FacebookAds.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.FacebookAds.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.FacebookAds.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.FacebookAds.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.FacebookAds.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.file",[]).constant("$cordovaFileError",{1:"NOT_FOUND_ERR",2:"SECURITY_ERR",3:"ABORT_ERR",4:"NOT_READABLE_ERR",5:"ENCODING_ERR",6:"NO_MODIFICATION_ALLOWED_ERR",7:"INVALID_STATE_ERR",8:"SYNTAX_ERR",9:"INVALID_MODIFICATION_ERR",10:"QUOTA_EXCEEDED_ERR",11:"TYPE_MISMATCH_ERR",12:"PATH_EXISTS_ERR"}).provider("$cordovaFile",[function(){this.$get=["$q","$window","$cordovaFileError",function(e,n,t){return{getFreeDiskSpace:function(){var n=e.defer();return cordova.exec(function(e){n.resolve(e)},function(e){n.reject(e)},"File","getFreeDiskSpace",[]),n.promise},checkDir:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("directory cannot start with /");try{var a=r+o;n.resolveLocalFileSystemURL(a,function(e){e.isDirectory===!0?i.resolve(e):i.reject({code:13,message:"input is not a directory"})},function(e){e.message=t[e.code],i.reject(e)})}catch(c){c.message=t[c.code],i.reject(c)}return i.promise},checkFile:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("directory cannot start with /");try{var a=r+o;n.resolveLocalFileSystemURL(a,function(e){e.isFile===!0?i.resolve(e):i.reject({code:13,message:"input is not a file"})},function(e){e.message=t[e.code],i.reject(e)})}catch(c){c.message=t[c.code],i.reject(c)}return i.promise},createDir:function(r,o,i){var a=e.defer();/^\//.test(o)&&a.reject("directory cannot start with /"),i=i?!1:!0;var c={create:!0,exclusive:i};try{n.resolveLocalFileSystemURL(r,function(e){e.getDirectory(o,c,function(e){a.resolve(e)},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(u){u.message=t[u.code],a.reject(u)}return a.promise},createFile:function(r,o,i){var a=e.defer();/^\//.test(o)&&a.reject("file-name cannot start with /"),i=i?!1:!0;var c={create:!0,exclusive:i};try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,c,function(e){a.resolve(e)},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(u){u.message=t[u.code],a.reject(u)}return a.promise},removeDir:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getDirectory(o,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},removeFile:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},removeRecursively:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getDirectory(o,{create:!1},function(e){e.removeRecursively(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},writeFile:function(r,o,i,a){var c=e.defer();/^\//.test(o)&&c.reject("file-name cannot start with /"),a=a?!1:!0;var u={create:!0,exclusive:a};try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,u,function(e){e.createWriter(function(e){u.append===!0&&e.seek(e.length),u.truncate&&e.truncate(u.truncate),e.onwriteend=function(e){this.error?c.reject(this.error):c.resolve(e)},e.write(i),c.promise.abort=function(){e.abort()}})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(s){s.message=t[s.code],c.reject(s)}return c.promise},writeExistingFile:function(r,o,i){var a=e.defer();/^\//.test(o)&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.createWriter(function(e){e.seek(e.length),e.onwriteend=function(e){this.error?a.reject(this.error):a.resolve(e)},e.write(i),a.promise.abort=function(){e.abort()}})},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(c){c.message=t[c.code],a.reject(c)}return a.promise},readAsText:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target._result||null!==e.target._result?i.resolve(e.target._result):i.reject(void 0!==e.target._error||null!==e.target._error?e.target._error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsText(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsDataURL:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target._result||null!==e.target._result?i.resolve(e.target._result):i.reject(void 0!==e.target._error||null!==e.target._error?e.target._error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsDataURL(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsBinaryString:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target._result||null!==e.target._result?i.resolve(e.target._result):i.reject(void 0!==e.target._error||null!==e.target._error?e.target._error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsBinaryString(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsArrayBuffer:function(r,o){var i=e.defer();/^\//.test(o)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target._result||null!==e.target._result?i.resolve(e.target._result):i.reject(void 0!==e.target._error||null!==e.target._error?e.target._error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsArrayBuffer(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},moveFile:function(t,r,o,i){var a=e.defer();i=i||r,(/^\//.test(r)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(t,function(e){e.getFile(r,{create:!1},function(e){n.resolveLocalFileSystemURL(o,function(n){e.moveTo(n,i,function(e){a.resolve(e)},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})}catch(c){a.reject(c)}return a.promise},moveDir:function(t,r,o,i){var a=e.defer();i=i||r,(/^\//.test(r)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(t,function(e){e.getDirectory(r,{create:!1},function(e){n.resolveLocalFileSystemURL(o,function(n){e.moveTo(n,i,function(e){a.resolve(e)},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})}catch(c){a.reject(c)}return a.promise},copyDir:function(r,o,i,a){var c=e.defer();a=a||o,(/^\//.test(o)||/^\//.test(a))&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getDirectory(o,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(u){u.message=t[u.code],c.reject(u)}return c.promise},copyFile:function(r,o,i,a){var c=e.defer();a=a||o,/^\//.test(o)&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(u){u.message=t[u.code],c.reject(u)}return c.promise}}}]}]),angular.module("ngCordova.plugins.fileOpener2",[]).factory("$cordovaFileOpener2",["$q",function(e){return{open:function(n,t){var r=e.defer();return cordova.plugins.fileOpener2.open(n,t,{error:function(e){r.reject(e)},success:function(){r.resolve()}}),r.promise},uninstall:function(n){var t=e.defer();return cordova.plugins.fileOpener2.uninstall(n,{error:function(e){t.reject(e)},success:function(){t.resolve()}}),t.promise},appIsInstalled:function(n){var t=e.defer();return cordova.plugins.fileOpener2.appIsInstalled(n,{success:function(e){t.resolve(e)}}),t.promise}}}]),angular.module("ngCordova.plugins.fileTransfer",[]).factory("$cordovaFileTransfer",["$q","$timeout",function(e,n){return{download:function(t,r,o,i){var a=e.defer(),c=new FileTransfer,u=o&&o.encodeURI===!1?t:encodeURI(t);return o&&void 0!==o.timeout&&null!==o.timeout&&(n(function(){c.abort()},o.timeout),o.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort()},c.download(u,r,a.resolve,a.reject,i,o),a.promise -},upload:function(t,r,o,i){var a=e.defer(),c=new FileTransfer,u=o&&o.encodeURI===!1?t:encodeURI(t);return o&&void 0!==o.timeout&&null!==o.timeout&&(n(function(){c.abort()},o.timeout),o.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort()},c.upload(r,u,a.resolve,a.reject,o,i),a.promise}}}]),angular.module("ngCordova.plugins.flashlight",[]).factory("$cordovaFlashlight",["$q","$window",function(e,n){return{available:function(){var t=e.defer();return n.plugins.flashlight.available(function(e){t.resolve(e)}),t.promise},switchOn:function(){var t=e.defer();return n.plugins.flashlight.switchOn(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},switchOff:function(){var t=e.defer();return n.plugins.flashlight.switchOff(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},toggle:function(){var t=e.defer();return n.plugins.flashlight.toggle(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.flurryAds",[]).factory("$cordovaFlurryAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.FlurryAds.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.FlurryAds.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.FlurryAds.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.FlurryAds.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.FlurryAds.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.FlurryAds.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.FlurryAds.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.FlurryAds.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.ga",[]).factory("$cordovaGA",["$q","$window",function(e,n){return{init:function(t,r){var o=e.defer();return r=r>=0?r:10,n.plugins.gaPlugin.init(function(e){o.resolve(e)},function(e){o.reject(e)},t,r),o.promise},trackEvent:function(t,r,o,i,a,c){var u=e.defer();return n.plugins.gaPlugin.trackEvent(function(e){u.resolve(e)},function(e){u.reject(e)},o,i,a,c),u.promise},trackPage:function(t,r,o){var i=e.defer();return n.plugins.gaPlugin.trackPage(function(e){i.resolve(e)},function(e){i.reject(e)},o),i.promise},setVariable:function(t,r,o,i){var a=e.defer();return n.plugins.gaPlugin.setVariable(function(e){a.resolve(e)},function(e){a.reject(e)},o,i),a.promise},exit:function(){var t=e.defer();return n.plugins.gaPlugin.exit(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.geolocation",[]).factory("$cordovaGeolocation",["$q",function(e){return{getCurrentPosition:function(n){var t=e.defer();return navigator.geolocation.getCurrentPosition(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},watchPosition:function(n){var t=e.defer(),r=navigator.geolocation.watchPosition(function(e){t.notify(e)},function(e){t.reject(e)},n);return t.promise.cancel=function(){navigator.geolocation.clearWatch(r)},t.promise.clearWatch=function(e){navigator.geolocation.clearWatch(e||r)},t.promise.watchID=r,t.promise},clearWatch:function(e){return navigator.geolocation.clearWatch(e)}}}]),angular.module("ngCordova.plugins.globalization",[]).factory("$cordovaGlobalization",["$q",function(e){return{getPreferredLanguage:function(){var n=e.defer();return navigator.globalization.getPreferredLanguage(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getLocaleName:function(){var n=e.defer();return navigator.globalization.getLocaleName(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getFirstDayOfWeek:function(){var n=e.defer();return navigator.globalization.getFirstDayOfWeek(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},dateToString:function(n,t){var r=e.defer();return navigator.globalization.dateToString(n,function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},stringToDate:function(n,t){var r=e.defer();return navigator.globalization.stringToDate(n,function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},getDatePattern:function(n){var t=e.defer();return navigator.globalization.getDatePattern(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},getDateNames:function(n){var t=e.defer();return navigator.globalization.getDateNames(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},isDayLightSavingsTime:function(n){var t=e.defer();return navigator.globalization.isDayLightSavingsTime(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},numberToString:function(n,t){var r=e.defer();return navigator.globalization.numberToString(n,function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},stringToNumber:function(n,t){var r=e.defer();return navigator.globalization.stringToNumber(n,function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},getNumberPattern:function(n){var t=e.defer();return navigator.globalization.getNumberPattern(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},getCurrencyPattern:function(n){var t=e.defer();return navigator.globalization.getCurrencyPattern(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.googleAds",[]).factory("$cordovaGoogleAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.AdMob.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.AdMob.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.AdMob.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.AdMob.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.AdMob.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.AdMob.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.AdMob.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.AdMob.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.googleAnalytics",[]).factory("$cordovaGoogleAnalytics",["$q","$window",function(e,n){return{startTrackerWithId:function(t){var r=e.defer();return n.analytics.startTrackerWithId(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},setUserId:function(t){var r=e.defer();return n.analytics.setUserId(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},debugMode:function(){var t=e.defer();return n.analytics.debugMode(function(e){t.resolve(e)},function(){t.reject()}),t.promise},trackView:function(t){var r=e.defer();return n.analytics.trackView(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},addCustomDimension:function(t,r){var o=e.defer();return n.analytics.addCustomDimension(t,r,function(){o.resolve()},function(e){o.reject(e)}),o.promise},trackEvent:function(t,r,o,i){var a=e.defer();return n.analytics.trackEvent(t,r,o,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},addTransaction:function(t,r,o,i,a,c){var u=e.defer();return n.analytics.addTransaction(t,r,o,i,a,c,function(e){u.resolve(e)},function(e){u.reject(e)}),u.promise},addTransactionItem:function(t,r,o,i,a,c,u){var s=e.defer();return n.analytics.addTransactionItem(t,r,o,i,a,c,u,function(e){s.resolve(e)},function(e){s.reject(e)}),s.promise}}}]),angular.module("ngCordova.plugins.googleMap",[]).factory("$cordovaGoogleMap",["$q","$window",function(e,n){var t=null;return{getMap:function(r){var o=e.defer();if(n.plugin.google.maps){var i=document.getElementById("map_canvas");t=n.plugin.google.maps.Map.getMap(r),t.setDiv(i),o.resolve(t)}else o.reject(null);return o.promise},isMapLoaded:function(){return!!t},addMarker:function(n){var r=e.defer();return t.addMarker(n,function(e){r.resolve(e)}),r.promise},getMapTypeIds:function(){return n.plugin.google.maps.mapTypeId},setVisible:function(n){var r=e.defer();return t.setVisible(n),r.promise},cleanup:function(){t=null}}}]),angular.module("ngCordova.plugins.googlePlayGame",[]).factory("$cordovaGooglePlayGame",["$q",function(e){return{auth:function(){var n=e.defer();return googleplaygame.auth(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},signout:function(){var n=e.defer();return googleplaygame.signout(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},isSignedIn:function(){var n=e.defer();return googleplaygame.isSignedIn(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},showPlayer:function(){var n=e.defer();return googleplaygame.showPlayer(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},submitScore:function(n){var t=e.defer();return googleplaygame.submitScore(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},showAllLeaderboards:function(){var n=e.defer();return googleplaygame.showAllLeaderboards(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},showLeaderboard:function(n){var t=e.defer();return googleplaygame.showLeaderboard(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},unlockAchievement:function(n){var t=e.defer();return googleplaygame.unlockAchievement(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},incrementAchievement:function(n){var t=e.defer();return googleplaygame.incrementAchievement(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},showAchievements:function(){var n=e.defer();return googleplaygame.showAchievements(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.googleplus",[]).factory("$cordovaGooglePlus",["$q","$window",function(e,n){return{login:function(t){void 0===t&&(t={});var r=e.defer();return n.plugins.googleplus.login({iOSApiKey:t},function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},silentLogin:function(t){void 0===t&&(t={});var r=e.defer();return n.plugins.googleplus.trySilentLogin({iOSApiKey:t},function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},logout:function(){var t=e.defer();n.plugins.googleplus.logout(function(e){t.resolve(e)})},disconnect:function(){var t=e.defer();n.plugins.googleplus.disconnect(function(e){t.resolve(e)})}}}]),angular.module("ngCordova.plugins.healthKit",[]).factory("$cordovaHealthKit",["$q","$window",function(e,n){return{isAvailable:function(){var t=e.defer();return n.plugins.healthkit.available(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},checkAuthStatus:function(t){var r=e.defer();return t=t||"HKQuantityTypeIdentifierHeight",n.plugins.healthkit.checkAuthStatus({type:t},function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},requestAuthorization:function(t,r){var o=e.defer();return t=t||["HKCharacteristicTypeIdentifierDateOfBirth","HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight"],r=r||["HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight","HKQuantityTypeIdentifierDistanceCycling"],n.plugins.healthkit.requestAuthorization({readTypes:t,writeTypes:r},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},readDateOfBirth:function(){var t=e.defer();return n.plugins.healthkit.readDateOfBirth(function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},readGender:function(){var t=e.defer();return n.plugins.healthkit.readGender(function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},saveWeight:function(t,r,o){var i=e.defer();return n.plugins.healthkit.saveWeight({unit:r||"lb",amount:t,date:o||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readWeight:function(t){var r=e.defer();return n.plugins.healthkit.readWeight({unit:t||"lb"},function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},saveHeight:function(t,r,o){var i=e.defer();return n.plugins.healthkit.saveHeight({unit:r||"in",amount:t,date:o||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readHeight:function(t){var r=e.defer();return n.plugins.healthkit.readHeight({unit:t||"in"},function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},findWorkouts:function(){var t=e.defer();return n.plugins.healthkit.findWorkouts({},function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},saveWorkout:function(t){var r=e.defer();return n.plugins.healthkit.saveWorkout(t,function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},querySampleType:function(t){var r=e.defer();return n.plugins.healthkit.querySampleType(t,function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise}}}]),angular.module("ngCordova.plugins.httpd",[]).factory("$cordovaHttpd",["$q",function(e){return{startServer:function(n){var t=e.defer();return cordova.plugins.CorHttpd.startServer(n,function(){t.resolve()},function(){t.reject()}),t.promise},stopServer:function(){var n=e.defer();return cordova.plugins.CorHttpd.stopServer(function(){n.resolve()},function(){n.reject()}),n.promise},getURL:function(){var n=e.defer();return cordova.plugins.CorHttpd.getURL(function(e){n.resolve(e)},function(){n.reject()}),n.promise},getLocalPath:function(){var n=e.defer();return cordova.plugins.CorHttpd.getLocalPath(function(e){n.resolve(e)},function(){n.reject()}),n.promise}}}]),angular.module("ngCordova.plugins.iAd",[]).factory("$cordovaiAd",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.iAd.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.iAd.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.iAd.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.iAd.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.iAd.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.iAd.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.iAd.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.iAd.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.imagePicker",[]).factory("$cordovaImagePicker",["$q","$window",function(e,n){return{getPictures:function(t){var r=e.defer();return n.imagePicker.getPictures(function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise}}}]),angular.module("ngCordova.plugins.inAppBrowser",[]).provider("$cordovaInAppBrowser",[function(){var e,n=this.defaultOptions={};this.setDefaultOptions=function(e){n=angular.extend(n,e)},this.$get=["$rootScope","$q","$window","$timeout",function(t,r,o,i){return{open:function(a,c,u){var s=r.defer();if(u&&!angular.isObject(u))return s.reject("options must be an object"),s.promise;var l=angular.extend({},n,u),f=[];angular.forEach(l,function(e,n){f.push(n+"="+e)});var d=f.join();return e=o.open(a,c,d),e.addEventListener("loadstart",function(e){i(function(){t.$broadcast("$cordovaInAppBrowser:loadstart",e)})},!1),e.addEventListener("loadstop",function(e){s.resolve(e),i(function(){t.$broadcast("$cordovaInAppBrowser:loadstop",e)})},!1),e.addEventListener("loaderror",function(e){s.reject(e),i(function(){t.$broadcast("$cordovaInAppBrowser:loaderror",e)})},!1),e.addEventListener("exit",function(e){i(function(){t.$broadcast("$cordovaInAppBrowser:exit",e)})},!1),s.promise},close:function(){e.close(),e=null},show:function(){e.show()},executeScript:function(n){var t=r.defer();return e.executeScript(n,function(e){t.resolve(e)}),t.promise},insertCSS:function(n){var t=r.defer();return e.insertCSS(n,function(e){t.resolve(e)}),t.promise}}}]}]),angular.module("ngCordova.plugins.insomnia",[]).factory("$cordovaInsomnia",["$window",function(e){return{keepAwake:function(){return e.plugins.insomnia.keepAwake()},allowSleepAgain:function(){return e.plugins.insomnia.allowSleepAgain()}}}]),angular.module("ngCordova.plugins.instagram",[]).factory("$cordovaInstagram",["$q",function(e){return{share:function(n){var t=e.defer();return window.Instagram?(Instagram.share(n.image,n.caption,function(e){e?t.reject(e):t.resolve(!0)}),t.promise):(console.error("Tried to call Instagram.share but the Instagram plugin isn't installed!"),t.resolve(null),t.promise)},isInstalled:function(){var n=e.defer();return window.Instagram?(Instagram.isInstalled(function(e,t){e?n.reject(e):n.resolve(t||!0)}),n.promise):(console.error("Tried to call Instagram.isInstalled but the Instagram plugin isn't installed!"),n.resolve(null),n.promise)}}}]),angular.module("ngCordova.plugins.keyboard",[]).factory("$cordovaKeyboard",[function(){var e=function(){$timeout(function(){$rootScope.$broadcast("$cordovaKeyboard:show")})},n=function(){$timeout(function(){$rootScope.$broadcast("$cordovaKeyboard:hide")})};return document.addEventListener("deviceready",function(){cordova.plugins.Keyboard&&(window.addEventListener("native.keyboardshow",e,!1),window.addEventListener("native.keyboardhide",n,!1))}),{hideAccessoryBar:function(e){return cordova.plugins.Keyboard.hideKeyboardAccessoryBar(e)},close:function(){return cordova.plugins.Keyboard.close()},disableScroll:function(e){return cordova.plugins.Keyboard.disableScroll(e)},isVisible:function(){return cordova.plugins.Keyboard.isVisible},clearShowWatch:function(){document.removeEventListener("native.keyboardshow",e),$rootScope.$$listeners["$cordovaKeyboard:show"]=[]},clearHideWatch:function(){document.removeEventListener("native.keyboardhide",n),$rootScope.$$listeners["$cordovaKeyboard:hide"]=[]}}}]),angular.module("ngCordova.plugins.keychain",[]).factory("$cordovaKeychain",["$q","$window",function(e,n){if("Keychain"in n)var t=new Keychain;return{getForKey:function(n,r){var o=e.defer();return t.getForKey(o.resolve,o.reject,n,r),o.promise},setForKey:function(n,r,o){var i=e.defer();return t.setForKey(i.resolve,i.reject,n,r,o),i.promise},removeForKey:function(n,r){var o=e.defer();return t.removeForKey(o.resolve,o.reject,n,r),o.promise}}}]),angular.module("ngCordova.plugins.localNotification",[]).factory("$cordovaLocalNotification",["$q","$window","$rootScope","$timeout",function(e,n,t,r){return document.addEventListener("deviceready",function(){n.plugin&&n.plugin.notification&&(n.plugin.notification.local.on("cancel",function(e,n,o){var i={id:e,state:n,json:o};r(function(){t.$broadcast("$cordovaLocalNotification:canceled",i)})}),n.plugin.notification.local.on("click",function(e,n,o){var i={id:e,state:n,json:o};r(function(){t.$broadcast("$cordovaLocalNotification:clicked",i)})}),n.plugin.notification.local.on("trigger",function(e,n,o){var i={id:e,state:n,json:o};r(function(){t.$broadcast("$cordovaLocalNotification:triggered",i)})}),n.plugin.notification.local.on("add",function(e,n,o){var i={id:e,state:n,json:o};r(function(){t.$broadcast("$cordovaLocalNotification:added",i)})}))},!1),{add:function(t,r){var o=e.defer();return r=r||null,n.plugin.notification.local.add(t,function(e){o.resolve(e)},r),o.promise},cancel:function(t,r){var o=e.defer();return r=r||null,n.plugin.notification.local.cancel(t,function(e){o.resolve(e)},r),o.promise},cancelAll:function(t){var r=e.defer();return t=t||null,n.plugin.notification.local.cancelAll(function(e){r.resolve(e)},t),r.promise},isScheduled:function(t,r){var o=e.defer();return r=r||null,n.plugin.notification.local.isScheduled(t,function(e){o.resolve(e)},r),o.promise},hasPermission:function(t){var r=e.defer();return n.plugin.notification.local.hasPermission(function(e){e?r.resolve(e):r.reject(e)},t),r.promise},promptForPermission:function(){var t=e.defer();return n.plugin.notification.local.promptForPermission(function(e){e?t.resolve(e):t.reject(e)}),t.promise},registerPermission:function(){var t=e.defer();return n.plugin.notification.local.registerPermission(function(e){e?t.resolve(e):t.reject(e)}),t.promise},getScheduledIds:function(t){var r=e.defer();return n.plugin.notification.local.getScheduledIds(function(e){r.resolve(e)},t),r.promise},isTriggered:function(t,r){var o=e.defer();return n.plugin.notification.local.isTriggered(t,function(e){o.resolve(e)},r),o.promise},getTriggeredIds:function(t){var r=e.defer();return n.plugin.notification.local.getTriggeredIds(function(e){r.resolve(e)},t),r.promise},getDefaults:function(){return n.plugin.notification.local.getDefaults()},setDefaults:function(e){n.plugin.notification.local.setDefaults(e)}}}]),angular.module("ngCordova.plugins.mMediaAds",[]).factory("$cordovaMMediaAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.mMedia.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.mMedia.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.mMedia.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.mMedia.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.mMedia.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.mMedia.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.mMedia.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.mMedia.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.media",[]).factory("$cordovaMedia",["$q",function(e){return{newMedia:function(n){var t,r=e.defer(),o=null;return t=new Media(n,function(e){r.resolve(e)},function(e){r.reject(e)},function(e){o=e}),r.promise.getCurrentPosition=function(){t.getCurrentPosition(function(){},function(){})},r.promise.getDuration=function(){t.getDuration()},r.promise.play=function(e){"object"!=typeof e&&(e={}),t.play(e)},r.promise.pause=function(){t.pause()},r.promise.stop=function(){t.stop()},r.promise.release=function(){t.release()},r.promise.seekTo=function(e){t.seekTo(e)},r.promise.setVolume=function(e){t.setVolume(e)},r.promise.startRecord=function(){t.startRecord()},r.promise.stopRecord=function(){t.stopRecord()},r.promise.media=t,r.promise}}}]),angular.module("ngCordova.plugins.mobfoxAds",[]).factory("$cordovaMobFoxAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.MobFox.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.MobFox.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.MobFox.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.MobFox.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.MobFox.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.MobFox.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.MobFox.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.MobFox.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins",["ngCordova.plugins.actionSheet","ngCordova.plugins.adMob","ngCordova.plugins.appAvailability","ngCordova.plugins.appRate","ngCordova.plugins.appVersion","ngCordova.plugins.backgroundGeolocation","ngCordova.plugins.badge","ngCordova.plugins.barcodeScanner","ngCordova.plugins.batteryStatus","ngCordova.plugins.ble","ngCordova.plugins.bluetoothSerial","ngCordova.plugins.brightness","ngCordova.plugins.calendar","ngCordova.plugins.camera","ngCordova.plugins.capture","ngCordova.plugins.clipboard","ngCordova.plugins.contacts","ngCordova.plugins.datePicker","ngCordova.plugins.device","ngCordova.plugins.deviceMotion","ngCordova.plugins.deviceOrientation","ngCordova.plugins.dialogs","ngCordova.plugins.emailComposer","ngCordova.plugins.facebook","ngCordova.plugins.facebookAds","ngCordova.plugins.file","ngCordova.plugins.fileTransfer","ngCordova.plugins.fileOpener2","ngCordova.plugins.flashlight","ngCordova.plugins.flurryAds","ngCordova.plugins.ga","ngCordova.plugins.geolocation","ngCordova.plugins.globalization","ngCordova.plugins.googleAds","ngCordova.plugins.googleAnalytics","ngCordova.plugins.googleMap","ngCordova.plugins.googlePlayGame","ngCordova.plugins.healthKit","ngCordova.plugins.httpd","ngCordova.plugins.iAd","ngCordova.plugins.imagePicker","ngCordova.plugins.inAppBrowser","ngCordova.plugins.keyboard","ngCordova.plugins.keychain","ngCordova.plugins.localNotification","ngCordova.plugins.media","ngCordova.plugins.mMediaAds","ngCordova.plugins.mobfoxAds","ngCordova.plugins.mopubAds","ngCordova.plugins.nativeAudio","ngCordova.plugins.network","ngCordova.plugins.oauth","ngCordova.plugins.oauthUtility","ngCordova.plugins.pinDialog","ngCordova.plugins.prefs","ngCordova.plugins.printer","ngCordova.plugins.progressIndicator","ngCordova.plugins.push","ngCordova.plugins.sms","ngCordova.plugins.socialSharing","ngCordova.plugins.spinnerDialog","ngCordova.plugins.splashscreen","ngCordova.plugins.sqlite","ngCordova.plugins.statusbar","ngCordova.plugins.toast","ngCordova.plugins.touchid","ngCordova.plugins.vibration","ngCordova.plugins.videoCapturePlus","ngCordova.plugins.zip","ngCordova.plugins.insomnia"]),angular.module("ngCordova.plugins.mopubAds",[]).factory("$cordovaMoPubAds",["$q","$window",function(e,n){return{setOptions:function(t){var r=e.defer();return n.MoPub.setOptions(t,function(){r.resolve()},function(){r.reject()}),r.promise},createBanner:function(t){var r=e.defer();return n.MoPub.createBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},removeBanner:function(){var t=e.defer();return n.MoPub.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var r=e.defer();return n.MoPub.showBanner(t,function(){r.resolve()},function(){r.reject()}),r.promise},showBannerAtXY:function(t,r){var o=e.defer();return n.MoPub.showBannerAtXY(t,r,function(){o.resolve()},function(){o.reject()}),o.promise},hideBanner:function(){var t=e.defer();return n.MoPub.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var r=e.defer();return n.MoPub.prepareInterstitial(t,function(){r.resolve()},function(){r.reject()}),r.promise},showInterstitial:function(){var t=e.defer();return n.MoPub.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.nativeAudio",[]).factory("$cordovaNativeAudio",["$q","$window",function(e,n){return{preloadSimple:function(t,r){var o=e.defer();return n.plugins.NativeAudio.preloadSimple(t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},preloadComplex:function(t,r,o,i){var a=e.defer();return n.plugins.NativeAudio.preloadComplex(t,r,o,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},play:function(t,r){var o=e.defer();return n.plugins.NativeAudio.play(t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},stop:function(t){var r=e.defer();return n.plugins.NativeAudio.stop(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},loop:function(t){var r=e.defer();return n.plugins.NativeAudio.loop(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},unload:function(t){var r=e.defer();return n.plugins.NativeAudio.unload(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},setVolumeForComplexAsset:function(t,r){var o=e.defer();return n.plugins.NativeAudio.setVolumeForComplexAsset(t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.network",[]).factory("$cordovaNetwork",["$rootScope","$timeout",function(e,n){var t=function(){var t=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:offline",t)})},r=function(){var t=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:online",t)})};return document.addEventListener("deviceready",function(){navigator.connection&&(document.addEventListener("offline",t,!1),document.addEventListener("online",r,!1))}),{getNetwork:function(){return navigator.connection.type},isOnline:function(){var e=navigator.connection.type;return e!==Connection.UNKNOWN&&e!==Connection.NONE},isOffline:function(){var e=navigator.connection.type;return e===Connection.UNKNOWN||e===Connection.NONE},clearOfflineWatch:function(){document.removeEventListener("offline",t),e.$$listeners["$cordovaNetwork:offline"]=[]},clearOnlineWatch:function(){document.removeEventListener("online",t),e.$$listeners["$cordovaNetwork:online"]=[]}}}]).run(["$cordovaNetwork",function(){}]),angular.module("ngCordova.plugins.oauth",["ngCordova.plugins.oauthUtility"]).factory("$cordovaOauth",["$q","$http","$cordovaOauthUtility",function(e,n,t){return{adfs:function(t,r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open(r+"/adfs/oauth2/authorize?response_type=code&client_id="+t+"&redirect_uri=http://localhost/callback&resource="+o,"_blank","location=no");c.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){var o=e.url.split("code=")[1];n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:r+"/adfs/oauth2/token",data:"client_id="+t+"&code="+o+"&redirect_uri=http://localhost/callback&grant_type=authorization_code"}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)})}}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},dropbox:function(n){var t=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var o=window.open("https://www.dropbox.com/1/oauth2/authorize?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");o.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],r=n.split("&"),i=[],a=0;a<r.length;a++)i[r[a].split("=")[0]]=r[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve({access_token:i.access_token,token_type:i.token_type,uid:i.uid}):t.reject("Problem authenticating"),setTimeout(function(){o.close()},10)}}),o.addEventListener("exit",function(){t.reject("The sign in flow was canceled") -})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},digitalOcean:function(t,r){var o=e.defer();if(window.cordova){var i=cordova.require("cordova/plugin_list").metadata;if(i.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var a=window.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&response_type=code&scope=read%20write","_blank","location=no,clearsessioncache=yes,clearcache=yes");a.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){var i=e.url.split("code=")[1];n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://cloud.digitalocean.com/v1/oauth/token",data:"client_id="+t+"&client_secret="+r+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+i}).success(function(e){o.resolve(e)}).error(function(){o.reject("Problem authenticating")}).finally(function(){setTimeout(function(){a.close()},10)})}}),a.addEventListener("exit",function(){o.reject("The sign in flow was canceled")})}else o.reject("Could not find InAppBrowser plugin")}else o.reject("Cannot authenticate via a web browser");return o.promise},google:function(n,t){var r=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://accounts.google.com/o/oauth2/auth?client_id="+n+"&redirect_uri=http://localhost/callback&scope="+t.join(" ")+"&approval_prompt=force&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),o=[],a=0;a<t.length;a++)o[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==o.access_token&&null!==o.access_token?r.resolve({access_token:o.access_token,token_type:o.token_type,expires_in:o.expires_in}):r.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){r.reject("The sign in flow was canceled")})}else r.reject("Could not find InAppBrowser plugin")}else r.reject("Cannot authenticate via a web browser");return r.promise},github:function(t,r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://github.com/login/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+o.join(","),"_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n.defaults.headers.post.accept="application/json",n({method:"post",url:"https://github.com/login/oauth/access_token",data:"client_id="+t+"&client_secret="+r+"&redirect_uri=http://localhost/callback&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},facebook:function(n,t){var r=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://www.facebook.com/dialog/oauth?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token&scope="+t.join(","),"_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),o=[],a=0;a<t.length;a++)o[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==o.access_token&&null!==o.access_token?r.resolve({access_token:o.access_token,expires_in:o.expires_in}):r.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){r.reject("The sign in flow was canceled")})}else r.reject("Could not find InAppBrowser plugin")}else r.reject("Cannot authenticate via a web browser");return r.promise},linkedin:function(t,r,o,i){var a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var u=window.open("https://www.linkedin.com/uas/oauth2/authorization?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+o.join(" ")+"&response_type=code&state="+i,"_blank","location=no,clearsessioncache=yes,clearcache=yes");u.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://www.linkedin.com/uas/oauth2/accessToken",data:"client_id="+t+"&client_secret="+r+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){a.resolve(e)}).error(function(){a.reject("Problem authenticating")}).finally(function(){setTimeout(function(){u.close()},10)}))}),u.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},instagram:function(n,t){var r=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://api.instagram.com/oauth/authorize/?client_id="+n+"&redirect_uri=http://localhost/callback&scope="+t.join(" ")+"&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),o=[],a=0;a<t.length;a++)o[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==o.access_token&&null!==o.access_token?r.resolve({access_token:o.access_token}):r.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){r.reject("The sign in flow was canceled")})}else r.reject("Could not find InAppBrowser plugin")}else r.reject("Cannot authenticate via a web browser");return r.promise},box:function(t,r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://app.box.com/api/oauth2/authorize/?client_id="+t+"&redirect_uri=http://localhost/callback&state="+o+"&response_type=code","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://app.box.com/api/oauth2/token",data:"client_id="+t+"&client_secret="+r+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},reddit:function(t,r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://ssl.reddit.com/api/v1/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&duration=permanent&state=ngcordovaoauth&scope="+o.join(",")+"&response_type=code","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n.defaults.headers.post.Authorization="Basic "+btoa(t+":"+r),n({method:"post",url:"https://ssl.reddit.com/api/v1/access_token",data:"redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},twitter:function(r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0)if("undefined"!=typeof jsSHA){var c={oauth_consumer_key:r,oauth_nonce:t.createNonce(10),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:Math.round((new Date).getTime()/1e3),oauth_version:"1.0"},u=t.createSignature("POST","https://api.twitter.com/oauth/request_token",c,{oauth_callback:"http://localhost/callback"},o);n({method:"post",url:"https://api.twitter.com/oauth/request_token",headers:{Authorization:u.authorization_header,"Content-Type":"application/x-www-form-urlencoded"},data:"oauth_callback="+encodeURIComponent("http://localhost/callback")}).success(function(e){for(var r=e.split("&"),a={},u=0;u<r.length;u++)a[r[u].split("=")[0]]=r[u].split("=")[1];a.hasOwnProperty("oauth_token")===!1&&i.reject("Oauth request token was not received");var s=window.open("https://api.twitter.com/oauth/authenticate?oauth_token="+a.oauth_token,"_blank","location=no,clearsessioncache=yes,clearcache=yes");s.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var r=e.url.split("?")[1],a=r.split("&"),u={},l=0;l<a.length;l++)u[a[l].split("=")[0]]=a[l].split("=")[1];u.hasOwnProperty("oauth_verifier")===!1&&i.reject("Browser authentication failed to complete. No oauth_verifier was returned"),delete c.oauth_signature,c.oauth_token=u.oauth_token;var f=t.createSignature("POST","https://api.twitter.com/oauth/access_token",c,{oauth_verifier:u.oauth_verifier},o);n({method:"post",url:"https://api.twitter.com/oauth/access_token",headers:{Authorization:f.authorization_header},params:{oauth_verifier:u.oauth_verifier}}).success(function(e){for(var n=e.split("&"),t={},r=0;r<n.length;r++)t[n[r].split("=")[0]]=n[r].split("=")[1];t.hasOwnProperty("oauth_token_secret")===!1&&i.reject("Oauth access token was not received"),i.resolve(t)}).error(function(e){i.reject(e)}).finally(function(){setTimeout(function(){s.close()},10)})}}),s.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}).error(function(e){i.reject(e)})}else i.reject("Missing jsSHA JavaScript library");else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},meetup:function(n){var t=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var o=window.open("https://secure.meetup.com/oauth2/authorize/?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");o.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],r=n.split("&"),i={},a=0;a<r.length;a++)i[r[a].split("=")[0]]=r[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve(i):t.reject("Problem authenticating"),setTimeout(function(){o.close()},10)}}),o.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},salesforce:function(n,t){var r="http://localhost/callback",o=function(e,n,t){return e+"services/oauth2/authorize?display=touch&response_type=token&client_id="+escape(n)+"&redirect_uri="+escape(t)},i=function(e,n){return e.substr(0,n.length)===n},a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var u=window.open(o(n,t,r),"_blank","location=no,clearsessioncache=yes,clearcache=yes");u.addEventListener("loadstart",function(e){if(i(e.url,r)){var n={},t=e.url.split("#")[1];if(t){var o=t.split("&");for(var c in o){var s=o[c].split("=");n[s[0]]=unescape(s[1])}}"undefined"==typeof n||"undefined"==typeof n.access_token?a.reject("Problem authenticating"):a.resolve(n),setTimeout(function(){u.close()},10)}}),u.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},strava:function(t,r,o){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://www.strava.com/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+o.join(",")+"&response_type=code&approval_prompt=force","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://www.strava.com/oauth/token",data:"client_id="+t+"&client_secret="+r+"&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},foursquare:function(n){var t=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var o=window.open("https://foursquare.com/oauth2/authenticate?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");o.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],r=n.split("&"),i=[],a=0;a<r.length;a++)i[r[a].split("=")[0]]=r[a].split("=")[1];if(void 0!==i.access_token&&null!==i.access_token){var c={access_token:i.access_token,expires_in:i.expires_in};t.resolve(c)}else t.reject("Problem authenticating");setTimeout(function(){o.close()},10)}}),o.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},magento:function(r,o,i){var a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0)if("undefined"!=typeof jsSHA){var u={oauth_callback:"http://localhost/callback",oauth_consumer_key:o,oauth_nonce:t.createNonce(5),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:Math.round((new Date).getTime()/1e3),oauth_version:"1.0"},s=t.createSignature("POST",r+"/oauth/initiate",u,{oauth_callback:"http://localhost/callback"},i);n.defaults.headers.post.Authorization=s.authorization_header,n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:r+"/oauth/initiate",data:"oauth_callback=http://localhost/callback"}).success(function(e){for(var o=e.split("&"),c={},s=0;s<o.length;s++)c[o[s].split("=")[0]]=o[s].split("=")[1];c.hasOwnProperty("oauth_token")===!1&&a.reject("Oauth request token was not received");var l=c.oauth_token_secret,f=window.open(r+"/oauth/authorize?oauth_token="+c.oauth_token,"_blank","location=no,clearsessioncache=yes,clearcache=yes");f.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var o=e.url.split("?")[1],c=o.split("&"),s={},d=0;d<c.length;d++)s[c[d].split("=")[0]]=c[d].split("=")[1];s.hasOwnProperty("oauth_verifier")===!1&&a.reject("Browser authentication failed to complete. No oauth_verifier was returned"),delete u.oauth_signature,delete u.oauth_callback,u.oauth_token=s.oauth_token,u.oauth_nonce=t.createNonce(5),u.oauth_verifier=s.oauth_verifier;var p=t.createSignature("POST",r+"/oauth/token",u,{},i,l);n.defaults.headers.post.Authorization=p.authorization_header,n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:r+"/oauth/token"}).success(function(e){for(var n=e.split("&"),t={},r=0;r<n.length;r++)t[n[r].split("=")[0]]=n[r].split("=")[1];t.hasOwnProperty("oauth_token_secret")===!1&&a.reject("Oauth access token was not received"),a.resolve(t)}).error(function(e){a.reject(e)}).finally(function(){setTimeout(function(){f.close()},10)})}}),f.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}).error(function(e){a.reject(e)})}else a.reject("Missing jsSHA JavaScript library");else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},vkontakte:function(n,t){var r=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://oauth.vk.com/authorize?client_id="+n+"&redirect_uri=http://oauth.vk.com/blank.html&response_type=token&scope="+t.join(",")+"&display=touch&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){var n=e.url.split("#");if("https://oauth.vk.com/blank.html"==n[0]||"http://oauth.vk.com/blank.html"==n[0]){for(var t=e.url.split("#")[1],o=t.split("&"),a=[],c=0;c<o.length;c++)a[o[c].split("=")[0]]=o[c].split("=")[1];void 0!==a.access_token&&null!==a.access_token?r.resolve({access_token:a.access_token,expires_in:a.expires_in,user_id:a.user_id}):r.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){r.reject("The sign in flow was canceled")})}else r.reject("Could not find InAppBrowser plugin")}else r.reject("Cannot authenticate via a web browser");return r.promise},imgur:function(n){var t=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var o=window.open("https://api.imgur.com/oauth2/authorize?client_id="+n+"&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");o.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){o.removeEventListener("exit",function(){}),o.close();for(var n=e.url.split("#")[1],r=n.split("&"),i=[],a=0;a<r.length;a++)i[r[a].split("=")[0]]=r[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve({access_token:i.access_token,expires_in:i.expires_in,account_username:i.account_username}):t.reject("Problem authenticating")}}),o.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise}}}]),angular.module("ngCordova.plugins.oauthUtility",[]).factory("$cordovaOauthUtility",["$q",function(){return{createSignature:function(e,n,t,r,o,i){if("undefined"!=typeof jsSHA){for(var a=angular.copy(t),c=Object.keys(r),u=0;u<c.length;u++)a[c[u]]=encodeURIComponent(r[c[u]]);var s=e+"&"+encodeURIComponent(n)+"&",l=Object.keys(a).sort();for(u=0;u<l.length;u++)s+=encodeURIComponent(u==l.length-1?l[u]+"="+a[l[u]]:l[u]+"="+a[l[u]]+"&");var f=new jsSHA(s,"TEXT"),d="";i&&(d=encodeURIComponent(i)),t.oauth_signature=encodeURIComponent(f.getHMAC(encodeURIComponent(o)+"&"+d,"TEXT","SHA-1","B64"));var p=Object.keys(t),v="OAuth ";for(u=0;u<p.length;u++)v+=u==p.length-1?p[u]+'="'+t[p[u]]+'"':p[u]+'="'+t[p[u]]+'",';return{signature_base_string:s,authorization_header:v,signature:t.oauth_signature}}return"Missing jsSHA JavaScript library"},createNonce:function(e){for(var n="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;e>r;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n}}}]),angular.module("ngCordova.plugins.pinDialog",[]).factory("$cordovaPinDialog",["$q","$window",function(e,n){return{prompt:function(t,r,o){var i=e.defer();return n.plugins.pinDialog.prompt(t,function(e){i.resolve(e)},r,o),i.promise}}}]),angular.module("ngCordova.plugins.prefs",[]).factory("$cordovaPreferences",["$window","$q",function(e,n){return{set:function(t,r){var o=n.defer();return e.appgiraffe.plugins.applicationPreferences.set(t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},get:function(t){var r=n.defer();return e.appgiraffe.plugins.applicationPreferences.get(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.printer",[]).factory("$cordovaPrinter",["$q","$window",function(e,n){return{isAvailable:function(){var t=e.defer();return n.plugin.printer.isAvailable(function(e){t.resolve(e)}),t.promise},print:function(t,r){var o=e.defer();return n.plugin.printer.print(t,r,function(){o.resolve()}),o.promise}}}]),angular.module("ngCordova.plugins.progressIndicator",[]).factory("$cordovaProgress",["$q",function(){return{show:function(e){var n=e||"Please wait...";return ProgressIndicator.show(n)},showSimple:function(e){var n=e||!1;return ProgressIndicator.showSimple(n)},showSimpleWithLabel:function(e,n){var t=e||!1,r=n||"Loading...";return ProgressIndicator.showSimpleWithLabel(t,r)},showSimpleWithLabelDetail:function(e,n,t){var r=e||!1,o=n||"Loading...",i=t||"Please wait";return ProgressIndicator.showSimpleWithLabelDetail(r,o,i)},showDeterminate:function(e,n){var t=e||!1,r=n||5e4;return ProgressIndicator.showDeterminate(t,r)},showDeterminateWithLabel:function(e,n,t){var r=e||!1,o=n||5e4,i=t||"Loading...";return ProgressIndicator.showDeterminateWithLabel(r,o,i)},showAnnular:function(e,n){var t=e||!1,r=n||5e4;return ProgressIndicator.showAnnular(t,r)},showAnnularWithLabel:function(e,n,t){var r=e||!1,o=n||5e4,i=t||"Loading...";return ProgressIndicator.showAnnularWithLabel(r,o,i)},showBar:function(e,n){var t=e||!1,r=n||5e4;return ProgressIndicator.showBar(t,r)},showBarWithLabel:function(e,n,t){var r=e||!1,o=n||5e4,i=t||"Loading...";return ProgressIndicator.showBarWithLabel(r,o,i)},showSuccess:function(e,n){var t=e||!1,r=n||"Success";return ProgressIndicator.showSuccess(t,r)},showText:function(e,n,t){var r=e||!1,o=n||"Warning",i=t||"center";return ProgressIndicator.showText(r,o,i)},hide:function(){return ProgressIndicator.hide()}}}]),angular.module("ngCordova.plugins.push",[]).factory("$cordovaPush",["$q","$window","$rootScope","$timeout",function(e,n,t,r){return{onNotification:function(e){r(function(){t.$broadcast("$cordovaPush:notificationReceived",e)})},register:function(t){var r,o=e.defer();return void 0!==t&&void 0===t.ecb&&(r=null==document.querySelector("[ng-app]")?"document.body":"document.querySelector('[ng-app]')",t.ecb="angular.element("+r+").injector().get('$cordovaPush').onNotification"),n.plugins.pushNotification.register(function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},unregister:function(t){var r=e.defer();return n.plugins.pushNotification.unregister(function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},setBadgeNumber:function(t){var r=e.defer();return n.plugins.pushNotification.setApplicationIconBadgeNumber(function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise}}}]),angular.module("ngCordova.plugins.sms",[]).factory("$cordovaSms",["$q",function(e){return{send:function(n,t,r){var o=e.defer();return sms.send(n,t,r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.socialSharing",[]).factory("$cordovaSocialSharing",["$q","$window",function(e,n){return{share:function(t,r,o,i){var a=e.defer();return r=r||null,o=o||null,i=i||null,n.plugins.socialsharing.share(t,r,o,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaTwitter:function(t,r,o){var i=e.defer();return r=r||null,o=o||null,n.plugins.socialsharing.shareViaTwitter(t,r,o,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaWhatsApp:function(t,r,o){var i=e.defer();return r=r||null,o=o||null,n.plugins.socialsharing.shareViaWhatsApp(t,r,o,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebook:function(t,r,o){var i=e.defer();return t=t||null,r=r||null,o=o||null,n.plugins.socialsharing.shareViaFacebook(t,r,o,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebookWithPasteMessageHint:function(t,r,o,i){var a=e.defer();return r=r||null,o=o||null,n.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(t,r,o,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaSMS:function(t,r){var o=e.defer();return n.plugins.socialsharing.shareViaSMS(t,r,function(){o.resolve(!0)},function(){o.reject(!1)}),o.promise},shareViaEmail:function(t,r,o,i,a,c){var u=e.defer();return o=o||null,i=i||null,a=a||null,c=c||null,n.plugins.socialsharing.shareViaEmail(t,r,o,i,a,c,function(){u.resolve(!0)},function(){u.reject(!1)}),u.promise},shareVia:function(t,r,o,i,a){var c=e.defer();return r=r||null,o=o||null,i=i||null,a=a||null,n.plugins.socialsharing.shareVia(t,r,o,i,a,function(){c.resolve(!0)},function(){c.reject(!1)}),c.promise},canShareViaEmail:function(){var t=e.defer();return n.plugins.socialsharing.canShareViaEmail(function(){t.resolve(!0)},function(){t.reject(!1)}),t.promise},canShareVia:function(t,r,o,i,a){var c=e.defer();return n.plugins.socialsharing.canShareVia(t,r,o,i,a,function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise},available:function(){var n=e.defer();window.plugins.socialsharing.available(function(e){e?n.resolve():n.reject()})}}}]),angular.module("ngCordova.plugins.spinnerDialog",[]).factory("$cordovaSpinnerDialog",["$window",function(e){return{show:function(n,t,r){return r=r||!1,e.plugins.spinnerDialog.show(n,t,r)},hide:function(){return e.plugins.spinnerDialog.hide()}}}]),angular.module("ngCordova.plugins.splashscreen",[]).factory("$cordovaSplashscreen",[function(){return{hide:function(){return navigator.splashscreen.hide()},show:function(){return navigator.splashscreen.show()}}}]),angular.module("ngCordova.plugins.sqlite",[]).factory("$cordovaSQLite",["$q","$window",function(e,n){return{openDB:function(e,t){return"undefined"==typeof t&&(t=0),n.sqlitePlugin.openDatabase({name:e,bgType:t})},execute:function(n,t,r){var o=e.defer();return n.transaction(function(e){e.executeSql(t,r,function(e,n){o.resolve(n)},function(e,n){o.reject(n)})}),o.promise},insertCollection:function(n,t,r){var o=e.defer(),i=r.slice(0);return n.transaction(function(e){!function n(){var r=i.splice(0,1)[0];try{e.executeSql(t,r,function(e,t){0===i.length?o.resolve(t):n()},function(e,n){o.reject(n)})}catch(a){o.reject(a)}}()}),o.promise},nestedExecute:function(n,t,r,o,i){var a=e.defer();return n.transaction(function(e){e.executeSql(t,o,function(e,n){a.resolve(n),e.executeSql(r,i,function(e,n){a.resolve(n)})})},function(e,n){a.reject(n)}),a.promise},deleteDB:function(t){var r=e.defer();return n.sqlitePlugin.deleteDatabase(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.statusbar",[]).factory("$cordovaStatusbar",[function(){return{overlaysWebView:function(e){return StatusBar.overlaysWebView(!!e)},style:function(e){switch(e){case 0:return StatusBar.styleDefault();case 1:return StatusBar.styleLightContent();case 2:return StatusBar.styleBlackTranslucent();case 3:return StatusBar.styleBlackOpaque();default:return StatusBar.styleDefault()}},styleColor:function(e){return StatusBar.backgroundColorByName(e)},styleHex:function(e){return StatusBar.backgroundColorByHexString(e)},hide:function(){return StatusBar.hide()},show:function(){return StatusBar.show()},isVisible:function(){return StatusBar.isVisible}}}]),angular.module("ngCordova.plugins.toast",[]).factory("$cordovaToast",["$q","$window",function(e,n){return{showShortTop:function(t){var r=e.defer();return n.plugins.toast.showShortTop(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showShortCenter:function(t){var r=e.defer();return n.plugins.toast.showShortCenter(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showShortBottom:function(t){var r=e.defer();return n.plugins.toast.showShortBottom(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showLongTop:function(t){var r=e.defer();return n.plugins.toast.showLongTop(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showLongCenter:function(t){var r=e.defer();return n.plugins.toast.showLongCenter(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showLongBottom:function(t){var r=e.defer();return n.plugins.toast.showLongBottom(t,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},show:function(t,r,o){var i=e.defer();return n.plugins.toast.show(t,r,o,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise}}}]),angular.module("ngCordova.plugins.touchid",[]).factory("$cordovaTouchID",["$q",function(e){return{checkSupport:function(){var n=e.defer();return window.cordova?touchid.checkSupport(function(e){n.resolve(e)},function(e){n.reject(e)}):n.reject("Not supported without cordova.js"),n.promise},authenticate:function(n){var t=e.defer();return window.cordova?touchid.authenticate(function(e){t.resolve(e)},function(e){t.reject(e)},n):t.reject("Not supported without cordova.js"),t.promise}}}]),angular.module("ngCordova.plugins.vibration",[]).factory("$cordovaVibration",[function(){return{vibrate:function(e){return navigator.notification.vibrate(e)},vibrateWithPattern:function(e,n){return navigator.notification.vibrateWithPattern(e,n)},cancelVibration:function(){return navigator.notification.cancelVibration()}}}]),angular.module("ngCordova.plugins.videoCapturePlus",[]).provider("$cordovaVideoCapturePlus",[function(){var e={};this.setLimit=function(n){e.limit=n},this.setMaxDuration=function(n){e.duration=n},this.setHighQuality=function(n){e.highquality=n},this.useFrontCamera=function(n){e.frontcamera=n},this.setPortraitOverlay=function(n){e.portraitOverlay=n},this.setLandscapeOverlay=function(n){e.landscapeOverlay=n},this.setOverlayText=function(n){e.overlayText=n},this.$get=["$q","$window",function(n,t){return{captureVideo:function(r){var o=n.defer();return t.plugins.videocaptureplus?(t.plugins.videocaptureplus.captureVideo(o.resolve,o.reject,angular.extend({},e,r)),o.promise):(o.resolve(null),o.promise)}}}]}]),angular.module("ngCordova.plugins.zip",[]).factory("$cordovaZip",["$q","$window",function(e,n){return{unzip:function(t,r){var o=e.defer();return n.zip.unzip(t,r,function(e){0===e?o.resolve():o.reject()},function(e){o.notify(e)}),o.promise}}}])}(); +!function(){angular.module("ngCordova",["ngCordova.plugins"]),angular.module("ngCordova.plugins.actionSheet",[]).factory("$cordovaActionSheet",["$q","$window",function(e,n){return{show:function(t){var o=e.defer();return n.plugins.actionsheet.show(t,function(e){o.resolve(e)}),o.promise},hide:function(){return n.plugins.actionsheet.hide()}}}]),angular.module("ngCordova.plugins.adMob",[]).factory("$cordovaAdMob",["$q","$window",function(e,n){return{createBannerView:function(t){var o=e.defer();return n.plugins.AdMob.createBannerView(t,function(){o.resolve()},function(){o.reject()}),o.promise},createInterstitialView:function(t){var o=e.defer();return n.plugins.AdMob.createInterstitialView(t,function(){o.resolve()},function(){o.reject()}),o.promise},requestAd:function(t){var o=e.defer();return n.plugins.AdMob.requestAd(t,function(){o.resolve()},function(){o.reject()}),o.promise},showAd:function(t){var o=e.defer();return n.plugins.AdMob.showAd(t,function(){o.resolve()},function(){o.reject()}),o.promise},requestInterstitialAd:function(t){var o=e.defer();return n.plugins.AdMob.requestInterstitialAd(t,function(){o.resolve()},function(){o.reject()}),o.promise}}}]),angular.module("ngCordova.plugins.appAvailability",[]).factory("$cordovaAppAvailability",["$q",function(e){return{check:function(n){var t=e.defer();return appAvailability.check(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.appRate",[]).provider("$cordovaAppRate",[function(){this.setPreferences=function(e){e&&angular.isObject(e)&&(AppRate.preferences.useLanguage=e.language||null,AppRate.preferences.displayAppName=e.appName||"",AppRate.preferences.promptAgainForEachNewVersion=e.promptForNewVersion||!0,AppRate.preferences.openStoreInApp=e.openStoreInApp||!1,AppRate.preferences.usesUntilPrompt=e.usesUntilPrompt||3,AppRate.preferences.useCustomRateDialog=e.useCustomRateDialog||!1,AppRate.preferences.storeAppURL.ios=e.iosURL||null,AppRate.preferences.storeAppURL.android=e.androidURL||null,AppRate.preferences.storeAppURL.blackberry=e.blackberryURL||null,AppRate.preferences.storeAppURL.windows8=e.windowsURL||null)},this.setCustomLocale=function(e){var n={title:"Rate %@",message:"If you enjoy using %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!",cancelButtonLabel:"No, Thanks",laterButtonLabel:"Remind Me Later",rateButtonLabel:"Rate It Now"};n=angular.extend(n,e),AppRate.preferences.customLocale=n},this.$get=["$q",function(e){return{promptForRating:function(n){var t=e.defer(),o=AppRate.promptForRating(n);return t.resolve(o),t.promise},navigateToAppStore:function(){var n=e.defer(),t=AppRate.navigateToAppStore();return n.resolve(t),n.promise},onButtonClicked:function(e){AppRate.onButtonClicked=function(n){e.call(this,n)}},onRateDialogShow:function(e){AppRate.onRateDialogShow=e()}}}]}]),angular.module("ngCordova.plugins.appVersion",[]).factory("$cordovaAppVersion",["$q",function(e){return{getAppVersion:function(){var n=e.defer();return cordova.getAppVersion(function(e){n.resolve(e)}),n.promise}}}]),angular.module("ngCordova.plugins.backgroundGeolocation",[]).factory("$cordovaBackgroundGeolocation",["$q","$window",function(e,n){return{init:function(){n.navigator.geolocation.getCurrentPosition(function(e){return e})},configure:function(t){this.init();var o=e.defer();return n.plugins.backgroundGeoLocation.configure(function(e){o.notify(e),n.plugins.backgroundGeoLocation.finish()},function(e){o.reject(e)},t),this.start(),o.promise},start:function(){var t=e.defer();return n.plugins.backgroundGeoLocation.start(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},stop:function(){var t=e.defer();return n.plugins.backgroundGeoLocation.stop(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.badge",[]).factory("$cordovaBadge",["$q",function(e){return{hasPermission:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?n.resolve(!0):n.reject("You do not have permission")}),n.promise},promptForPermission:function(){return cordova.plugins.notification.badge.promptForPermission()},set:function(n){var t=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?t.resolve(cordova.plugins.notification.badge.set(n)):t.reject("You do not have permission to set Badge")}),t.promise},get:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?cordova.plugins.notification.badge.get(function(e){n.resolve(e)}):n.reject("You do not have permission to get Badge")}),n.promise},clear:function(){var n=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?n.resolve(cordova.plugins.notification.badge.clear()):n.reject("You do not have permission to clear Badge")}),n.promise},configure:function(e){return cordova.plugins.notification.badge.configure(e)}}}]),angular.module("ngCordova.plugins.barcodeScanner",[]).factory("$cordovaBarcodeScanner",["$q",function(e){return{scan:function(n){var t=e.defer();return cordova.plugins.barcodeScanner.scan(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},encode:function(n,t){var o=e.defer();return n=n||"TEXT_TYPE",cordova.plugins.barcodeScanner.encode(n,t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.batteryStatus",[]).factory("$cordovaBatteryStatus",["$rootScope","$window","$timeout",function(e,n,t){var o=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:status",n)})},r=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:critical",n)})},i=function(n){t(function(){e.$broadcast("$cordovaBatteryStatus:low",n)})};return document.addEventListener("deviceready",function(){navigator.battery&&(n.addEventListener("batterystatus",o,!1),n.addEventListener("batterycritical",r,!1),n.addEventListener("batterylow",i,!1))},!1),!0}]).run(["$cordovaBatteryStatus",function(){}]),angular.module("ngCordova.plugins.ble",[]).factory("$cordovaBLE",["$q",function(e){return{scan:function(n,t){var o=e.defer();return ble.scan(n,t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},connect:function(n){var t=e.defer();return ble.connect(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},disconnect:function(n){var t=e.defer();return ble.disconnect(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},read:function(n,t,o){var r=e.defer();return ble.read(n,t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},write:function(n,t,o,r){var i=e.defer();return ble.write(n,t,o,r,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},writeCommand:function(n,t,o,r){var i=e.defer();return ble.writeCommand(n,t,o,r,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},startNotification:function(n,t,o){var r=e.defer();return ble.startNotification(n,t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},stopNotification:function(n,t,o){var r=e.defer();return ble.stopNotification(n,t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},isConnected:function(n){var t=e.defer();return ble.isConnected(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},isEnabled:function(){var n=e.defer();return ble.isEnabled(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.bluetoothSerial",[]).factory("$cordovaBluetoothSerial",["$q","$window",function(e,n){return{connect:function(t){var o=e.defer();return n.bluetoothSerial.connect(t,function(){o.resolve()},function(e){o.reject(e)}),o.promise},connectInsecure:function(t){var o=e.defer();return n.bluetoothSerial.connectInsecure(t,function(){o.resolve()},function(e){o.reject(e)}),o.promise},disconnect:function(){var t=e.defer();return n.bluetoothSerial.disconnect(function(){t.resolve()},function(e){t.reject(e)}),t.promise},list:function(){var t=e.defer();return n.bluetoothSerial.list(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},discoverUnpaired:function(){var t=e.defer();return n.bluetoothSerial.discoverUnpaired(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},setDeviceDiscoveredListener:function(){var t=e.defer();return n.bluetoothSerial.setDeviceDiscoveredListener(function(e){t.notify(e)}),t.promise},clearDeviceDiscoveredListener:function(){n.bluetoothSerial.clearDeviceDiscoveredListener()},showBluetoothSettings:function(){var t=e.defer();return n.bluetoothSerial.showBluetoothSettings(function(){t.resolve()},function(e){t.reject(e)}),t.promise},isEnabled:function(){var t=e.defer();return n.bluetoothSerial.isEnabled(function(){t.resolve()},function(){t.reject()}),t.promise},enable:function(){var t=e.defer();return n.bluetoothSerial.enable(function(){t.resolve()},function(){t.reject()}),t.promise},isConnected:function(){var t=e.defer();return n.bluetoothSerial.isConnected(function(){t.resolve()},function(){t.reject()}),t.promise},available:function(){var t=e.defer();return n.bluetoothSerial.available(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},read:function(){var t=e.defer();return n.bluetoothSerial.read(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},readUntil:function(t){var o=e.defer();return n.bluetoothSerial.readUntil(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},write:function(t){var o=e.defer();return n.bluetoothSerial.write(t,function(){o.resolve()},function(e){o.reject(e)}),o.promise},subscribe:function(t){var o=e.defer();return n.bluetoothSerial.subscribe(t,function(e){o.notify(e)},function(e){o.reject(e)}),o.promise},subscribeRawData:function(){var t=e.defer();return n.bluetoothSerial.subscribeRawData(function(e){t.notify(e)},function(e){t.reject(e)}),t.promise},unsubscribe:function(){var t=e.defer();return n.bluetoothSerial.unsubscribe(function(){t.resolve()},function(e){t.reject(e)}),t.promise},unsubscribeRawData:function(){var t=e.defer();return n.bluetoothSerial.unsubscribeRawData(function(){t.resolve()},function(e){t.reject(e)}),t.promise},clear:function(){var t=e.defer();return n.bluetoothSerial.clear(function(){t.resolve()},function(e){t.reject(e)}),t.promise},readRSSI:function(){var t=e.defer();return n.bluetoothSerial.readRSSI(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.brightness",[]).factory("$cordovaBrightness",["$q","$window",function(e,n){return{get:function(){var t=e.defer();return n.cordova.plugins.brightness.getBrightness(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},set:function(t){var o=e.defer();return n.cordova.plugins.brightness.setBrightness(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},setKeepScreenOn:function(t){var o=e.defer();return n.cordova.plugins.brightness.setKeepScreenOn(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.calendar",[]).factory("$cordovaCalendar",["$q","$window",function(e,n){return{createCalendar:function(t){var o=e.defer(),r=n.plugins.calendar.getCreateCalendarOptions();return"string"==typeof t?r.calendarName=t:r=angular.extend(r,t),n.plugins.calendar.createCalendar(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},deleteCalendar:function(t){var o=e.defer();return n.plugins.calendar.deleteCalendar(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEvent:function(t){var o=e.defer(),r={title:null,location:null,notes:null,startDate:null,endDate:null};return r=angular.extend(r,t),n.plugins.calendar.createEvent(r.title,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEventWithOptions:function(t){var o=e.defer(),r=[],i=window.plugins.calendar.getCalendarOptions(),a={title:null,location:null,notes:null,startDate:null,endDate:null};r=Object.keys(a);for(var c in t)-1===r.indexOf(c)?i[c]=t[c]:a[c]=t[c];return n.plugins.calendar.createEventWithOptions(a.title,a.location,a.notes,new Date(a.startDate),new Date(a.endDate),i,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEventInteractively:function(t){var o=e.defer(),r={title:null,location:null,notes:null,startDate:null,endDate:null};return r=angular.extend(r,t),n.plugins.calendar.createEventInteractively(r.title,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEventInNamedCalendar:function(t){var o=e.defer(),r={title:null,location:null,notes:null,startDate:null,endDate:null,calendarName:null};return r=angular.extend(r,t),n.plugins.calendar.createEventInNamedCalendar(r.title,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),r.calendarName,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},findEvent:function(t){var o=e.defer(),r={title:null,location:null,notes:null,startDate:null,endDate:null};return r=angular.extend(r,t),n.plugins.calendar.findEvent(r.title,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},listEventsInRange:function(t,o){var r=e.defer();return n.plugins.calendar.listEventsInRange(t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},listCalendars:function(){var t=e.defer();return n.plugins.calendar.listCalendars(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},findAllEventsInNamedCalendar:function(t){var o=e.defer();return n.plugins.calendar.findAllEventsInNamedCalendar(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},modifyEvent:function(t){var o=e.defer(),r={title:null,location:null,notes:null,startDate:null,endDate:null,newTitle:null,newLocation:null,newNotes:null,newStartDate:null,newEndDate:null};return r=angular.extend(r,t),n.plugins.calendar.modifyEvent(r.title,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),r.newTitle,r.newLocation,r.newNotes,new Date(r.newStartDate),new Date(r.newEndDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},deleteEvent:function(t){var o=e.defer(),r={newTitle:null,location:null,notes:null,startDate:null,endDate:null};return r=angular.extend(r,t),n.plugins.calendar.deleteEvent(r.newTitle,r.location,r.notes,new Date(r.startDate),new Date(r.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.camera",[]).factory("$cordovaCamera",["$q",function(e){return{getPicture:function(n){var t=e.defer();return navigator.camera?(navigator.camera.getPicture(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},cleanup:function(){var n=e.defer();return navigator.camera.cleanup(function(){n.resolve()},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.capture",[]).factory("$cordovaCapture",["$q",function(e){return{captureAudio:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureAudio(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},captureImage:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureImage(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)},captureVideo:function(n){var t=e.defer();return navigator.device.capture?(navigator.device.capture.captureVideo(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise):(t.resolve(null),t.promise)}}}]),angular.module("ngCordova.plugins.clipboard",[]).factory("$cordovaClipboard",["$q","$window",function(e,n){return{copy:function(t){var o=e.defer();return n.cordova.plugins.clipboard.copy(t,function(){o.resolve()},function(){o.reject()}),o.promise},paste:function(){var t=e.defer();return n.cordova.plugins.clipboard.paste(function(e){t.resolve(e)},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.contacts",[]).factory("$cordovaContacts",["$q",function(e){return{save:function(n){var t=e.defer(),o=navigator.contacts.create(n);return o.save(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},remove:function(n){var t=e.defer(),o=navigator.contacts.create(n);return o.remove(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},clone:function(e){var n=navigator.contacts.create(e);return n.clone(e)},find:function(n){var t=e.defer(),o=n.fields||["id","displayName"];return delete n.fields,navigator.contacts.find(o,function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},pickContact:function(){var n=e.defer();return navigator.contacts.pickContact(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.datePicker",[]).factory("$cordovaDatePicker",["$window","$q",function(e,n){return{show:function(t){var o=n.defer();return t=t||{date:new Date,mode:"date"},e.datePicker.show(t,function(e){o.resolve(e)}),o.promise}}}]),angular.module("ngCordova.plugins.device",[]).factory("$cordovaDevice",[function(){return{getDevice:function(){return device},getCordova:function(){return device.cordova},getModel:function(){return device.model},getName:function(){return device.name},getPlatform:function(){return device.platform},getUUID:function(){return device.uuid},getVersion:function(){return device.version}}}]),angular.module("ngCordova.plugins.deviceMotion",[]).factory("$cordovaDeviceMotion",["$q",function(e){return{getCurrentAcceleration:function(){var n=e.defer();return navigator.accelerometer.getCurrentAcceleration(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},watchAcceleration:function(n){var t=e.defer(),o=navigator.accelerometer.watchAcceleration(function(e){t.notify(e)},function(e){t.reject(e)},n);return t.promise.cancel=function(){navigator.accelerometer.clearWatch(o)},t.promise.clearWatch=function(e){navigator.accelerometer.clearWatch(e||o)},t.promise.watchID=o,t.promise},clearWatch:function(e){return navigator.accelerometer.clearWatch(e)}}}]),angular.module("ngCordova.plugins.deviceOrientation",[]).factory("$cordovaDeviceOrientation",["$q",function(e){var n={frequency:3e3};return{getCurrentHeading:function(){var n=e.defer();return navigator.compass.getCurrentHeading(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},watchHeading:function(t){var o=e.defer(),r=angular.extend(n,t),i=navigator.compass.watchHeading(function(e){o.notify(e)},function(e){o.reject(e)},r);return o.promise.cancel=function(){navigator.compass.clearWatch(i)},o.promise.clearWatch=function(e){navigator.compass.clearWatch(e||i)},o.promise.watchID=i,o.promise},clearWatch:function(e){return navigator.compass.clearWatch(e)}}}]),angular.module("ngCordova.plugins.dialogs",[]).factory("$cordovaDialogs",["$q","$window",function(e,n){return{alert:function(t,o,r){var i=e.defer();return n.navigator.notification?navigator.notification.alert(t,function(){i.resolve()},o,r):(n.alert(t),i.resolve()),i.promise},confirm:function(t,o,r){var i=e.defer();return n.navigator.notification?navigator.notification.confirm(t,function(e){i.resolve(e)},o,r):i.resolve(n.confirm(t)?1:2),i.promise},prompt:function(t,o,r,i){var a=e.defer();if(n.navigator.notification)navigator.notification.prompt(t,function(e){a.resolve(e)},o,r,i);else{var c=n.prompt(t,i);a.resolve(null!==c?{input1:c,buttonIndex:1}:{input1:c,buttonIndex:2})}return a.promise},beep:function(e){return navigator.notification.beep(e)}}}]),angular.module("ngCordova.plugins.emailComposer",[]).factory("$cordovaEmailComposer",["$q",function(e){return{isAvailable:function(){var n=e.defer();return cordova.plugins.email.isAvailable(function(e){e?n.resolve():n.reject()}),n.promise},open:function(n){var t=e.defer();return cordova.plugins.email.open(n,function(){t.reject()}),t.promise},addAlias:function(e,n){cordova.plugins.email.addAlias(e,n)}}}]),angular.module("ngCordova.plugins.facebook",[]).provider("$cordovaFacebook",[function(){this.browserInit=function(e,n){this.appID=e,this.appVersion=n||"v2.0",facebookConnectPlugin.browserInit(this.appID,this.appVersion)},this.$get=["$q",function(e){return{login:function(n){var t=e.defer();return facebookConnectPlugin.login(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},showDialog:function(n){var t=e.defer();return facebookConnectPlugin.showDialog(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},api:function(n,t){var o=e.defer();return facebookConnectPlugin.api(n,t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},getAccessToken:function(){var n=e.defer();return facebookConnectPlugin.getAccessToken(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getLoginStatus:function(){var n=e.defer();return facebookConnectPlugin.getLoginStatus(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},logout:function(){var n=e.defer();return facebookConnectPlugin.logout(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]}]),angular.module("ngCordova.plugins.facebookAds",[]).factory("$cordovaFacebookAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.FacebookAds.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.FacebookAds.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.FacebookAds.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.FacebookAds.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.FacebookAds.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.FacebookAds.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.FacebookAds.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.FacebookAds.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.file",[]).constant("$cordovaFileError",{1:"NOT_FOUND_ERR",2:"SECURITY_ERR",3:"ABORT_ERR",4:"NOT_READABLE_ERR",5:"ENCODING_ERR",6:"NO_MODIFICATION_ALLOWED_ERR",7:"INVALID_STATE_ERR",8:"SYNTAX_ERR",9:"INVALID_MODIFICATION_ERR",10:"QUOTA_EXCEEDED_ERR",11:"TYPE_MISMATCH_ERR",12:"PATH_EXISTS_ERR"}).provider("$cordovaFile",[function(){this.$get=["$q","$window","$cordovaFileError",function(e,n,t){return{getFreeDiskSpace:function(){var n=e.defer();return cordova.exec(function(e){n.resolve(e)},function(e){n.reject(e)},"File","getFreeDiskSpace",[]),n.promise},checkDir:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("directory cannot start with /");try{var a=o+r;n.resolveLocalFileSystemURL(a,function(e){e.isDirectory===!0?i.resolve(e):i.reject({code:13,message:"input is not a directory"})},function(e){e.message=t[e.code],i.reject(e)})}catch(c){c.message=t[c.code],i.reject(c)}return i.promise},checkFile:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("directory cannot start with /");try{var a=o+r;n.resolveLocalFileSystemURL(a,function(e){e.isFile===!0?i.resolve(e):i.reject({code:13,message:"input is not a file"})},function(e){e.message=t[e.code],i.reject(e)})}catch(c){c.message=t[c.code],i.reject(c)}return i.promise},createDir:function(o,r,i){var a=e.defer();/^\//.test(r)&&a.reject("directory cannot start with /"),i=i?!1:!0;var c={create:!0,exclusive:i};try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(r,c,function(e){a.resolve(e)},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(u){u.message=t[u.code],a.reject(u)}return a.promise},createFile:function(o,r,i){var a=e.defer();/^\//.test(r)&&a.reject("file-name cannot start with /"),i=i?!1:!0;var c={create:!0,exclusive:i};try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,c,function(e){a.resolve(e)},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(u){u.message=t[u.code],a.reject(u)}return a.promise},removeDir:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(r,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},removeFile:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},removeRecursively:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(r,{create:!1},function(e){e.removeRecursively(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},writeFile:function(o,r,i,a){var c=e.defer();/^\//.test(r)&&c.reject("file-name cannot start with /"),a=a?!1:!0;var u={create:!0,exclusive:a};try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,u,function(e){e.createWriter(function(e){u.append===!0&&e.seek(e.length),u.truncate&&e.truncate(u.truncate),e.onwriteend=function(e){this.error?c.reject(this.error):c.resolve(e)},e.write(i),c.promise.abort=function(){e.abort()}})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(s){s.message=t[s.code],c.reject(s)}return c.promise},writeExistingFile:function(o,r,i){var a=e.defer();/^\//.test(r)&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.createWriter(function(e){e.seek(e.length),e.onwriteend=function(e){this.error?a.reject(this.error):a.resolve(e)},e.write(i),a.promise.abort=function(){e.abort()}})},function(e){e.message=t[e.code],a.reject(e)})},function(e){e.message=t[e.code],a.reject(e)})}catch(c){c.message=t[c.code],a.reject(c)}return a.promise},readAsText:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target.result||null!==e.target.result?i.resolve(e.target.result):i.reject(void 0!==e.target.error||null!==e.target.error?e.target.error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsText(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsDataURL:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target.result||null!==e.target.result?i.resolve(e.target.result):i.reject(void 0!==e.target.error||null!==e.target.error?e.target.error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsDataURL(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsBinaryString:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target.result||null!==e.target.result?i.resolve(e.target.result):i.reject(void 0!==e.target.error||null!==e.target.error?e.target.error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsBinaryString(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},readAsArrayBuffer:function(o,r){var i=e.defer();/^\//.test(r)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1},function(e){e.file(function(e){var n=new FileReader;n.onloadend=function(e){void 0!==e.target.result||null!==e.target.result?i.resolve(e.target.result):i.reject(void 0!==e.target.error||null!==e.target.error?e.target.error:{code:null,message:"READER_ONLOADEND_ERR"})},n.readAsArrayBuffer(e)})},function(e){e.message=t[e.code],i.reject(e)})},function(e){e.message=t[e.code],i.reject(e)})}catch(a){a.message=t[a.code],i.reject(a)}return i.promise},moveFile:function(t,o,r,i){var a=e.defer();i=i||o,(/^\//.test(o)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(t,function(e){e.getFile(o,{create:!1},function(e){n.resolveLocalFileSystemURL(r,function(n){e.moveTo(n,i,function(e){a.resolve(e)},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})}catch(c){a.reject(c)}return a.promise},moveDir:function(t,o,r,i){var a=e.defer();i=i||o,(/^\//.test(o)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(t,function(e){e.getDirectory(o,{create:!1},function(e){n.resolveLocalFileSystemURL(r,function(n){e.moveTo(n,i,function(e){a.resolve(e)},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})},function(e){a.reject(e)})}catch(c){a.reject(c)}return a.promise},copyDir:function(o,r,i,a){var c=e.defer();a=a||r,(/^\//.test(r)||/^\//.test(a))&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(r,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(u){u.message=t[u.code],c.reject(u)}return c.promise},copyFile:function(o,r,i,a){var c=e.defer();a=a||r,/^\//.test(r)&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(r,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})},function(e){e.message=t[e.code],c.reject(e)})}catch(u){u.message=t[u.code],c.reject(u)}return c.promise}}}]}]),angular.module("ngCordova.plugins.fileOpener2",[]).factory("$cordovaFileOpener2",["$q",function(e){return{open:function(n,t){var o=e.defer();return cordova.plugins.fileOpener2.open(n,t,{error:function(e){o.reject(e)},success:function(){o.resolve()}}),o.promise},uninstall:function(n){var t=e.defer();return cordova.plugins.fileOpener2.uninstall(n,{error:function(e){t.reject(e)},success:function(){t.resolve()}}),t.promise},appIsInstalled:function(n){var t=e.defer();return cordova.plugins.fileOpener2.appIsInstalled(n,{success:function(e){t.resolve(e)}}),t.promise}}}]),angular.module("ngCordova.plugins.fileTransfer",[]).factory("$cordovaFileTransfer",["$q","$timeout",function(e,n){return{download:function(t,o,r,i){var a=e.defer(),c=new FileTransfer,u=r&&r.encodeURI===!1?t:encodeURI(t);return r&&void 0!==r.timeout&&null!==r.timeout&&(n(function(){c.abort()},r.timeout),r.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort() +},c.download(u,o,a.resolve,a.reject,i,r),a.promise},upload:function(t,o,r,i){var a=e.defer(),c=new FileTransfer,u=r&&r.encodeURI===!1?t:encodeURI(t);return r&&void 0!==r.timeout&&null!==r.timeout&&(n(function(){c.abort()},r.timeout),r.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort()},c.upload(o,u,a.resolve,a.reject,r,i),a.promise}}}]),angular.module("ngCordova.plugins.flashlight",[]).factory("$cordovaFlashlight",["$q","$window",function(e,n){return{available:function(){var t=e.defer();return n.plugins.flashlight.available(function(e){t.resolve(e)}),t.promise},switchOn:function(){var t=e.defer();return n.plugins.flashlight.switchOn(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},switchOff:function(){var t=e.defer();return n.plugins.flashlight.switchOff(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},toggle:function(){var t=e.defer();return n.plugins.flashlight.toggle(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.flurryAds",[]).factory("$cordovaFlurryAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.FlurryAds.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.FlurryAds.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.FlurryAds.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.FlurryAds.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.FlurryAds.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.FlurryAds.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.FlurryAds.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.FlurryAds.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.ga",[]).factory("$cordovaGA",["$q","$window",function(e,n){return{init:function(t,o){var r=e.defer();return o=o>=0?o:10,n.plugins.gaPlugin.init(function(e){r.resolve(e)},function(e){r.reject(e)},t,o),r.promise},trackEvent:function(t,o,r,i,a,c){var u=e.defer();return n.plugins.gaPlugin.trackEvent(function(e){u.resolve(e)},function(e){u.reject(e)},r,i,a,c),u.promise},trackPage:function(t,o,r){var i=e.defer();return n.plugins.gaPlugin.trackPage(function(e){i.resolve(e)},function(e){i.reject(e)},r),i.promise},setVariable:function(t,o,r,i){var a=e.defer();return n.plugins.gaPlugin.setVariable(function(e){a.resolve(e)},function(e){a.reject(e)},r,i),a.promise},exit:function(){var t=e.defer();return n.plugins.gaPlugin.exit(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.geolocation",[]).factory("$cordovaGeolocation",["$q",function(e){return{getCurrentPosition:function(n){var t=e.defer();return navigator.geolocation.getCurrentPosition(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},watchPosition:function(n){var t=e.defer(),o=navigator.geolocation.watchPosition(function(e){t.notify(e)},function(e){t.reject(e)},n);return t.promise.cancel=function(){navigator.geolocation.clearWatch(o)},t.promise.clearWatch=function(e){navigator.geolocation.clearWatch(e||o)},t.promise.watchID=o,t.promise},clearWatch:function(e){return navigator.geolocation.clearWatch(e)}}}]),angular.module("ngCordova.plugins.globalization",[]).factory("$cordovaGlobalization",["$q",function(e){return{getPreferredLanguage:function(){var n=e.defer();return navigator.globalization.getPreferredLanguage(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getLocaleName:function(){var n=e.defer();return navigator.globalization.getLocaleName(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getFirstDayOfWeek:function(){var n=e.defer();return navigator.globalization.getFirstDayOfWeek(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},dateToString:function(n,t){var o=e.defer();return navigator.globalization.dateToString(n,function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},stringToDate:function(n,t){var o=e.defer();return navigator.globalization.stringToDate(n,function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},getDatePattern:function(n){var t=e.defer();return navigator.globalization.getDatePattern(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},getDateNames:function(n){var t=e.defer();return navigator.globalization.getDateNames(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},isDayLightSavingsTime:function(n){var t=e.defer();return navigator.globalization.isDayLightSavingsTime(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},numberToString:function(n,t){var o=e.defer();return navigator.globalization.numberToString(n,function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},stringToNumber:function(n,t){var o=e.defer();return navigator.globalization.stringToNumber(n,function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},getNumberPattern:function(n){var t=e.defer();return navigator.globalization.getNumberPattern(function(e){t.resolve(e)},function(e){t.reject(e)},n),t.promise},getCurrencyPattern:function(n){var t=e.defer();return navigator.globalization.getCurrencyPattern(n,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.googleAds",[]).factory("$cordovaGoogleAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.AdMob.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.AdMob.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.AdMob.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.AdMob.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.AdMob.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.AdMob.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.AdMob.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.AdMob.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.googleAnalytics",[]).factory("$cordovaGoogleAnalytics",["$q","$window",function(e,n){return{startTrackerWithId:function(t){var o=e.defer();return n.analytics.startTrackerWithId(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},setUserId:function(t){var o=e.defer();return n.analytics.setUserId(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},debugMode:function(){var t=e.defer();return n.analytics.debugMode(function(e){t.resolve(e)},function(){t.reject()}),t.promise},trackView:function(t){var o=e.defer();return n.analytics.trackView(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},addCustomDimension:function(t,o){var r=e.defer();return n.analytics.addCustomDimension(t,o,function(){r.resolve()},function(e){r.reject(e)}),r.promise},trackEvent:function(t,o,r,i){var a=e.defer();return n.analytics.trackEvent(t,o,r,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},trackException:function(t,o){var r=e.defer();return n.analytics.trackException(t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},trackTiming:function(t,o,r,i){var a=e.defer();return n.analytics.trackTiming(t,o,r,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},addTransaction:function(t,o,r,i,a,c){var u=e.defer();return n.analytics.addTransaction(t,o,r,i,a,c,function(e){u.resolve(e)},function(e){u.reject(e)}),u.promise},addTransactionItem:function(t,o,r,i,a,c,u){var s=e.defer();return n.analytics.addTransactionItem(t,o,r,i,a,c,u,function(e){s.resolve(e)},function(e){s.reject(e)}),s.promise}}}]),angular.module("ngCordova.plugins.googleMap",[]).factory("$cordovaGoogleMap",["$q","$window",function(e,n){var t=null;return{getMap:function(o){var r=e.defer();if(n.plugin.google.maps){var i=document.getElementById("map_canvas");t=n.plugin.google.maps.Map.getMap(o),t.setDiv(i),r.resolve(t)}else r.reject(null);return r.promise},isMapLoaded:function(){return!!t},addMarker:function(n){var o=e.defer();return t.addMarker(n,function(e){o.resolve(e)}),o.promise},getMapTypeIds:function(){return n.plugin.google.maps.mapTypeId},setVisible:function(n){var o=e.defer();return t.setVisible(n),o.promise},cleanup:function(){t=null}}}]),angular.module("ngCordova.plugins.googlePlayGame",[]).factory("$cordovaGooglePlayGame",["$q",function(e){return{auth:function(){var n=e.defer();return googleplaygame.auth(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},signout:function(){var n=e.defer();return googleplaygame.signout(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},isSignedIn:function(){var n=e.defer();return googleplaygame.isSignedIn(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},showPlayer:function(){var n=e.defer();return googleplaygame.showPlayer(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},submitScore:function(n){var t=e.defer();return googleplaygame.submitScore(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},showAllLeaderboards:function(){var n=e.defer();return googleplaygame.showAllLeaderboards(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise},showLeaderboard:function(n){var t=e.defer();return googleplaygame.showLeaderboard(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},unlockAchievement:function(n){var t=e.defer();return googleplaygame.unlockAchievement(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},incrementAchievement:function(n){var t=e.defer();return googleplaygame.incrementAchievement(n,function(e){return t.resolve(e)},function(e){return t.reject(e)}),t.promise},showAchievements:function(){var n=e.defer();return googleplaygame.showAchievements(function(e){return n.resolve(e)},function(e){return n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.googleplus",[]).factory("$cordovaGooglePlus",["$q","$window",function(e,n){return{login:function(t){var o=e.defer();return void 0===t&&(t={}),n.plugins.googleplus.login({iOSApiKey:t},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},silentLogin:function(t){var o=e.defer();return void 0===t&&(t={}),n.plugins.googleplus.trySilentLogin({iOSApiKey:t},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},logout:function(){var t=e.defer();n.plugins.googleplus.logout(function(e){t.resolve(e)})},disconnect:function(){var t=e.defer();n.plugins.googleplus.disconnect(function(e){t.resolve(e)})}}}]),angular.module("ngCordova.plugins.healthKit",[]).factory("$cordovaHealthKit",["$q","$window",function(e,n){return{isAvailable:function(){var t=e.defer();return n.plugins.healthkit.available(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},checkAuthStatus:function(t){var o=e.defer();return t=t||"HKQuantityTypeIdentifierHeight",n.plugins.healthkit.checkAuthStatus({type:t},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},requestAuthorization:function(t,o){var r=e.defer();return t=t||["HKCharacteristicTypeIdentifierDateOfBirth","HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight"],o=o||["HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight","HKQuantityTypeIdentifierDistanceCycling"],n.plugins.healthkit.requestAuthorization({readTypes:t,writeTypes:o},function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},readDateOfBirth:function(){var t=e.defer();return n.plugins.healthkit.readDateOfBirth(function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},readGender:function(){var t=e.defer();return n.plugins.healthkit.readGender(function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},saveWeight:function(t,o,r){var i=e.defer();return n.plugins.healthkit.saveWeight({unit:o||"lb",amount:t,date:r||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readWeight:function(t){var o=e.defer();return n.plugins.healthkit.readWeight({unit:t||"lb"},function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},saveHeight:function(t,o,r){var i=e.defer();return n.plugins.healthkit.saveHeight({unit:o||"in",amount:t,date:r||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readHeight:function(t){var o=e.defer();return n.plugins.healthkit.readHeight({unit:t||"in"},function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},findWorkouts:function(){var t=e.defer();return n.plugins.healthkit.findWorkouts({},function(e){t.resolve(e)},function(e){t.resolve(e)}),t.promise},saveWorkout:function(t){var o=e.defer();return n.plugins.healthkit.saveWorkout(t,function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},querySampleType:function(t){var o=e.defer();return n.plugins.healthkit.querySampleType(t,function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise}}}]),angular.module("ngCordova.plugins.httpd",[]).factory("$cordovaHttpd",["$q",function(e){return{startServer:function(n){var t=e.defer();return cordova.plugins.CorHttpd.startServer(n,function(){t.resolve()},function(){t.reject()}),t.promise},stopServer:function(){var n=e.defer();return cordova.plugins.CorHttpd.stopServer(function(){n.resolve()},function(){n.reject()}),n.promise},getURL:function(){var n=e.defer();return cordova.plugins.CorHttpd.getURL(function(e){n.resolve(e)},function(){n.reject()}),n.promise},getLocalPath:function(){var n=e.defer();return cordova.plugins.CorHttpd.getLocalPath(function(e){n.resolve(e)},function(){n.reject()}),n.promise}}}]),angular.module("ngCordova.plugins.iAd",[]).factory("$cordovaiAd",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.iAd.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.iAd.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.iAd.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.iAd.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.iAd.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.iAd.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.iAd.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.iAd.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.imagePicker",[]).factory("$cordovaImagePicker",["$q","$window",function(e,n){return{getPictures:function(t){var o=e.defer();return n.imagePicker.getPictures(function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise}}}]),angular.module("ngCordova.plugins.inAppBrowser",[]).provider("$cordovaInAppBrowser",[function(){var e,n=this.defaultOptions={};this.setDefaultOptions=function(e){n=angular.extend(n,e)},this.$get=["$rootScope","$q","$window","$timeout",function(t,o,r,i){return{open:function(a,c,u){var s=o.defer();if(u&&!angular.isObject(u))return s.reject("options must be an object"),s.promise;var l=angular.extend({},n,u),f=[];angular.forEach(l,function(e,n){f.push(n+"="+e)});var d=f.join();return e=r.open(a,c,d),e.addEventListener("loadstart",function(e){i(function(){t.$broadcast("$cordovaInAppBrowser:loadstart",e)})},!1),e.addEventListener("loadstop",function(e){s.resolve(e),i(function(){t.$broadcast("$cordovaInAppBrowser:loadstop",e)})},!1),e.addEventListener("loaderror",function(e){s.reject(e),i(function(){t.$broadcast("$cordovaInAppBrowser:loaderror",e)})},!1),e.addEventListener("exit",function(e){i(function(){t.$broadcast("$cordovaInAppBrowser:exit",e)})},!1),s.promise},close:function(){e.close(),e=null},show:function(){e.show()},executeScript:function(n){var t=o.defer();return e.executeScript(n,function(e){t.resolve(e)}),t.promise},insertCSS:function(n){var t=o.defer();return e.insertCSS(n,function(e){t.resolve(e)}),t.promise}}}]}]),angular.module("ngCordova.plugins.insomnia",[]).factory("$cordovaInsomnia",["$window",function(e){return{keepAwake:function(){return e.plugins.insomnia.keepAwake()},allowSleepAgain:function(){return e.plugins.insomnia.allowSleepAgain()}}}]),angular.module("ngCordova.plugins.instagram",[]).factory("$cordovaInstagram",["$q",function(e){return{share:function(n){var t=e.defer();return window.Instagram?(Instagram.share(n.image,n.caption,function(e){e?t.reject(e):t.resolve(!0)}),t.promise):(console.error("Tried to call Instagram.share but the Instagram plugin isn't installed!"),t.resolve(null),t.promise)},isInstalled:function(){var n=e.defer();return window.Instagram?(Instagram.isInstalled(function(e,t){e?n.reject(e):n.resolve(t||!0)}),n.promise):(console.error("Tried to call Instagram.isInstalled but the Instagram plugin isn't installed!"),n.resolve(null),n.promise)}}}]),angular.module("ngCordova.plugins.keyboard",[]).factory("$cordovaKeyboard",["$rootScope","$timeout",function(e){var n=function(){e.$evalAsync(function(){e.$broadcast("$cordovaKeyboard:show")})},t=function(){e.$evalAsync(function(){e.$broadcast("$cordovaKeyboard:hide")})};return document.addEventListener("deviceready",function(){cordova.plugins.Keyboard&&(window.addEventListener("native.keyboardshow",n,!1),window.addEventListener("native.keyboardhide",t,!1))}),{hideAccessoryBar:function(e){return cordova.plugins.Keyboard.hideKeyboardAccessoryBar(e)},close:function(){return cordova.plugins.Keyboard.close()},show:function(){return cordova.plugins.Keyboard.show()},disableScroll:function(e){return cordova.plugins.Keyboard.disableScroll(e)},isVisible:function(){return cordova.plugins.Keyboard.isVisible},clearShowWatch:function(){document.removeEventListener("native.keyboardshow",n),e.$$listeners["$cordovaKeyboard:show"]=[]},clearHideWatch:function(){document.removeEventListener("native.keyboardhide",t),e.$$listeners["$cordovaKeyboard:hide"]=[]}}}]),angular.module("ngCordova.plugins.keychain",[]).factory("$cordovaKeychain",["$q",function(e){return{getForKey:function(n,t){var o=e.defer(),r=new Keychain;return r.getForKey(o.resolve,o.reject,n,t),o.promise},setForKey:function(n,t,o){var r=e.defer(),i=new Keychain;return i.setForKey(r.resolve,r.reject,n,t,o),r.promise},removeForKey:function(n,t){var o=e.defer(),r=new Keychain;return r.removeForKey(o.resolve,o.reject,n,t),o.promise}}}]),angular.module("ngCordova.plugins.localNotification",[]).factory("$cordovaLocalNotification",["$q","$window","$rootScope","$timeout",function(e,n,t,o){return document.addEventListener("deviceready",function(){n.cordova&&n.cordova.plugins&&n.cordova.plugins.notification&&n.cordova.plugins.notification.local&&(n.cordova.plugins.notification.local.on("schedule",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:schedule",e,n)})}),n.cordova.plugins.notification.local.on("trigger",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:trigger",e,n)})}),n.cordova.plugins.notification.local.on("update",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:update",e,n)})}),n.cordova.plugins.notification.local.on("clear",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:clear",e,n)})}),n.cordova.plugins.notification.local.on("clearall",function(e){o(function(){t.$broadcast("$cordovaLocalNotification:clearall",e)})}),n.cordova.plugins.notification.local.on("cancel",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:cancel",e,n)})}),n.cordova.plugins.notification.local.on("cancelall",function(e){o(function(){t.$broadcast("$cordovaLocalNotification:cancelall",e)})}),n.cordova.plugins.notification.local.on("click",function(e,n){o(function(){t.$broadcast("$cordovaLocalNotification:click",e,n)})}))},!1),{schedule:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.schedule(t,function(e){r.resolve(e)},o),r.promise},add:function(t,o){console.warn('Deprecated: use "schedule" instead.');var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.schedule(t,function(e){r.resolve(e)},o),r.promise},update:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.update(t,function(e){r.resolve(e)},o),r.promise},clear:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.clear(t,function(e){r.resolve(e)},o),r.promise},clearAll:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.clearAll(function(e){o.resolve(e)},t),o.promise},cancel:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.cancel(t,function(e){r.resolve(e)},o),r.promise},cancelAll:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.cancelAll(function(e){o.resolve(e)},t),o.promise},isPresent:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.isPresent(t,function(e){r.resolve(e)},o),r.promise},isScheduled:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.isScheduled(t,function(e){r.resolve(e)},o),r.promise},isTriggered:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.isTriggered(t,function(e){r.resolve(e)},o),r.promise},hasPermission:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.hasPermission(function(e){e?o.resolve(e):o.reject(e)},t),o.promise},registerPermission:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.registerPermission(function(e){e?o.resolve(e):o.reject(e)},t),o.promise},promptForPermission:function(t){console.warn('Deprecated: use "registerPermission" instead.');var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.registerPermission(function(e){e?o.resolve(e):o.reject(e)},t),o.promise},getAllIds:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getAllIds(function(e){o.resolve(e)},t),o.promise},getIds:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getIds(function(e){o.resolve(e)},t),o.promise},getScheduledIds:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getScheduledIds(function(e){o.resolve(e)},t),o.promise},getTriggeredIds:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getTriggeredIds(function(e){o.resolve(e)},t),o.promise},get:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.get(t,function(e){r.resolve(e)},o),r.promise},getAll:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getAll(function(e){o.resolve(e)},t),o.promise},getScheduled:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.getScheduled(t,function(e){r.resolve(e)},o),r.promise},getAllScheduled:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getAllScheduled(function(e){o.resolve(e)},t),o.promise},getTriggered:function(t,o){var r=e.defer();return o=o||null,n.cordova.plugins.notification.local.getTriggered(t,function(e){r.resolve(e)},o),r.promise},getAllTriggered:function(t){var o=e.defer();return t=t||null,n.cordova.plugins.notification.local.getAllTriggered(function(e){o.resolve(e)},t),o.promise},getDefaults:function(){return n.cordova.plugins.notification.local.getDefaults()},setDefaults:function(e){n.cordova.plugins.notification.local.setDefaults(e)}}}]),angular.module("ngCordova.plugins.mMediaAds",[]).factory("$cordovaMMediaAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.mMedia.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.mMedia.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.mMedia.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.mMedia.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.mMedia.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.mMedia.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.mMedia.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.mMedia.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.media",[]).factory("$cordovaMedia",["$q",function(e){return{newMedia:function(n){var t,o=e.defer(),r=null;return t=new Media(n,function(e){o.resolve(e)},function(e){o.reject(e)},function(e){r=e}),o.promise.getCurrentPosition=function(){t.getCurrentPosition(function(){},function(){})},o.promise.getDuration=function(){t.getDuration()},o.promise.play=function(e){"object"!=typeof e&&(e={}),t.play(e)},o.promise.pause=function(){t.pause()},o.promise.stop=function(){t.stop()},o.promise.release=function(){t.release()},o.promise.seekTo=function(e){t.seekTo(e)},o.promise.setVolume=function(e){t.setVolume(e)},o.promise.startRecord=function(){t.startRecord()},o.promise.stopRecord=function(){t.stopRecord()},o.promise.media=t,o.promise}}}]),angular.module("ngCordova.plugins.mobfoxAds",[]).factory("$cordovaMobFoxAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.MobFox.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.MobFox.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.MobFox.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.MobFox.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.MobFox.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.MobFox.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.MobFox.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.MobFox.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins",["ngCordova.plugins.actionSheet","ngCordova.plugins.adMob","ngCordova.plugins.appAvailability","ngCordova.plugins.appRate","ngCordova.plugins.appVersion","ngCordova.plugins.backgroundGeolocation","ngCordova.plugins.badge","ngCordova.plugins.barcodeScanner","ngCordova.plugins.batteryStatus","ngCordova.plugins.ble","ngCordova.plugins.bluetoothSerial","ngCordova.plugins.brightness","ngCordova.plugins.calendar","ngCordova.plugins.camera","ngCordova.plugins.capture","ngCordova.plugins.clipboard","ngCordova.plugins.contacts","ngCordova.plugins.datePicker","ngCordova.plugins.device","ngCordova.plugins.deviceMotion","ngCordova.plugins.deviceOrientation","ngCordova.plugins.dialogs","ngCordova.plugins.emailComposer","ngCordova.plugins.facebook","ngCordova.plugins.facebookAds","ngCordova.plugins.file","ngCordova.plugins.fileTransfer","ngCordova.plugins.fileOpener2","ngCordova.plugins.flashlight","ngCordova.plugins.flurryAds","ngCordova.plugins.ga","ngCordova.plugins.geolocation","ngCordova.plugins.globalization","ngCordova.plugins.googleAds","ngCordova.plugins.googleAnalytics","ngCordova.plugins.googleMap","ngCordova.plugins.googlePlayGame","ngCordova.plugins.healthKit","ngCordova.plugins.httpd","ngCordova.plugins.iAd","ngCordova.plugins.imagePicker","ngCordova.plugins.inAppBrowser","ngCordova.plugins.keyboard","ngCordova.plugins.keychain","ngCordova.plugins.localNotification","ngCordova.plugins.media","ngCordova.plugins.mMediaAds","ngCordova.plugins.mobfoxAds","ngCordova.plugins.mopubAds","ngCordova.plugins.nativeAudio","ngCordova.plugins.network","ngCordova.plugins.oauth","ngCordova.plugins.oauthUtility","ngCordova.plugins.pinDialog","ngCordova.plugins.prefs","ngCordova.plugins.printer","ngCordova.plugins.progressIndicator","ngCordova.plugins.push","ngCordova.plugins.sms","ngCordova.plugins.socialSharing","ngCordova.plugins.spinnerDialog","ngCordova.plugins.splashscreen","ngCordova.plugins.sqlite","ngCordova.plugins.statusbar","ngCordova.plugins.toast","ngCordova.plugins.touchid","ngCordova.plugins.vibration","ngCordova.plugins.videoCapturePlus","ngCordova.plugins.zip","ngCordova.plugins.insomnia"]),angular.module("ngCordova.plugins.mopubAds",[]).factory("$cordovaMoPubAds",["$q","$window",function(e,n){return{setOptions:function(t){var o=e.defer();return n.MoPub.setOptions(t,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(t){var o=e.defer();return n.MoPub.createBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var t=e.defer();return n.MoPub.removeBanner(function(){t.resolve()},function(){t.reject()}),t.promise},showBanner:function(t){var o=e.defer();return n.MoPub.showBanner(t,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(t,o){var r=e.defer();return n.MoPub.showBannerAtXY(t,o,function(){r.resolve()},function(){r.reject()}),r.promise},hideBanner:function(){var t=e.defer();return n.MoPub.hideBanner(function(){t.resolve()},function(){t.reject()}),t.promise},prepareInterstitial:function(t){var o=e.defer();return n.MoPub.prepareInterstitial(t,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var t=e.defer();return n.MoPub.showInterstitial(function(){t.resolve()},function(){t.reject()}),t.promise}}}]),angular.module("ngCordova.plugins.nativeAudio",[]).factory("$cordovaNativeAudio",["$q","$window",function(e,n){return{preloadSimple:function(t,o){var r=e.defer();return n.plugins.NativeAudio.preloadSimple(t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},preloadComplex:function(t,o,r,i){var a=e.defer();return n.plugins.NativeAudio.preloadComplex(t,o,r,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},play:function(t,o){var r=e.defer();return n.plugins.NativeAudio.play(t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},stop:function(t){var o=e.defer();return n.plugins.NativeAudio.stop(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},loop:function(t){var o=e.defer();return n.plugins.NativeAudio.loop(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},unload:function(t){var o=e.defer();return n.plugins.NativeAudio.unload(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},setVolumeForComplexAsset:function(t,o){var r=e.defer();return n.plugins.NativeAudio.setVolumeForComplexAsset(t,o,function(e){r.resolve(e) +},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.network",[]).factory("$cordovaNetwork",["$rootScope","$timeout",function(e,n){var t=function(){var t=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:offline",t)})},o=function(){var t=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:online",t)})};return document.addEventListener("deviceready",function(){navigator.connection&&(document.addEventListener("offline",t,!1),document.addEventListener("online",o,!1))}),{getNetwork:function(){return navigator.connection.type},isOnline:function(){var e=navigator.connection.type;return e!==Connection.UNKNOWN&&e!==Connection.NONE},isOffline:function(){var e=navigator.connection.type;return e===Connection.UNKNOWN||e===Connection.NONE},clearOfflineWatch:function(){document.removeEventListener("offline",t),e.$$listeners["$cordovaNetwork:offline"]=[]},clearOnlineWatch:function(){document.removeEventListener("online",t),e.$$listeners["$cordovaNetwork:online"]=[]}}}]).run(["$cordovaNetwork",function(){}]),angular.module("ngCordova.plugins.oauth",["ngCordova.plugins.oauthUtility"]).factory("$cordovaOauth",["$q","$http","$cordovaOauthUtility",function(e,n,t){return{adfs:function(t,o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open(o+"/adfs/oauth2/authorize?response_type=code&client_id="+t+"&redirect_uri=http://localhost/callback&resource="+r,"_blank","location=no");c.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){var r=e.url.split("code=")[1];n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:o+"/adfs/oauth2/token",data:"client_id="+t+"&code="+r+"&redirect_uri=http://localhost/callback&grant_type=authorization_code"}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)})}}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},dropbox:function(n){var t=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var r=window.open("https://www.dropbox.com/1/oauth2/authorize?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");r.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],o=n.split("&"),i=[],a=0;a<o.length;a++)i[o[a].split("=")[0]]=o[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve({access_token:i.access_token,token_type:i.token_type,uid:i.uid}):t.reject("Problem authenticating"),setTimeout(function(){r.close()},10)}}),r.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},digitalOcean:function(t,o){var r=e.defer();if(window.cordova){var i=cordova.require("cordova/plugin_list").metadata;if(i.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var a=window.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&response_type=code&scope=read%20write","_blank","location=no,clearsessioncache=yes,clearcache=yes");a.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){var i=e.url.split("code=")[1];n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://cloud.digitalocean.com/v1/oauth/token",data:"client_id="+t+"&client_secret="+o+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+i}).success(function(e){r.resolve(e)}).error(function(){r.reject("Problem authenticating")}).finally(function(){setTimeout(function(){a.close()},10)})}}),a.addEventListener("exit",function(){r.reject("The sign in flow was canceled")})}else r.reject("Could not find InAppBrowser plugin")}else r.reject("Cannot authenticate via a web browser");return r.promise},google:function(n,t){var o=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://accounts.google.com/o/oauth2/auth?client_id="+n+"&redirect_uri=http://localhost/callback&scope="+t.join(" ")+"&approval_prompt=force&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),r=[],a=0;a<t.length;a++)r[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==r.access_token&&null!==r.access_token?o.resolve({access_token:r.access_token,token_type:r.token_type,expires_in:r.expires_in}):o.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){o.reject("The sign in flow was canceled")})}else o.reject("Could not find InAppBrowser plugin")}else o.reject("Cannot authenticate via a web browser");return o.promise},github:function(t,o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://github.com/login/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+r.join(","),"_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n.defaults.headers.post.accept="application/json",n({method:"post",url:"https://github.com/login/oauth/access_token",data:"client_id="+t+"&client_secret="+o+"&redirect_uri=http://localhost/callback&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},facebook:function(n,t){var o=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://www.facebook.com/dialog/oauth?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token&scope="+t.join(","),"_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),r=[],a=0;a<t.length;a++)r[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==r.access_token&&null!==r.access_token?o.resolve({access_token:r.access_token,expires_in:r.expires_in}):o.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){o.reject("The sign in flow was canceled")})}else o.reject("Could not find InAppBrowser plugin")}else o.reject("Cannot authenticate via a web browser");return o.promise},linkedin:function(t,o,r,i){var a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var u=window.open("https://www.linkedin.com/uas/oauth2/authorization?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+r.join(" ")+"&response_type=code&state="+i,"_blank","location=no,clearsessioncache=yes,clearcache=yes");u.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://www.linkedin.com/uas/oauth2/accessToken",data:"client_id="+t+"&client_secret="+o+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){a.resolve(e)}).error(function(){a.reject("Problem authenticating")}).finally(function(){setTimeout(function(){u.close()},10)}))}),u.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},instagram:function(n,t){var o=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://api.instagram.com/oauth/authorize/?client_id="+n+"&redirect_uri=http://localhost/callback&scope="+t.join(" ")+"&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],t=n.split("&"),r=[],a=0;a<t.length;a++)r[t[a].split("=")[0]]=t[a].split("=")[1];void 0!==r.access_token&&null!==r.access_token?o.resolve({access_token:r.access_token}):o.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){o.reject("The sign in flow was canceled")})}else o.reject("Could not find InAppBrowser plugin")}else o.reject("Cannot authenticate via a web browser");return o.promise},box:function(t,o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://app.box.com/api/oauth2/authorize/?client_id="+t+"&redirect_uri=http://localhost/callback&state="+r+"&response_type=code","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://app.box.com/api/oauth2/token",data:"client_id="+t+"&client_secret="+o+"&redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},reddit:function(t,o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://ssl.reddit.com/api/v1/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&duration=permanent&state=ngcordovaoauth&scope="+r.join(",")+"&response_type=code","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n.defaults.headers.post.Authorization="Basic "+btoa(t+":"+o),n({method:"post",url:"https://ssl.reddit.com/api/v1/access_token",data:"redirect_uri=http://localhost/callback&grant_type=authorization_code&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},twitter:function(o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0)if("undefined"!=typeof jsSHA){var c={oauth_consumer_key:o,oauth_nonce:t.createNonce(10),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:Math.round((new Date).getTime()/1e3),oauth_version:"1.0"},u=t.createSignature("POST","https://api.twitter.com/oauth/request_token",c,{oauth_callback:"http://localhost/callback"},r);n({method:"post",url:"https://api.twitter.com/oauth/request_token",headers:{Authorization:u.authorization_header,"Content-Type":"application/x-www-form-urlencoded"},data:"oauth_callback="+encodeURIComponent("http://localhost/callback")}).success(function(e){for(var o=e.split("&"),a={},u=0;u<o.length;u++)a[o[u].split("=")[0]]=o[u].split("=")[1];a.hasOwnProperty("oauth_token")===!1&&i.reject("Oauth request token was not received");var s=window.open("https://api.twitter.com/oauth/authenticate?oauth_token="+a.oauth_token,"_blank","location=no,clearsessioncache=yes,clearcache=yes");s.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var o=e.url.split("?")[1],a=o.split("&"),u={},l=0;l<a.length;l++)u[a[l].split("=")[0]]=a[l].split("=")[1];u.hasOwnProperty("oauth_verifier")===!1&&i.reject("Browser authentication failed to complete. No oauth_verifier was returned"),delete c.oauth_signature,c.oauth_token=u.oauth_token;var f=t.createSignature("POST","https://api.twitter.com/oauth/access_token",c,{oauth_verifier:u.oauth_verifier},r);n({method:"post",url:"https://api.twitter.com/oauth/access_token",headers:{Authorization:f.authorization_header},params:{oauth_verifier:u.oauth_verifier}}).success(function(e){for(var n=e.split("&"),t={},o=0;o<n.length;o++)t[n[o].split("=")[0]]=n[o].split("=")[1];t.hasOwnProperty("oauth_token_secret")===!1&&i.reject("Oauth access token was not received"),i.resolve(t)}).error(function(e){i.reject(e)}).finally(function(){setTimeout(function(){s.close()},10)})}}),s.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}).error(function(e){i.reject(e)})}else i.reject("Missing jsSHA JavaScript library");else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},meetup:function(n){var t=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var r=window.open("https://secure.meetup.com/oauth2/authorize/?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");r.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],o=n.split("&"),i={},a=0;a<o.length;a++)i[o[a].split("=")[0]]=o[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve(i):t.reject("Problem authenticating"),setTimeout(function(){r.close()},10)}}),r.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},salesforce:function(n,t){var o="http://localhost/callback",r=function(e,n,t){return e+"services/oauth2/authorize?display=touch&response_type=token&client_id="+escape(n)+"&redirect_uri="+escape(t)},i=function(e,n){return e.substr(0,n.length)===n},a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var u=window.open(r(n,t,o),"_blank","location=no,clearsessioncache=yes,clearcache=yes");u.addEventListener("loadstart",function(e){if(i(e.url,o)){var n={},t=e.url.split("#")[1];if(t){var r=t.split("&");for(var c in r){var s=r[c].split("=");n[s[0]]=unescape(s[1])}}"undefined"==typeof n||"undefined"==typeof n.access_token?a.reject("Problem authenticating"):a.resolve(n),setTimeout(function(){u.close()},10)}}),u.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},strava:function(t,o,r){var i=e.defer();if(window.cordova){var a=cordova.require("cordova/plugin_list").metadata;if(a.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var c=window.open("https://www.strava.com/oauth/authorize?client_id="+t+"&redirect_uri=http://localhost/callback&scope="+r.join(",")+"&response_type=code&approval_prompt=force","_blank","location=no,clearsessioncache=yes,clearcache=yes");c.addEventListener("loadstart",function(e){0===e.url.indexOf("http://localhost/callback")&&(requestToken=e.url.split("code=")[1],n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:"https://www.strava.com/oauth/token",data:"client_id="+t+"&client_secret="+o+"&code="+requestToken}).success(function(e){i.resolve(e)}).error(function(){i.reject("Problem authenticating")}).finally(function(){setTimeout(function(){c.close()},10)}))}),c.addEventListener("exit",function(){i.reject("The sign in flow was canceled")})}else i.reject("Could not find InAppBrowser plugin")}else i.reject("Cannot authenticate via a web browser");return i.promise},foursquare:function(n){var t=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var r=window.open("https://foursquare.com/oauth2/authenticate?client_id="+n+"&redirect_uri=http://localhost/callback&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");r.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var n=e.url.split("#")[1],o=n.split("&"),i=[],a=0;a<o.length;a++)i[o[a].split("=")[0]]=o[a].split("=")[1];if(void 0!==i.access_token&&null!==i.access_token){var c={access_token:i.access_token,expires_in:i.expires_in};t.resolve(c)}else t.reject("Problem authenticating");setTimeout(function(){r.close()},10)}}),r.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise},magento:function(o,r,i){var a=e.defer();if(window.cordova){var c=cordova.require("cordova/plugin_list").metadata;if(c.hasOwnProperty("org.apache.cordova.inappbrowser")===!0)if("undefined"!=typeof jsSHA){var u={oauth_callback:"http://localhost/callback",oauth_consumer_key:r,oauth_nonce:t.createNonce(5),oauth_signature_method:"HMAC-SHA1",oauth_timestamp:Math.round((new Date).getTime()/1e3),oauth_version:"1.0"},s=t.createSignature("POST",o+"/oauth/initiate",u,{oauth_callback:"http://localhost/callback"},i);n.defaults.headers.post.Authorization=s.authorization_header,n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:o+"/oauth/initiate",data:"oauth_callback=http://localhost/callback"}).success(function(e){for(var r=e.split("&"),c={},s=0;s<r.length;s++)c[r[s].split("=")[0]]=r[s].split("=")[1];c.hasOwnProperty("oauth_token")===!1&&a.reject("Oauth request token was not received");var l=c.oauth_token_secret,f=window.open(o+"/oauth/authorize?oauth_token="+c.oauth_token,"_blank","location=no,clearsessioncache=yes,clearcache=yes");f.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){for(var r=e.url.split("?")[1],c=r.split("&"),s={},d=0;d<c.length;d++)s[c[d].split("=")[0]]=c[d].split("=")[1];s.hasOwnProperty("oauth_verifier")===!1&&a.reject("Browser authentication failed to complete. No oauth_verifier was returned"),delete u.oauth_signature,delete u.oauth_callback,u.oauth_token=s.oauth_token,u.oauth_nonce=t.createNonce(5),u.oauth_verifier=s.oauth_verifier;var p=t.createSignature("POST",o+"/oauth/token",u,{},i,l);n.defaults.headers.post.Authorization=p.authorization_header,n.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded",n({method:"post",url:o+"/oauth/token"}).success(function(e){for(var n=e.split("&"),t={},o=0;o<n.length;o++)t[n[o].split("=")[0]]=n[o].split("=")[1];t.hasOwnProperty("oauth_token_secret")===!1&&a.reject("Oauth access token was not received"),a.resolve(t)}).error(function(e){a.reject(e)}).finally(function(){setTimeout(function(){f.close()},10)})}}),f.addEventListener("exit",function(){a.reject("The sign in flow was canceled")})}).error(function(e){a.reject(e)})}else a.reject("Missing jsSHA JavaScript library");else a.reject("Could not find InAppBrowser plugin")}else a.reject("Cannot authenticate via a web browser");return a.promise},vkontakte:function(n,t){var o=e.defer();if(window.cordova){var r=cordova.require("cordova/plugin_list").metadata;if(r.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var i=window.open("https://oauth.vk.com/authorize?client_id="+n+"&redirect_uri=http://oauth.vk.com/blank.html&response_type=token&scope="+t.join(",")+"&display=touch&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");i.addEventListener("loadstart",function(e){var n=e.url.split("#");if("https://oauth.vk.com/blank.html"==n[0]||"http://oauth.vk.com/blank.html"==n[0]){for(var t=e.url.split("#")[1],r=t.split("&"),a=[],c=0;c<r.length;c++)a[r[c].split("=")[0]]=r[c].split("=")[1];void 0!==a.access_token&&null!==a.access_token?o.resolve({access_token:a.access_token,expires_in:a.expires_in,user_id:a.user_id}):o.reject("Problem authenticating"),setTimeout(function(){i.close()},10)}}),i.addEventListener("exit",function(){o.reject("The sign in flow was canceled")})}else o.reject("Could not find InAppBrowser plugin")}else o.reject("Cannot authenticate via a web browser");return o.promise},imgur:function(n){var t=e.defer();if(window.cordova){var o=cordova.require("cordova/plugin_list").metadata;if(o.hasOwnProperty("org.apache.cordova.inappbrowser")===!0){var r=window.open("https://api.imgur.com/oauth2/authorize?client_id="+n+"&response_type=token","_blank","location=no,clearsessioncache=yes,clearcache=yes");r.addEventListener("loadstart",function(e){if(0===e.url.indexOf("http://localhost/callback")){r.removeEventListener("exit",function(){}),r.close();for(var n=e.url.split("#")[1],o=n.split("&"),i=[],a=0;a<o.length;a++)i[o[a].split("=")[0]]=o[a].split("=")[1];void 0!==i.access_token&&null!==i.access_token?t.resolve({access_token:i.access_token,expires_in:i.expires_in,account_username:i.account_username}):t.reject("Problem authenticating")}}),r.addEventListener("exit",function(){t.reject("The sign in flow was canceled")})}else t.reject("Could not find InAppBrowser plugin")}else t.reject("Cannot authenticate via a web browser");return t.promise}}}]),angular.module("ngCordova.plugins.oauthUtility",[]).factory("$cordovaOauthUtility",["$q",function(){return{createSignature:function(e,n,t,o,r,i){if("undefined"!=typeof jsSHA){for(var a=angular.copy(t),c=Object.keys(o),u=0;u<c.length;u++)a[c[u]]=encodeURIComponent(o[c[u]]);var s=e+"&"+encodeURIComponent(n)+"&",l=Object.keys(a).sort();for(u=0;u<l.length;u++)s+=encodeURIComponent(u==l.length-1?l[u]+"="+a[l[u]]:l[u]+"="+a[l[u]]+"&");var f=new jsSHA(s,"TEXT"),d="";i&&(d=encodeURIComponent(i)),t.oauth_signature=encodeURIComponent(f.getHMAC(encodeURIComponent(r)+"&"+d,"TEXT","SHA-1","B64"));var p=Object.keys(t),v="OAuth ";for(u=0;u<p.length;u++)v+=u==p.length-1?p[u]+'="'+t[p[u]]+'"':p[u]+'="'+t[p[u]]+'",';return{signature_base_string:s,authorization_header:v,signature:t.oauth_signature}}return"Missing jsSHA JavaScript library"},createNonce:function(e){for(var n="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=0;e>o;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n}}}]),angular.module("ngCordova.plugins.pinDialog",[]).factory("$cordovaPinDialog",["$q","$window",function(e,n){return{prompt:function(t,o,r){var i=e.defer();return n.plugins.pinDialog.prompt(t,function(e){i.resolve(e)},o,r),i.promise}}}]),angular.module("ngCordova.plugins.prefs",[]).factory("$cordovaPreferences",["$window","$q",function(e,n){return{set:function(t,o){var r=n.defer();return e.appgiraffe.plugins.applicationPreferences.set(t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},get:function(t){var o=n.defer();return e.appgiraffe.plugins.applicationPreferences.get(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.printer",[]).factory("$cordovaPrinter",["$q","$window",function(e,n){return{isAvailable:function(){var t=e.defer();return n.plugin.printer.isAvailable(function(e){t.resolve(e)}),t.promise},print:function(t,o){var r=e.defer();return n.plugin.printer.print(t,o,function(){r.resolve()}),r.promise}}}]),angular.module("ngCordova.plugins.progressIndicator",[]).factory("$cordovaProgress",["$q",function(){return{show:function(e){var n=e||"Please wait...";return ProgressIndicator.show(n)},showSimple:function(e){var n=e||!1;return ProgressIndicator.showSimple(n)},showSimpleWithLabel:function(e,n){var t=e||!1,o=n||"Loading...";return ProgressIndicator.showSimpleWithLabel(t,o)},showSimpleWithLabelDetail:function(e,n,t){var o=e||!1,r=n||"Loading...",i=t||"Please wait";return ProgressIndicator.showSimpleWithLabelDetail(o,r,i)},showDeterminate:function(e,n){var t=e||!1,o=n||5e4;return ProgressIndicator.showDeterminate(t,o)},showDeterminateWithLabel:function(e,n,t){var o=e||!1,r=n||5e4,i=t||"Loading...";return ProgressIndicator.showDeterminateWithLabel(o,r,i)},showAnnular:function(e,n){var t=e||!1,o=n||5e4;return ProgressIndicator.showAnnular(t,o)},showAnnularWithLabel:function(e,n,t){var o=e||!1,r=n||5e4,i=t||"Loading...";return ProgressIndicator.showAnnularWithLabel(o,r,i)},showBar:function(e,n){var t=e||!1,o=n||5e4;return ProgressIndicator.showBar(t,o)},showBarWithLabel:function(e,n,t){var o=e||!1,r=n||5e4,i=t||"Loading...";return ProgressIndicator.showBarWithLabel(o,r,i)},showSuccess:function(e,n){var t=e||!1,o=n||"Success";return ProgressIndicator.showSuccess(t,o)},showText:function(e,n,t){var o=e||!1,r=n||"Warning",i=t||"center";return ProgressIndicator.showText(o,r,i)},hide:function(){return ProgressIndicator.hide()}}}]),angular.module("ngCordova.plugins.push",[]).factory("$cordovaPush",["$q","$window","$rootScope","$timeout",function(e,n,t,o){return{onNotification:function(e){o(function(){t.$broadcast("$cordovaPush:notificationReceived",e)})},register:function(t){var o,r=e.defer();return void 0!==t&&void 0===t.ecb&&(o=null===document.querySelector("[ng-app]")?"document.body":"document.querySelector('[ng-app]')",t.ecb="angular.element("+o+").injector().get('$cordovaPush').onNotification"),n.plugins.pushNotification.register(function(e){r.resolve(e)},function(e){r.reject(e)},t),r.promise},unregister:function(t){var o=e.defer();return n.plugins.pushNotification.unregister(function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise},setBadgeNumber:function(t){var o=e.defer();return n.plugins.pushNotification.setApplicationIconBadgeNumber(function(e){o.resolve(e)},function(e){o.reject(e)},t),o.promise}}}]),angular.module("ngCordova.plugins.sms",[]).factory("$cordovaSms",["$q",function(e){return{send:function(n,t,o){var r=e.defer();return sms.send(n,t,o,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.socialSharing",[]).factory("$cordovaSocialSharing",["$q","$window",function(e,n){return{share:function(t,o,r,i){var a=e.defer();return o=o||null,r=r||null,i=i||null,n.plugins.socialsharing.share(t,o,r,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaTwitter:function(t,o,r){var i=e.defer();return o=o||null,r=r||null,n.plugins.socialsharing.shareViaTwitter(t,o,r,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaWhatsApp:function(t,o,r){var i=e.defer();return o=o||null,r=r||null,n.plugins.socialsharing.shareViaWhatsApp(t,o,r,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebook:function(t,o,r){var i=e.defer();return t=t||null,o=o||null,r=r||null,n.plugins.socialsharing.shareViaFacebook(t,o,r,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebookWithPasteMessageHint:function(t,o,r,i){var a=e.defer();return o=o||null,r=r||null,n.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(t,o,r,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaSMS:function(t,o){var r=e.defer();return n.plugins.socialsharing.shareViaSMS(t,o,function(){r.resolve(!0)},function(){r.reject(!1)}),r.promise},shareViaEmail:function(t,o,r,i,a,c){var u=e.defer();return r=r||null,i=i||null,a=a||null,c=c||null,n.plugins.socialsharing.shareViaEmail(t,o,r,i,a,c,function(){u.resolve(!0)},function(){u.reject(!1)}),u.promise},shareVia:function(t,o,r,i,a){var c=e.defer();return o=o||null,r=r||null,i=i||null,a=a||null,n.plugins.socialsharing.shareVia(t,o,r,i,a,function(){c.resolve(!0)},function(){c.reject(!1)}),c.promise},canShareViaEmail:function(){var t=e.defer();return n.plugins.socialsharing.canShareViaEmail(function(){t.resolve(!0)},function(){t.reject(!1)}),t.promise},canShareVia:function(t,o,r,i,a){var c=e.defer();return n.plugins.socialsharing.canShareVia(t,o,r,i,a,function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise},available:function(){var n=e.defer();window.plugins.socialsharing.available(function(e){e?n.resolve():n.reject()})}}}]),angular.module("ngCordova.plugins.spinnerDialog",[]).factory("$cordovaSpinnerDialog",["$window",function(e){return{show:function(n,t,o){return o=o||!1,e.plugins.spinnerDialog.show(n,t,o)},hide:function(){return e.plugins.spinnerDialog.hide()}}}]),angular.module("ngCordova.plugins.splashscreen",[]).factory("$cordovaSplashscreen",[function(){return{hide:function(){return navigator.splashscreen.hide()},show:function(){return navigator.splashscreen.show()}}}]),angular.module("ngCordova.plugins.sqlite",[]).factory("$cordovaSQLite",["$q","$window",function(e,n){return{openDB:function(e,t){return"undefined"==typeof t&&(t=0),n.sqlitePlugin.openDatabase({name:e,bgType:t})},execute:function(n,t,o){var r=e.defer();return n.transaction(function(e){e.executeSql(t,o,function(e,n){r.resolve(n)},function(e,n){r.reject(n)})}),r.promise},insertCollection:function(n,t,o){var r=e.defer(),i=o.slice(0);return n.transaction(function(e){!function n(){var o=i.splice(0,1)[0];try{e.executeSql(t,o,function(e,t){0===i.length?r.resolve(t):n()},function(e,n){r.reject(n)})}catch(a){r.reject(a)}}()}),r.promise},nestedExecute:function(n,t,o,r,i){var a=e.defer();return n.transaction(function(e){e.executeSql(t,r,function(e,n){a.resolve(n),e.executeSql(o,i,function(e,n){a.resolve(n)})})},function(e,n){a.reject(n)}),a.promise},deleteDB:function(t){var o=e.defer();return n.sqlitePlugin.deleteDatabase(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise}}}]),angular.module("ngCordova.plugins.statusbar",[]).factory("$cordovaStatusbar",[function(){return{overlaysWebView:function(e){return StatusBar.overlaysWebView(!!e)},STYLES:{DEFAULT:0,LIGHT_CONTENT:1,BLACK_TRANSLUCENT:2,BLACK_OPAQUE:3},style:function(e){switch(e){case 0:return StatusBar.styleDefault();case 1:return StatusBar.styleLightContent();case 2:return StatusBar.styleBlackTranslucent();case 3:return StatusBar.styleBlackOpaque();default:return StatusBar.styleDefault()}},styleColor:function(e){return StatusBar.backgroundColorByName(e)},styleHex:function(e){return StatusBar.backgroundColorByHexString(e)},hide:function(){return StatusBar.hide()},show:function(){return StatusBar.show()},isVisible:function(){return StatusBar.isVisible}}}]),angular.module("ngCordova.plugins.toast",[]).factory("$cordovaToast",["$q","$window",function(e,n){return{showShortTop:function(t){var o=e.defer();return n.plugins.toast.showShortTop(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showShortCenter:function(t){var o=e.defer();return n.plugins.toast.showShortCenter(t,function(e){o.resolve(e) +},function(e){o.reject(e)}),o.promise},showShortBottom:function(t){var o=e.defer();return n.plugins.toast.showShortBottom(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongTop:function(t){var o=e.defer();return n.plugins.toast.showLongTop(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongCenter:function(t){var o=e.defer();return n.plugins.toast.showLongCenter(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongBottom:function(t){var o=e.defer();return n.plugins.toast.showLongBottom(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},show:function(t,o,r){var i=e.defer();return n.plugins.toast.show(t,o,r,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise}}}]),angular.module("ngCordova.plugins.touchid",[]).factory("$cordovaTouchID",["$q",function(e){return{checkSupport:function(){var n=e.defer();return window.cordova?touchid.checkSupport(function(e){n.resolve(e)},function(e){n.reject(e)}):n.reject("Not supported without cordova.js"),n.promise},authenticate:function(n){var t=e.defer();return window.cordova?touchid.authenticate(function(e){t.resolve(e)},function(e){t.reject(e)},n):t.reject("Not supported without cordova.js"),t.promise}}}]),angular.module("ngCordova.plugins.vibration",[]).factory("$cordovaVibration",[function(){return{vibrate:function(e){return navigator.notification.vibrate(e)},vibrateWithPattern:function(e,n){return navigator.notification.vibrateWithPattern(e,n)},cancelVibration:function(){return navigator.notification.cancelVibration()}}}]),angular.module("ngCordova.plugins.videoCapturePlus",[]).provider("$cordovaVideoCapturePlus",[function(){var e={};this.setLimit=function(n){e.limit=n},this.setMaxDuration=function(n){e.duration=n},this.setHighQuality=function(n){e.highquality=n},this.useFrontCamera=function(n){e.frontcamera=n},this.setPortraitOverlay=function(n){e.portraitOverlay=n},this.setLandscapeOverlay=function(n){e.landscapeOverlay=n},this.setOverlayText=function(n){e.overlayText=n},this.$get=["$q","$window",function(n,t){return{captureVideo:function(o){var r=n.defer();return t.plugins.videocaptureplus?(t.plugins.videocaptureplus.captureVideo(r.resolve,r.reject,angular.extend({},e,o)),r.promise):(r.resolve(null),r.promise)}}}]}]),angular.module("ngCordova.plugins.zip",[]).factory("$cordovaZip",["$q","$window",function(e,n){return{unzip:function(t,o){var r=e.defer();return n.zip.unzip(t,o,function(e){0===e?r.resolve():r.reject()},function(e){r.notify(e)}),r.promise}}}])}(); diff --git a/www/lib/ngCordova/package.json b/www/lib/ngCordova/package.json index 1670270c..d18115ca 100644 --- a/www/lib/ngCordova/package.json +++ b/www/lib/ngCordova/package.json @@ -2,7 +2,7 @@ "name": "ng-cordova", "private": false, "main": "dist/ng-cordova", - "version": "0.1.15-alpha", + "version": "0.1.17-alpha", "repository": { "url": "git://github.com/driftyco/ng-cordova.git" }, @@ -11,6 +11,7 @@ "gulp-concat": "^2.2.0", "gulp-footer": "^1.0.4", "gulp-header": "^1.0.2", + "gulp-jscs": "^1.6.0", "gulp-jshint": "^1.6.1", "gulp-prettify": "^0.3.0", "gulp-rename": "^1.2.0", |
