diff options
Diffstat (limited to 'www/lib/ngCordova')
| -rw-r--r-- | www/lib/ngCordova/.bower.json | 55 | ||||
| -rw-r--r-- | www/lib/ngCordova/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | www/lib/ngCordova/LICENSE | 21 | ||||
| -rw-r--r-- | www/lib/ngCordova/README.md | 130 | ||||
| -rw-r--r-- | www/lib/ngCordova/bower.json | 46 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova-mocks.js | 3443 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova-mocks.min.js | 7 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova.js | 7061 | ||||
| -rw-r--r-- | www/lib/ngCordova/dist/ng-cordova.min.js | 9 | ||||
| -rw-r--r-- | www/lib/ngCordova/package.json | 44 |
10 files changed, 10817 insertions, 0 deletions
diff --git a/www/lib/ngCordova/.bower.json b/www/lib/ngCordova/.bower.json new file mode 100644 index 00000000..ceb7fd72 --- /dev/null +++ b/www/lib/ngCordova/.bower.json @@ -0,0 +1,55 @@ +{ + "name": "ngCordova", + "version": "0.1.26-alpha", + "homepage": "http://ngCordova.com/", + "authors": [ + "Max Lynch <max@drifty.com>", + "Paolo Bernasconi <paolo.enrico.bernasconi@gmail.com>", + "Chad Campbell <chad.campbell@ecofic.com>" + ], + "description": "AngularJS Cordova wrappers for common Cordova plugins.", + "main": [ + "./dist/ng-cordova.js" + ], + "ignore": [ + "**/.*", + "gulpfile.js", + "test", + "src", + "config", + "demo", + "CONTRIBUTING.md", + "CODE_OF_CONDUCT.md" + ], + "dependencies": { + "angular": ">= 1.2.23" + }, + "keywords": [ + "ngCordova", + "ng-cordova", + "ngcordova", + "ng cordova", + "cordova", + "phonegap", + "angular", + "angularjs", + "ionic", + "cordova plugin" + ], + "license": "MIT", + "private": false, + "devDependencies": { + "angular": ">= 1.2.23", + "angular-mocks": ">= 1.2.23", + "jquery": "~2.1.1" + }, + "_release": "0.1.26-alpha", + "_resolution": { + "type": "version", + "tag": "v0.1.26-alpha", + "commit": "19871067c61b2454fdf0a54517075f8483b489e2" + }, + "_source": "https://github.com/driftyco/ng-cordova.git", + "_target": ">= 0.1.24-alpha", + "_originalSource": "ngCordova" +}
\ No newline at end of file diff --git a/www/lib/ngCordova/CHANGELOG.md b/www/lib/ngCordova/CHANGELOG.md new file mode 100644 index 00000000..a67aa255 --- /dev/null +++ b/www/lib/ngCordova/CHANGELOG.md @@ -0,0 +1 @@ +Please refer to the [Github ngCordova Releases file](https://github.com/driftyco/ng-cordova/releases) for detailed information. diff --git a/www/lib/ngCordova/LICENSE b/www/lib/ngCordova/LICENSE new file mode 100644 index 00000000..66680097 --- /dev/null +++ b/www/lib/ngCordova/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Drifty + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
\ No newline at end of file diff --git a/www/lib/ngCordova/README.md b/www/lib/ngCordova/README.md new file mode 100644 index 00000000..94b3d2b5 --- /dev/null +++ b/www/lib/ngCordova/README.md @@ -0,0 +1,130 @@ + +[ngCordova](http://ngcordova.com/) +========== + +[](https://travis-ci.org/driftyco/ng-cordova) [](http://bower.io/search/?q=ngCordova) + +### Cordova with AngularJS Goodness + + +[<img src="http://ionicframework.com/img/ngcordova-context-logo.png" alt="ngCordova Logo" width="210px" height="210px" />](http://ngcordova.com/) + + +ngCordova gives you simple AngularJS wrappers for a massive amount of Cordova plugins. Check out the list below for all of the available plugins, and create an issue for a new request. + +Created by the [Ionic Framework](http://ionicframework.com/) team and the community. + +| RESOURCE | LINK | +|------------|---------| +| **Website** | [ngCordova.com](http://ngcordova.com/) | +| **Docs** | [ngCordova.com/docs](http://ngcordova.com/docs/) | +| **Requirements** | [AngularJS](https://github.com/angular/angular.js), [Cordova](http://cordova.apache.org/) | +| **Install** | `bower install ngCordova` or [download zip file](https://github.com/driftyco/ng-cordova/archive/master.zip) | +| **Custom build** | [ngCordova.com/build](http://ngcordova.com/build/) | + + +## Installation + +Install manually, or from bower: + +```bash +$ bower install ngCordova +``` + +## Plugins `(67+)` + +- [Action Sheet](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet) +- [AdMob](https://github.com/floatinghotpot/cordova-plugin-admob) (:warning: share % Ad revenue) +- [App Availability](https://github.com/ohh2ahh/AppAvailability) +- [App Rate](https://github.com/pushandplay/cordova-plugin-apprate) +- [App Version](https://github.com/whiteoctober/cordova-plugin-app-version) +- [Background Geolocation](https://github.com/christocracy/cordova-plugin-background-geolocation) +- [Badge](https://github.com/katzer/cordova-plugin-badge) +- [Barcode Scanner](https://github.com/wildabeast/BarcodeScanner) +- [Battery Status](https://github.com/apache/cordova-plugin-battery-status) * +- [Beacon](https://github.com/petermetz/cordova-plugin-ibeacon) +- [Bluetooth Low Energy](https://github.com/don/cordova-plugin-ble-central) +- [Bluetooth Serial](https://github.com/don/BluetoothSerial) +- [Brightness](https://github.com/fiscal-cliff/phonegap-plugin-brightness) +- [Calendar](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin) +- [Camera](https://github.com/apache/cordova-plugin-camera) * +- [Clipboard](https://github.com/VersoSolutions/CordovaClipboard) +- [Console](https://github.com/apache/cordova-plugin-console) * +- [Contacts](https://github.com/apache/cordova-plugin-contacts) * +- [Date Picker](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker) +- [Device Motion](https://github.com/apache/cordova-plugin-device-motion) * +- [Device Orientation](https://github.com/apache/cordova-plugin-device-orientation) * +- [Device](https://github.com/apache/cordova-plugin-device) * +- [Dialogs](https://github.com/apache/cordova-plugin-dialogs) * +- [Email Composer](https://github.com/katzer/cordova-plugin-email-composer) +- [Facebook Connect](https://github.com/Wizcorp/phonegap-facebook-plugin) +- [Facebook AudienceNetwork Ads](https://github.com/floatinghotpot/cordova-plugin-facebookads) (:warning: share % Ad revenue) +- [File](https://github.com/apache/cordova-plugin-file) * +- [File Transfer](https://github.com/apache/cordova-plugin-file-transfer) * +- [Flashlight](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin) +- [Flurry Ads](https://github.com/floatinghotpot/cordova-plugin-flurry) (:warning: share % Ad revenue) +- [Geolocation](https://github.com/apache/cordova-plugin-geolocation) * +- [Globalization](https://github.com/apache/cordova-plugin-globalization) * +- [Google Ads](https://github.com/floatinghotpot/cordova-admob-pro) (:warning: share % Ad revenue) +- [Google Analytics](https://github.com/danwilson/google-analytics-plugin) +- [Google Plus](https://github.com/EddyVerbruggen/cordova-plugin-googleplus) +- [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) (:warning: share % Ad revenue) +- [Image Picker](https://github.com/wymsee/cordova-imagePicker) +- [InAppBrowser](https://github.com/apache/cordova-plugin-inappbrowser)* +- [Keyboard](https://github.com/driftyco/ionic-plugin-keyboard) +- [Keychain](https://github.com/shazron/KeychainPlugin) +- [Launch Navigator](https://github.com/dpa99c/phonegap-launch-navigator) +- [Local Notifications](https://github.com/katzer/cordova-plugin-local-notifications/) +- [Media Capture](https://github.com/apache/cordova-plugin-media-capture) +- [Media](https://github.com/apache/cordova-plugin-media) * +- [MillennialMedia Ads](https://github.com/floatinghotpot/cordova-plugin-mmedia) (:warning: share % Ad revenue) +- [MobFox Ads](https://github.com/floatinghotpot/cordova-mobfox-pro) (:warning: share % Ad revenue) +- [MoPub Ads](https://github.com/floatinghotpot/cordova-plugin-mopub) (:warning: share % Ad revenue) +- [Native Audio](https://github.com/SidneyS/cordova-plugin-nativeaudio) +- [Network Information](https://github.com/apache/cordova-plugin-network-information) * +- [Oauth](https://github.com/nraboy/ng-cordova-oauth) (available separately) +- [Pin Dialog](https://github.com/Paldom/PinDialog) +- [Preferences](https://github.com/apla/me.apla.cordova.app-preferences) +- [Printer](https://github.com/katzer/cordova-plugin-printer) +- [Progress Indicator](https://github.com/pbernasconi/cordova-progressIndicator) +- [Push Notifications](https://github.com/phonegap-build/PushPlugin) (**deprecated** - Will be removed in future release) +- [Push Notifications - V5] (https://github.com/phonegap/phonegap-plugin-push) +- [Screenshots](https://github.com/gitawego/cordova-screenshot) +- [SMS](https://github.com/aharris88/phonegap-sms-plugin) +- [Social Sharing](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin) +- [Spinner Dialog](https://github.com/Paldom/SpinnerDialog) +- [Splashscreen](https://github.com/apache/cordova-plugin-splashscreen) * +- [SQLite](https://github.com/litehelpers/Cordova-sqlite-storage) +- [StatusBar](https://github.com/apache/cordova-plugin-statusbar) * +- [Toast](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin) +- [Touchid](https://github.com/leecrossley/cordova-plugin-touchid) +- [Vibration](https://github.com/apache/cordova-plugin-vibration) * +- [Video Capture Plus](https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin) * +- [Zip](https://github.com/MobileChromeApps/cordova-plugin-zip) + +`* official Apache Cordova Plugin` + +## Authors + +#### Max Lynch + +- https://twitter.com/maxlynch +- https://github.com/mlynch + +#### Paolo Bernasconi + +- https://twitter.com/paolobernasconi +- https://github.com/pbernasconi + +## Project Maintainer + +#### George Stocker + - https://twitter.com/gortok + - https://github.com/gortok + + +## LICENSE + +ngCordova is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository. diff --git a/www/lib/ngCordova/bower.json b/www/lib/ngCordova/bower.json new file mode 100644 index 00000000..b0e46d39 --- /dev/null +++ b/www/lib/ngCordova/bower.json @@ -0,0 +1,46 @@ +{ + "name": "ngCordova", + "version": "0.1.26-alpha", + "homepage": "http://ngCordova.com/", + "authors": [ + "Max Lynch <max@drifty.com>", + "Paolo Bernasconi <paolo.enrico.bernasconi@gmail.com>", + "Chad Campbell <chad.campbell@ecofic.com>" + ], + "description": "AngularJS Cordova wrappers for common Cordova plugins.", + "main": [ + "./dist/ng-cordova.js" + ], + "ignore": [ + "**/.*", + "gulpfile.js", + "test", + "src", + "config", + "demo", + "CONTRIBUTING.md", + "CODE_OF_CONDUCT.md" + ], + "dependencies": { + "angular": ">= 1.2.23" + }, + "keywords": [ + "ngCordova", + "ng-cordova", + "ngcordova", + "ng cordova", + "cordova", + "phonegap", + "angular", + "angularjs", + "ionic", + "cordova plugin" + ], + "license": "MIT", + "private": false, + "devDependencies": { + "angular": ">= 1.2.23", + "angular-mocks": ">= 1.2.23", + "jquery": "~2.1.1" + } +} diff --git a/www/lib/ngCordova/dist/ng-cordova-mocks.js b/www/lib/ngCordova/dist/ng-cordova-mocks.js new file mode 100644 index 00000000..0cf15abd --- /dev/null +++ b/www/lib/ngCordova/dist/ng-cordova-mocks.js @@ -0,0 +1,3443 @@ +/*! + * ngCordova + * v0.1.26-alpha + * Copyright 2015 Drifty Co. http://drifty.com/ + * See LICENSE in this repository for license information + */ +(function(){ +var ngCordovaMocks = angular.module('ngCordovaMocks', []); +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaActionSheet + * + * @description + * A service for testing action sheet + * in an app build with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaActionSheet', ['$q', function ($q) { + var throwsError = false; + + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaActionSheet + * @type Boolean + * + * @description + * A flag that signals whether a promise should be rejected. + * This property should only be used in automated tests + */ + throwsError: throwsError, + + show: function () { + var defer = $q.defer(); + + if (this.throwsError) { + defer.reject('There was an error on showing action sheet'); + } else { + defer.resolve(); + } + + return defer.promise; + } + }; +}]); + +ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function ($q) { + var throwsError = false; + return { + throwsError: throwsError, + getAppVersion: function () { + var defer = $q.defer(); + defer.resolve('mock v'); + return defer.promise; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaBarcodeScanner + * + * @description + * A service for testing barcode scanner features + * in an app build with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaBarcodeScanner', ['$q', function ($q) { + var throwsError = 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; + }, + + 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 + * + * @description + * A service for ble features + * in an app build with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaBLE', ['$q', '$timeout', '$interval', '$log', function ($q, $timeout, $interval, $log) { + 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' + ], + 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'}] + } + ] + }; + + var readData = new ArrayBuffer(8); + + return { + + scan: function (services, seconds) { + var q = $q.defer(); + + // first notify about discovered device + $timeout(function () { + q.notify(deviceScan); + }, Math.round(seconds * 1000 * Math.random())); + + // end scan + $timeout(function () { + q.resolve(); + }, seconds * 1000); + + return q.promise; + }, + + startScan: function (services, callback, errorCallback) { + $timeout(function () { + callback(deviceScan); + }, Math.round(1000 * Math.random())); + }, + + stopScan: function () { + var q = $q.defer(); + $timeout(function () { + q.resolve(); + }, 500); + return q.promise; + }, + + connect: function (deviceID) { + var q = $q.defer(); + $timeout(function () { + q.resolve(deviceConnect); + }, 1500); + return q.promise; + }, + + disconnect: function (deviceID) { + var q = $q.defer(); + $timeout(function () { + q.resolve(true); + }, 500); + return q.promise; + }, + + read: function (deviceID, serviceUUID, characteristicUUID) { + var q = $q.defer(); + $timeout(function () { + q.resolve(readData); + }, 100); + return q.promise; + }, + + write: function (deviceID, serviceUUID, characteristicUUID, data) { + var q = $q.defer(); + $timeout(function () { + q.resolve(true); + }, 100); + return q.promise; + }, + + writeWithoutResponse: function (deviceID, serviceUUID, characteristicUUID, data) { + var q = $q.defer(); + $timeout(function () { + q.resolve(true); + }, 100); + return q.promise; + }, + + writeCommand: function (deviceID, serviceUUID, characteristicUUID, data) { + $log.warning('writeCommand is deprecated, use writeWithoutResponse'); + return this.writeWithoutResponse(deviceID, serviceUUID, characteristicUUID, data); + }, + + startNotification: function (deviceID, serviceUUID, characteristicUUID, callback, errorCallback) { + $interval(function () { + var data = new Uint8Array([Math.round(255 * Math.random())]); // one byte with random number + callback(data); + }, 200, 10); // repeat 10 times with 200 ms delay for each + }, + + stopNotification: function (deviceID, serviceUUID, characteristicUUID) { + var q = $q.defer(); + $timeout(function () { + q.resolve(); + }, 100); + return q.promise; + }, + + isConnected: function (deviceID) { + var q = $q.defer(); + q.resolve(true); + return q.promise; + }, + + enable: function () { + var q = $q.defer(); + $timeout(function () { + q.resolve(); + }, 1500); + return q.promise; + }, + + isEnabled: function () { + var q = $q.defer(); + 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 + * + * @description + * A service for testing camera features + * in an app build with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaCamera', ['$q', function ($q) { + var throwsError = false; + var imageData = ''; + + 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 imageData + * @propertyOf ngCordovaMocks.cordovaCamera + * + * @description + * The imagedata (e.g. an url) which will be returned from the device. + * This property should only be used in automated tests. + **/ + 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. + } + + defer.resolve(this.imageData); + } + + return defer.promise; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaCapture + * + * @description + * A service for testing media capture + * in an app build with ngCordova. + * + * @example + */ +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; + }, + + 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 + * + * @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 = []; + + 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; + }, + + 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 + * + * @description + * A service for testing datepicker features + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaDatePicker', ['$q', function ($q) { + return { + show: function (options) { + var q = $q.defer(); + options = options || {date: new Date(), mode: 'date'}; + q.resolve(options.date); + return q.promise; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaDevice + * + * @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 = ''; + + 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, + + /** + @ngdoc property + @name manufacturer + @propertyOf ngCordovaMocks.cordovaDevice + + @description + The manufacturer of the device. + 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; + }, + + getManufacturer: function () { + return this.manufacturer; + } + }; +}); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaDeviceMotion + * + * @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 = []; + + 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; + }, + + 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 + * + * @description + * A service for testing compass fetures + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaDeviceOrientation', ['$interval', '$q', function ($interval, $q) { + 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; + }, + + 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 + 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); + }; + + 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; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaDialogs + * + * @description + * A service for testing dialogs + * 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; + + 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; + }, + + 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.cordovaFacebook + * + * @description + * A service for testing Facebook features + * in an app built with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaFacebook', ['$q', function ($q) { + return { + + /** + * These properties are here for the purpose of automated testing only. + **/ + loginShouldSucceedWith: null, + showDialogShouldSucceedWith: null, + apiShouldSucceedWith: null, + getAccessTokenShouldSucceedWith: null, + getLoginStatusShouldSucceedWith: null, + logoutShouldSuceedWith: null, + + login: function (permissions) { + if (this.loginShouldSucceedWith !== null) { + return $q.when(this.loginShouldSucceedWith); + } else { + return $q.reject(); + } + }, + + showDialog: function (options) { + if (this.showDialogShouldSucceedWith !== null) { + return $q.when(this.showDialogShouldSucceedWith); + } else { + return $q.reject(); + } + }, + + api: function (path, permissions) { + if (this.apiShouldSucceedWith !== null) { + return $q.when(this.apiShouldSucceedWith); + } else { + return $q.reject(); + } + }, + + getAccessToken: function () { + if (this.getAccessTokenShouldSucceedWith !== null) { + return $q.when(this.getAccessTokenShouldSucceedWith); + } else { + return $q.reject(); + } + }, + + getLoginStatus: function () { + if (this.getLoginStatusShouldSucceedWith !== null) { + return $q.when(this.getLoginStatusShouldSucceedWith); + } else { + return $q.reject(); + } + }, + + logout: function () { + if (this.logoutShouldSuceedWith !== null) { + return $q.when(this.logoutShouldSuceedWith); + } else { + return $q.reject(); + } + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaFile + * + * @description + * 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; + }; + + 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; + } + + return mockIt.call(this, 'There was an error checking the directory.'); + }, + + 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.'); + }, + + listDir: function (filePath) { + return mockIt.call(this, 'There was an error listing the directory'); + }, + + 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 mockIt.call(this, 'There was an error creating the file.'); + }, + + removeFile: function (directory, file) { + return mockIt.call(this, 'There was an error removng 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'); + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaFileOpener2 + * + * @description + * A service for testing fileOpener2 + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { + + var throwsError = false; + + return { + + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaFileOpener2 + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, + + open: function (file, type) { + + var defer = $q.defer(); + + if (this.throwError) { + defer.reject({ + status: 0, + message: 'There was an error capturing the file.' + }); + } else { + defer.resolve(); + } + + return defer.promise; + + }, + + uninstall: function (pack) { + + var defer = $q.defer(); + + if (this.throwError) { + defer.reject({ + status: 0, + message: 'There was an error capturing the packageId.' + }); + } else { + defer.resolve(); + } + + return defer.promise; + + }, + + appIsInstalled: function (pack) { + + var defer = $q.defer(); + + if (this.throwError) { + defer.reject({ + status: 0, + message: 'There was an error capturing the packageId.' + }); + } else { + defer.resolve(); + } + + return defer.promise; + + } + + }; + +}]); + + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaFileTransfer + * + * @description + * A service for testing download and upload + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaFileTransfer', ['$q', function ($q) { + var throwsError = false; + + var mockIt = function (errorMessage) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject(errorMessage); + } else { + defer.resolve(); + } + return defer.promise; + }; + + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaFileTransfer + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, + + download: function (source, filePath, options, trust) { + return mockIt.call(this, 'There was an error downloading the file.'); + }, + + upload: function (server, filePath, options) { + return mockIt.call(this, 'There was an error uploading the file.'); + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaGeolocation + * + * @description + * 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; + + 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; + }, + + 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.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; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaGlobalization + * + * @description + * 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}; + + 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; + }, + + 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; + }, + + 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; + }, + + 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; + }, + + 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; + }, + + getDatePattern: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error getting the date pattern.'); + } else { + var result = ''; + + // TODO: Review + options = options; + + // END TODO: Review + + defer.resolve(result); + } + + 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 + * + * @description + * A service for testing google analytics services + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function ($q) { + var throwsError = false; + var methods = {}; + + /** + * @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. + **/ + methods.throwsError = throwsError; + + var methodsName = [ + 'startTrackerWithId', + 'setUserId', + 'debugMode', + 'trackView', + 'addCustomDimension', + 'trackEvent', + 'trackException', + 'trackTiming', + 'addTransaction', + 'addTransactionItem' + ]; + + methodsName.forEach(function (funcName) { + methods[funcName] = function () { + var defer = $q.defer(); + + (this.throwsError) ? + defer.reject() : + defer.resolve(); + + return defer.promise; + }; + }); + + return methods; +}]); + +'use strict'; + +/** + * @ngdoc service + * @name ngCordovaMocks.googlePlayGame + * + * @description + * A service for testing Google Play Game features + * 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; + } + }; + +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaKeyboard + * + * @description + * A service for testing device keyboard features + * in an app build with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaKeyboard', function () { + var isVisible = false; + + return { + hideAccessoryBar: function (bool) { + }, + + close: function () { + isVisible = false; + }, + + show: function () { + isVisible = true; + }, + + disableScroll: function (bool) { + }, + + isVisible: function () { + return isVisible; + } + + }; +}); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaKeychain + * + * @description + * A service for testing Keychain features + * in an app built with ngCordova. + **/ +ngCordovaMocks.factory('$cordovaKeychain', ['$q', function ($q) { + var keychains = {}; + + return { + /** + * @ngdoc property + * @name keychains + * @propertyOf ngCordovaMocks.cordovaKeychain + * + * @description + * The collection of 'keychains' that have been saved. + * This property should only be used in automated tests. + **/ + keychains: keychains, + + getForKey: function (key, serviceName) { + var defer = $q.defer(); + + if (this.keychains[serviceName]) { + defer.resolve(this.keychains[serviceName][key]); + } else { + defer.reject(); + } + + return defer.promise; + }, + + setForKey: function (key, serviceName, value) { + var defer = $q.defer(); + + if (!this.keychains[serviceName]) { + this.keychains[serviceName] = {}; + } + + this.keychains[serviceName][key] = value; + + defer.resolve(); + + return defer.promise; + }, + + removeForKey: function (key, serviceName) { + var defer = $q.defer(); + + if (this.keychains[serviceName]) { + delete this.keychains[serviceName][key]; + } + + defer.resolve(); + + return defer.promise; + } + }; +}]); + + +/** + * @ngdoc service + * @name ngCordovaMocks.localNotification + * + * @description + * A service for testing LocalNotificatio + * in an app build with ngCordovaMocks. + */ + +ngCordovaMocks.factory('$cordovaLocalNotification', ['$q', function ($q) { + + var storageKeyPfx = "ngCordLocNotif-"; + + function pfxId(id) { + return storageKeyPfx + id; + } + + function getAllIds(){ + var defer = $q.defer(); + var locNotifIds = []; + for ( var i = 0, len = localStorage.length; i < len; ++i ) { + if (localStorage.key( i ).indexOf(storageKeyPfx) > -1) + locNotifIds.push(parseInt(localStorage.key( i ).split("-")[1])); + } + defer.resolve(locNotifIds); + return defer.promise; + } + + + return { + cancel: function (ids) { + var defer = $q.defer(); + if (typeof(ids) == "number") ids = [ids]; + ids.forEach(function (id){ + localStorage.removeItem([pfxId(id)]); + }); + defer.resolve(); + return defer.promise; + }, + cancelAll: function () { + var defer = $q.defer(); + // TODO + defer.resolve(); + return defer.promise; + }, + clear: function (ids) { + if (typeof(ids) == "number") ids = [ids]; + var defer = $q.defer(); + ids.forEach(function (id){ + localStorage.removeItem([pfxId(id)]); + }); + defer.resolve(); + return defer.promise; + }, + clearAll: function () { + var defer = $q.defer(); + // TODO + // defer.resolve(); + return defer.promise; + }, + isScheduled: function (id){ + var defer = $q.defer(); + if (localStorage[pfxId(id)]) { + defer.resolve(true); + } else { + defer.resolve(false); + } + return defer.promise; + }, + isPresent: function (id){ + var defer = $q.defer(); + if (localStorage[pfxId(id)]) { + defer.resolve(true); + } else { + defer.resolve(false); + } + return defer.promise; + }, + isTriggered: function (id){ + var defer = $q.defer(); + if (localStorage[pfxId(id)]) { + defer.resolve(false); + } else { + defer.resolve(true); + } + return defer.promise; + }, + getAllIds: function () { + return getAllIds(); + }, + getIds: function () { + return getAllIds(); + }, + getScheduledIds: function () { + return getAllIds(); + }, + getTriggeredIds: function () { + var defer = $q.defer(); + defer.resolve([]); + return defer.promise; + }, + hasPermission: function (id){ + var defer = $q.defer(); + defer.resolve(true); + return defer.promise; + }, + schedule: function (data){ + var defer = $q.defer(); + var id = pfxId(data.id); + localStorage[id] = JSON.stringify(data); + defer.resolve(); + return defer.promise; + }, + update: function (data){ + var defer = $q.defer(); + var id = pfxId(data.id); + localStorage[id] = JSON.stringify(data); + defer.resolve(); + return defer.promise; + } + }; +}]); +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaNetwork + * + * @description + * A service for testing networked fetures + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaNetwork', ['$rootScope',function ($rootScope) { + 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 + * 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, + + switchToOnline: function (){ + this.isConnected = true; + $rootScope.$broadcast('$cordovaNetwork:online'); + }, + + switchToOffline: function (){ + this.isConnected = false; + $rootScope.$broadcast('$cordovaNetwork:offline'); + }, + + getNetwork: function () { + return this.connectionType; + }, + + isOnline: function () { + return this.isConnected; + }, + + isOffline: function () { + return !this.isConnected; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaProgress + * + * @description + * A service for testing Progress Indicator + * in an app build with ngCordova. + */ + +ngCordovaMocks.factory('$cordovaProgress', [ + '$timeout', function ($timeout) { + + return { + show: function (_message) { + var message = _message || 'Please wait...'; + console.info('$cordovaProgress.message', message); + }, + + showSimple: function (_dim) { + var dim = _dim || false; + console.info('$cordovaProgress.dim', dim); + }, + + showSimpleWithLabel: function (_dim, _label) { + var dim = _dim || false; + var label = _label || 'Loading...'; + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.label', label); + console.groupEnd(); + }, + + showSimpleWithLabelDetail: function (_dim, _label, _detail) { + var dim = _dim || false; + var label = _label || 'Loading...'; + var detail = _detail || 'Please wait'; + + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.label', label); + console.info('$cordovaProgress.detail', detail); + console.groupEnd(); + }, + + showDeterminate: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + console.group(); + console.info('$cordovaProgress.dim show', dim); + console.info('$cordovaProgress.timeout', timeout); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress.dim timeout', dim); + }, timeout); + }, + + showDeterminateWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.timeout', timeout); + console.info('$cordovaProgress.label', label); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress[dim, label] timeout', [dim, label]); + }, timeout); + }, + + showAnnular: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.timeout', timeout); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress.dim timeout', dim); + }, timeout); + }, + + showAnnularWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.timeout', timeout); + console.info('$cordovaProgress.label', label); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress[dim, label] timeout', [dim, label]); + }, timeout); + }, + + showBar: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.timeout', timeout); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress.dim timeout', dim); + }, timeout); + }, + + showBarWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.label', label); + console.info('$cordovaProgress.timeout', timeout); + console.groupEnd(); + $timeout(function () { + console.info('$cordovaProgress[dim, label] timeout', [dim, label]); + }, timeout); + }, + + showSuccess: function (_dim, _label) { + var dim = _dim || false; + var label = _label || 'Success'; + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.label', label); + console.groupEnd(); + }, + + showText: function (_dim, _text, _position) { + var dim = _dim || false; + var text = _text || 'Warning'; + var position = _position || 'center'; + console.group(); + console.info('$cordovaProgress.dim', dim); + console.info('$cordovaProgress.text', text); + console.info('$cordovaProgress.position', position); + console.groupEnd(); + }, + + hide: function () { + console.info('$cordovaProgress.hide'); + } + }; + } +]); + +'use strict'; + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaPush + * + * @description + * A service for testing push notifications features + * in an app build with ngCordova. + */ +ngCordovaMocks.factory('$cordovaPush', ['$q', '$timeout', '$rootScope', function ($q, $timeout, $rootScope) { + var throwsError = false; + + var deviceToken = ''; + + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaPush + * + * @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 + * + * @description + * Token send when service register device + * This property should only be used in automated tests. + **/ + deviceToken: deviceToken, + + onNotification: function (notification) { + $timeout(function () { + $rootScope.$broadcast('$cordovaPush:notificationReceived', notification); + }); + }, + + register: function (config) { + var _self = this; + var defer = $q.defer(); + if (config !== undefined && config.ecb === undefined) { + config.ecb = this.onNotification; + } + + if (this.throwsError) { + defer.reject('There was a register error.'); + } else { + defer.resolve(this.deviceToken); + if (config && config.ecb) { + config.ecb({ + event: 'registered', + regid: _self.deviceToken + }); + } + } + return defer.promise; + }, + + unregister: function (options) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was a register error.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaScreenshot + * + * @description + * A service for test app screenshot + * in an app build with ngCordova. + * + * @example + */ +ngCordovaMocks.factory('$cordovaScreenshot', ['$q', function ($q) { + var throwsError = false; + + var DATA_URI_MOCK = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPAAAABYCAYAAADLGnoRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAKLJJREFUeNrsfQmcXFWV/qmtqzudpLd0upN0kk46IQsJEHaFYAAVHFCjrC6jqOMCzAz+Hdf/oAjiKHFBnHHUERBxBNmUXZF9DyGEJBjSZO0knXSnO72l91rnfK/Orbp1+72q6k6nl+Sd/G666r37bt333v3uWe4553ri8Ti55JJL45M8LoBdcukIAfA7u9vHaj8XcHkvl09zmcLlHi6PcVnDJTQWOnig00vPbA7SzuYA3X6l1x1ZLh31AJ7G5f1cLuNyNpd8mzp/5/IQlwe4bOQSHc0OH+z10vYmP12+fII7slw6KgFcxOV9XC7nsoJLWY7Xxbi8JUB+mMuG0bqBGD/ORbOL3ZHl0lED4ElcztA47WybOlHu5/pYLHpXNBptjsViF8dj8eU+v6/E5/OT1+slj8ej6oa5vC4i9oNc3h5xeX+WC2CXjmwAQ0k8k8slXC7kUm1WQL8YqG/39vb8ed/e+vsa9tZv9My4MN7V56HukJd2Pvn16T6f733Vc+ZesvT4E8+uqKicMKFwIvn9fh3M0I/Xc7mXyyNctrgAdskF8NBpmYD2A1xOcADtzr6+3gcb9+17qLZ20+qO8k/0t3Z5qbvfQ6GIh6IxjyWmWr3m//y+OLU/dWnNgoXHnn3s0uMuqZ5Tc2Zp2ZQJjGYdyKAeLqtFxAaYd7gAdskFcHZayOWDUs4Q7ptG4VCoobm56S9763c/smP7tqf6Z1/ZBatuF4M2HPVYQM202AWYAsjBAFHHs58+ZvqMqgsWLlpy4XEnnHjmlPLyPIjZBnVzeYbL41J2uwB2yQVwiqDHnkMJY9RZZG9Bbu3u7npxx7at9/39rQ1P9FdffQCcFqCNRBNcdkg35EkAOs8fp+iaLy5+9/IVK086+bQLSkrLTmWO7Le5pIPLcyJmv8Cl3gWwS0cjgGExPltAC0vyZJs6vZFI5PWm/Y13b377rUdbii6qb+zwUWdfQjy2RONh9CvxMa8vKojRMZURWjDhzePn1sxbydz4o3xqqTBuk/AAnhQwA9QHXAC7dCQDOF9ACwvyeVwqzQrRaJRaDjSv2VW344GdO7b9OTrnS1tbwGn7vNQX9lB/mCgSY+DGEtwTsPIKF/WKsO09BL8ItBlkbjyjJEonVYeoprTNx/rx8cyNL+bTH+JyrMOl+7k8xeV+Lk9z6XQB7NKRAOAgl1MEtOC0C+wqxWKxTc1N+x946m+PPfrmG2vXlr3vrng4iuMeC7C9/UR9ocFxXEs8Fr7p9aSO6aIzeVKfk98tHZmoeEKMFs8I08lzwlQ+KcocOp7HQD6NT1/AZaXTvTDVCUe+j8vLIna7AHZpXAH4JC4flbLQoQ4suw/39/fds2vnzjfWtZ8U3trkZy6bQFkowiWU+DsqNwvdOBCnmaUxOnNhyAJzYTCuZGlMTCdyuZQSS1vzHJrZw+UJ4czPc+lzAezSWAXwIgHshcJ1fTZtNFDCaeKBcDj8clco2Fl3wE9v7g5QfavP0m3Bafv6SRmmjuPyfWlzpOl2Ltcwh+4qnxSjpbMjtGx2mKpKo5TnSxMFCrmcLlzZdp1aaIuI1+DMr3DpdwHs0mgDeBalln1WCGeyM/aACz3K1/81HPUe6Oj10J5WP23b76fdLTBMeSnKonKExeaD3cnr4CS8WoxIo0W/4nIluG7p5DjNmhKlBZURixuXTYzZWbbgKYZAig9IqXJoFx5fj3K5lwH8hju0XBoNAMMQdRfGtk3dbuEyf5KBWt8b8hC47RYGbUObj1p7vJa4DOAq6uiGISv59Tou3x3le8YNv4fLi9CVSxiekwtiLFZH6V3zQjS7LEIej+O1eC4w2sEZZTmX6XbPiQE80R1aLo0GgH/Lf67QzkNbfZMS4XvwYNpqIYAvae700ivbgrSVwdvd77VAatqjYKjq7U9+hej8GqXWhH/99HWeL43ETZ57ffwi/vNVEYtBiGKC8arHB+NWYcLSXTYxSmctCNHSqpC1BJWFsGwGI95lAuZSUbMhQnvcoeXSaAD4Wv7zPfmKgIDPUSLKJ43gJfX05iBtaQhYOq6dIRlc+GBXGqifE84HqqWEK2X/CN7riSJBBDVp4AZ8yM9j2V6mlUn5MVp+TIhOmdtPAV/Obc+TyQkgjjKA/e7QcmkkyOQz27TPbXbghU/yul15tLUxQP0O4AX19KWB92oNvBCwrxph8ILWcfmh9v2blPDNtoxsyjIO3f2lrXl8j0FrnTrHVa5eTbLocoeVS6MF4Ebt80zzPKzI0HlhqALndSI4Z4RTS0Uwit2onb6Vy7OjdL+ruGySzwVcblH32N2LNWpBIIN47c4Avb2XJYxwTtIwkg+oKP5Wd1i5NFoAhveRMjmVkOEO2dHjtXTe1m6vo68yJPKe9JXR/+Si1lXquHxrFO+3R7i/6j10139R/e7qTU1UzQd99PrOPKptzDxZCVVon1vcYeXSaAEYa7rN8rlYA56l0wK8O+CYkWFAW6JzCtyw1n5IO/31McChELDwG+37d0iSCGDJSxnd4C3W0O6j1duCVNvgt75n4cCK6t1h5dJIkWlsaRcQV4pOVyVck9qY675VH6COXq+j+yPEZojPQuVcfqqdhufSfXr9p68bOWPtudendRr673kC3FIRpVdaymx/wu0y4E+AeB+D+MUtQfLzVLdoRpgceqyvDb/jDiuXRgvASoxWNJfLSxApaxsCtLfNl7bGmyY6Q49MF52/pw1sTAxfMy4pYlDBFfH4LH1sY6CXGgBMTgB8HD3KNhOA435Bb1OkgXvk+4e5XCyTjKUPT56Y8LfG/TaxOI3Ja15FxApTtCHdh3qPO6xcGi0R2gTwDPwHHXBns585rDNOwLliKXC/1wDMNxUn1+gLOYBX6eKZ+p4LG/8nSriC6nSvIRHcIlKDpQN396ZO4Du4sdfjaJOeZaghLrk0ahx4rwngnpDHWlKxoGIzhuHE0ZdaFII19mYNWOCytxqXwDj25UPse2wQddGXbwiXJUMnR+IBOGXAqwrW8i8qdQD3lB9MXIw1YQcPrQAlclXbTYBDpjGco/uIoKllxbO1Sf2xppb23vHUf+Vvnw3AcyykxBAc77wiaojOcJBYIp9h9YW3lZmv+SpKuSGCY51KKeMZqF/EbqSZjQxCXw4aHHkFl7/K549QwhNrtXa+TqSD32hSAVxFn7A6D33Yj+weEp5o34UiDcAh4z6ONkDkYTgwGPaNgy5jbNwhn7FkOi6Nj3YA1kXdai4+HsDR/EDclgHDCSKSgiccI67RTt9ECa8rnTDY/5/2/UcOD69I9ZH13FyjhsNGFwFE5Lz6BxG5v02J2F+d4D76cUr4OIN+KhOKFYKBpSW4WkadewA9X1nrD9IQs3iMU9DiHV3B5Xyxl8Dw2cnH6+TZ/5bB7Dq2jLAOvFPjmLDQTgZ4JwTjAzJjQDfUfJ0hSv43pVwV3xQAk43uO1U+Y6a+zc44NQTaIRzApJs0UMPy/G5TA6CEp1iPfF9MiaUlUtIHQBx3TvdTpT3HepEcjgbwQpp5kcvPBMDHiC3gWJkkf85lDdc7x4XZyAK4VTiJMiAVI+MjInYC6TGz1NObNqivpFSwQFS4rOkuWWHovqu03zLp+4O4j4fJ2T0T676PymefiPgmbTYmm2tEmkiw9WhCz3cQoc014NhRAF7k9P4zpcJC/8Dl85RYisPfB+U44sn/yPVXuFAbOQC3a1wE3LQcAxexskFtCcXKrpFyl5xH6e6SvxDjlUkAebl83kXpDhUmXUupzDgDCvfJ4/OSx++zyodZOngiQxjg9zUujP2WzrSpAz/p9dp9/1KpGGg26rzrkh5S2HAUgBfZWH5PCV8BjJNLWUz+JJdbuTyEv5Rw4EFyw15531NdqI2cDtwvnGSO4ppW8HthjCblx6lDfIZ70m12P6FE4DsIIYf/bvfuRVQlTddUYqsVvgcAxrLwL4jx+TyRTCpAiVF+ICEFIDa5s9eTluFSo9eEC39QM7S9z2g6JBPMcwLg04SrQxTM5Ik13eDARzJ4/fLsqmWcXMWAvc+sx8cwtd/D9fHUJvD3e12ojRyAlT65XD7DQmeBF0nhGjp8Ccd/e3dJHF3FOuwAw8W518e/RSlr7W4xHiUJcbkKjB+6KU6F/Hv4DECr38JSzpRJMaouj9LssiiVF0VpQh7qeeggg7ex3Ufbm3xUd8Bn+W1HogN04QtE6sA69UXczweMbq7mfsK541Py/bsQz7kfdVhGQ1+8vowAPtK9sJAX7TL5jN0tMgLTDtwujQyAdW8iK4EdgFI0IaEHI/G6xlVvNkVRBsGPbdos0kD+A9LStILzAlUwlJWyqF4xOWZx/IA/LtyVLCcScNyZDNxpPLEXwCquiczTWVtH/ufFVT7asNvPJUD7ebKx0tYmgIxskvC0ulQuud/Ou8sg2ABu5loXdfd7Yr0M4knpdgDAWd+MbfcRPl6+QKlluh8zQKMuhMYmgPV1PIsDw5A1kQEGAPu8HgUKDN4ZWl283GxbgsJolcb5AMRiBuwJsxO5qQDewry4tfasQArYeLWUsU7i9dTJUVq+IMbtxWn1tjwr1c/BVKjgXRqAcyV4i/mZA4ew/++k/LQxW6xxYIjgI7KExKIpnvGH5fljuet5BtNrOVynpA+oB7iRdXzdXwfxmyqmGxlN1g3TvaBPnsM5GQzHb3AbHpHeYtxOfITes08kmehgAazHBVcokIEDQleFs78ELWDJqUUDbZdgzQ5jhXK8QLhxs0J8CXP25QtDdFJ12MqI4TnEGAcse50wK2z5MT9fG6SekJdCCQCXDqG5HdydENpCQAcSxGtUpun+kChah/HlnSf6Zkje01v8Iq/k47D0wu1Td9/s4+NI1vctrtPn0B4m4jtENQrI4Qgfh23gM1z+jRJr4RGxAdzCbf1RawJeS8q3/W98LnyI93cuJTK+YJnJz98hvSBr6F3cdqvDNRg7y+R51HK9Jj4GBoIVD6zdX4xjWn30+Styz/n8faNIDo8T5Zarga85QWw356hxy8fwXG7ndvYYdTEWTpBhvYPP1zu0GZR6+NvI9bZo52Ac/LioKjVy7HVhPvdw3dBgAWxFJnGP+ooKmCt6SM8XBY5TpwH4atYr77RrkMXV9cLN8sQIsk2BDeB997wQBQPDN7FBUgCID3T6qL07GZg/U6vyS+7rVQ59/S/N4GZxmljcY2XrMGgKpdaeW2gQuzfkQODs79IFDH6R58sgN/3D4UCB5TlYwVfZDJjpYsQ7zmYCXym6O86doZ17yKi7lFJr/K8dInivEZtE0JgMETv+MT5/iYM3FyatF4UTfpHrQXr4CyXW7tVzUL8BEGAlQY9pxwR1Np/7pExU2fqJlMqYGMuNfsI28gk+Dwv8eu0cfusF+Qwbz2cdmsb4Vx6B/6GMvtze+8UgvMSof76U0/DsdI6cCcB98kAqpdRBB0Y0jmHI2SnGDUvPzaBX7qNU8EKV4upLZkZY5E2C99OU8OwBp/jdENSBm2Qgwj3yDUwOp8wN0ZYGFqN7fNCn9WTttRn6quu1W1Qt+ITDoOZNSQhztXrNwi2Hi6I2EszN5BzcAfoyv+Db+AWbSQVutAGvTlfRQBdQ8/drFNemQ4i4wqCnhPMHaKNMSHtlgGLAw9HmTq73Dya3EeNqg6hteEfXCniR+qlW1An8Brg0ligniMr2PwL8RSJp/FrO95H9xntoAxz9D3J+n1yzUSZVJIGYz+Vurvde7udeEXX38nd4oEF6OhGiOx+zW79YJH9hyX9Cfg9j839lsqiTCWCd1L1KQA+m8hKXP+YC4Ea5qEDE6DropQVclC4qThzwuFJBAoszvDt9gFQCAxWsr567pN9qkxJJ526X2RW61gZKrcvmQleKuKR0XYgovdhCZX5lhHY3sxgd9VQ59Mc0TNXoALZGbSyxVAUDnhZSOM+YyA4nLZb3tUEmOL9Yy/Uc29MEqM9qAxED4BNGW/UygCGqXi6cd1IWHVJJWR0KKEMALwB1g3xdy+UDPMCV3eB+Pg+pDGGo5wqYf2VYtcOyNAWC59cFch//wud0J57rBLx9IlY/Kccf5uvx+TERUTOlLfy2gBeT1XncxmY5/iC3sUZ+d6GMuX/TrntGAIyxdizZ5JUTG4RiaooTIwjmOZmgP8W/p3wKHuXfg7X/b3LPn+fvcFyylmCdkqf2UnpUTYUyZAFsnnQxepNh8HEi3clhGkCwrDpC01M65SWUHiJ48SDHhz5IcaOWVxgmm5qpESoIktcwsDlFDVVqul4HJZeGPAQrtLEerC8hbR0BgyOMR+BMP+PyYwGf6clmctrLKd3FFHaKj/P1N3CBqoCdJ57P8tuFlEobBMC1DfEeIJIuEP3zGxp4Fd0kAxV0BQ/UyRnaAseGbni1Dl5xNDlLvt6pgVdNAusE4NM0W4A50ZxMiST+oFUaeFUbMML+Xr5+kuvr9oi1cn+lwpTsSBkD1ygpg/92ipV/pQZe9Xu7RAIgkVCShuNM2Y/3GzO7BVxkpgC6fKm5a5dmEKgm+21F0wDM11eXTYrT4qqI1Z4xK5k3mQtV0MD9mlYkFdVJMZqQFyv0pNahY+Scu2qBxo32Ji3LHkQnyYbjKZrhYLk/HIQ+36Trhvz5bRENdZpvWDGXG+dhCHlRawPeVD/NohN6NWktYiNe50ofUQPXpt8k1t275F5PI+f9qdSk8p82xrQVwsX6yPA10OgRSs/AatJK4c54Nnc71LlTuOBUSrkQg/BONgsTWmIzOZRo9/W0cf/tXJykm9colf20MhcA73HgNAk505s2cNs1o46T29wu7drZlcVRD5aLhJRhi4xJI5jjwJhJqXVm3VAgBi1r4qnQOHAvOS/51BjPIKruFz7RmvO3xzBuHG4A91HKp1un7cb3IkOa0CeZuAO3fYayL4HFtfse9DqBWGiVd9/LGazYazSpYmkWlexJm+PHas9ll92FwuE2Z2j7BPn7Cjn76r+lGXtP1ZsXEFvtiOVcp9M1O8bawayGUMpzsToXAOthgJZIibGLQYy/GoBbKBVDHDCWN0wAW4PA642XlBXGCvNTVueAjTEh4CTi2FCBzbEk+NFnFn2nxVPH9pPzkk+N8dCSa8/w+PL70iy/5ZrB53A7cdQ6DKawDadWVG4AWlMJ0gZ0Fw3Tum4Gmq2J4bVOlbgvWzVrfibD22au22Gjq1do460pw/WbHCaaydqkt9lpohHRd4s50YjRSlnpT6KBe2arZbB1anxlmPSmcVnAZbGopwETt/4cOXByUFvGq3QROiqzkRIXFsqMblKLzCCFrJcWB3zxSdglUBuE5vplaBBW3R6bY0m9CDtJ9IS8FQa3dMrAoIttG5QebSE2L67v1lBGKZG8bQQ4cERenGnVzMQNpxpW605yDrjYnuX5Nmn3XUzpiR9yVXOmyCSejdvvFqlqTiYA2xybSKnosOYsjht1GZ5ZsaZCZSLF4c1+PivPrETwsFMA6aFUlNsacwKSOkExTr5fQFupATffkIZy1oHBgfMAXmzDabk+etLC67ZodZ0U9w41s8biNLE/6i3WfJVDNgNo3yAAvMfGsGLNbnDAQCL63pCnIgcDlp9SJn4So5Hl4YX7hcOJP5WZZKYMGDU5dR5mAA/FvcVnvOMIOe+I0ZOBK4a151tmo67kQnmaMS2bFVupZBMy1OlweEY+cwIf5P0GNcAcHGI/12vgPsdQaRSje9MGvDVixPsfMeJWiqS4T1SGmJ1xIpOOoQCEGakIT2difnJDbF2M3u4ggpIx+zcnAOzxtnV7yhE5ZOg+Oj0/iMHRZCMaPgeo7Wvz0ea9SMiXJso0ZeASszQ9uV4BGH7Z04qjelID3S5wwEaUHSs0XLl7N2uTXNUQ24jnMO70PsezGNYO5b49GfoYH2QbcWPCA2tSDh1nGLaauTL5rLYxbsGAd5YwmH8FM+S2qrnUSDvtg3kIbdoFmHEtN0REJPnFoV8To/U10LliIbSzou5WXLGx3TsVwQZaVNO9miUUfwcbyaJ7gG2Kx+NrEJH08pY8K0F7PF0X2eXQRpXGVZsU0DFRYflsenHUNLIpGqtxwH0GJwJ3cVrvnZalrS3aJHXCEPoS1ThINvDpFu/BThCRQf6G3TiNaxLMUPv5nGJoDE6lai0RKWSnku40+iylUjl9nkELC/u2bP31ZhFRWrWL5+KuigpSgf3+dA7coYFgtkOb9coY1trlrdlU76eWTp+ub2It93H5+5bTG3LY1gXrZHACeCgWi152oMvX++I7QXprT0AlHtA5ptMSwvGGHtardODiCXEqKUyTYOaMAwA3Gsa6Ykp3J9Vpfpa21miSy/k8KAOD7Eu9PCdPDhxcqTFvD+YHeMAfpFRMdlWWPi7KoI6p+1yQ5ScXZ+gn1qi7ROVQy0wqC+bLuoeWGN9UrPpTfO4Rm/aKycao680yY9YZVkQqDCbyYxlrwY1aXW8GACcHen/YMwei7dodid0eNC58AdnEmVqJ4/sT+ak37wvQ7ha/FfOLOF3o0lxi/Pk7Bzq9K9fvKdj0lw359EZdwIoT5qt9xsBtzPJClB6TnKhKC6NmUvcFORhERpuaDV1xAtl4y0lAwKIs4MC7e1Wzup44yL40aX2ZkcHyCkmp4BCea6NmjMqkq8/NoBt3aJNAJoxUZ5Do0I91wsXVMtOZDuohjFNq+etVh9+aYyfZZtvHVn+A0638yP5EbDCle2PF5SaOz/JwGrULKtp7sEl4gEHIU9T8MFUURXU/42TDcKDY3uSnjXvyqJ51WuRsBphgVAJXtBLuCcCZ81JTu4fauG3US3BrzyRKidARcnbi0PX35FJHgOc9uGRqffNQuki+ZSyiF55OPABrtcEB+jAf+7Vhof2IZnnNRLeJcQXj5ivczsccfH0VGDF4C8EZpS/vSF/ez59vdFiiOUfUtUiGwZyJ1osYvFQm2QMOk8RSh2cW5/OvSj9WSF/s2lim2UuetWmnm+usFp32eIkGmycTxEs2jFQ5QIUzSIfewQJ4QJJ3WKHzhPMqa7SItBCBVWaOYzLMwslnEEuI0vTK1jwri8b8yijNKY9YscEe/gdAYm+inc0+2tPqt7hpRECJNdl9LV7LqGTt4mul4/FY+rXN9i9Fmm7bRfZrwF5KX8NOukZCZSidmMZ9wSGmaHPMWM6FBb/fi7TvSCUE391VMhAh3n0tx7aekYLBDRdMxCT/OUN9JLi7jH/jE+JBhpzbHxVREuUVAxRemUy8lMM6qQM9KYxiukw2L9vUuTCLygD7CyKEymVM325T53KRaNpsDLCKVsv4gHTzKeG0z9gwEMVUppGN9xk/l3wamAJq0ACuVIM5oImSEKNjCR1T11mPywHAeDiFrA+HGKge7HpY3+qlV/0+CnhCFI+GKBwOUW8oRqGon6dU1v19AZ40kGUd2yR4U4J+ZmNhXB5MgWacs8tVXKaJ2d2a1dUKeSxL138xW5ZohqKxnAv6UbFqVmjSw39IXDH6/R5ydn81uUqIr/uOiISYEG/j7712SQH4OHyJfyiTJ0Idvy5g3yaDdBXCI4280QgwWCmffyc67WCljgZuF0sxV3D5Ehz/+Zge3AFD0g1i46gkm1TEXH8D11P5xK/lzy/oBiXJyvl5+fq/5BydtVaefTWlfPtftYmy6pe6HxTpZIrhJ/4lGW+dphEyG4C3mQCGCI1YW2vjL/HICg8Ut+fK7GSute2XzgZlBky+vKgV7cM6bUi53SaW1izt1Td8ayFiWe9xMOIoUO5Tkw2kDIRRIpmBAXalj7SMEIA9OR73GIMRAejXUyJnN2nW1XcZton2bHqwtPcyt4cBdas8r/v4+y2i1+0X3ROc+Ur5nXoRvXFtD9cFZ8NyCZZFHufvv5OBeYoMVLx8+EnfkeV+Mw0Jlf8MTALJ9RCG+Y6M4a/J+LuTMm/v811KBA5A93yE2/hvGRcQy6+We4c1+SdOagQC/vk6WJvfK5Z7QOU1B7H9DwLgGunzj2QMgvMiZhiZVT8mAI4NhgMrwOHmi3zeeAe2GkG6myiLrJoevFebIabKjL/Txoh1kNJ9iAewyxGwzNrRPMNias2SAStNTyypNmiTmU+zVncfhn6aSxiBHOvZvdNbRfe82sFY+e8y4Bfl0jEecH/gAYZXdYuoErj+GzIJFGt9gFT2Ga6vr9Ejkuf/y4BcTgODLWC9vSLDjg55Dvet96+W+/cFEX3LBQA6fU4kp6DTZMBtvM5tfE4mH3hT/dzGWv2PEimUiZ4TAKvxv8GhHnJp3yNSyDlSeoSTQdVAwMk/GsazrABWOaIrpFQyR+pQHJjSLdHN0sFJIusvtgFwt+hBXxwlcTIkIk82C3RS98rLi1P5xJi5N9R8BzVjOAk64I0ya/tkoog5iMhdMtHifb5hMxjRxj/zgHxFRMs50hYGH1LnPCbZJ3Lh+KrNuyRFDfTpk2UCnCKTOLgOIm1+ZIrBYjxbJdcCZEsoFTQPUfznTil1hH4goHw2S/8Qt4t2rpF3WyCgu4PP3c7njhMu6yF7ry608SdJ9fPPco+TRdp6SZ7b9hze490y+eIdbudrdjv8Vj//FhJabBIdfZr0CxMADH7tfP4Gec5JndsT17ZWsNkRzycvQ4XqQV964W9/z6c1O/KsJRxc3taZNruqgQBRZUB2ypHc1DsbGRk5MHjOk89fFu5CFUVxuuT0Xlo8Pc04+EPhOCQzs74fVHLnuEOhw7U7ofjjJgGsErTx8Zco3WsIqVt+nmOb06TNPJmkayW+NZdrq+W6/Xa+wcN0zzOF29Y75QzLoY3pove32sQxD3d/i2WSarXJrpI2xrJx4KjI4QrAFQAs9NWkr1m6JVoXlWpyAM1YIT+lhzNuVCyoAOveeQP6rDuFjIed+NL0LdO6Kw701RnsH1kNR0O1xPO1dSNwz3uGoY19I/iO9N1RMpI3hzq6438NgBqKeiz9V7dEK8ZhGLLGC5VpVtqQblXMlzRCBs0YTwBmgBaKo7wTvYfS47h76SjdJnW8kT+HOrqcf4zapU/fqU+zRG+kVFrZuSK29I81EdpGCgBHLdIMWMl0oMiFPTGYpnqa3GrvOHjPsDl8g0GMZGz3G258kMW+YhjJsAZe58LjyACwnutpGhwnMKjTFOUUB1bba8LEDnfKmaYoxuCBEeKbDr8FvQlrjLWHcE9YeH8ow3kYCszUt0s0ow28qvqUeoCdIvLT092WUsqJo5/G+G4MsjMgjB9Y9oKVE0sUTwmHhZ4FJ/p3GZch77PLgY8QAOsiYgX03XkVEVq/O0BwhVQcWKhVdKESmdFn2+hSp2b4LViwTztEAJ+V5fwSm2NL7SQOOKxUlUT1+yMB70TtfpvGMHhhNf0BpfvQXiYl5qBCYRK+xYXG+KDB6sCWA0NVSYQWToskE7FrA9xMLbM4y4SAKI4/GdeUHeI96ZEu66V9Xcy1WweeZ2e8wYZuM0sHJHUo154brJFjeQd6SDRwCNiZ47sH1/2s044CLo1PACsvHRLOWoS8UKfX9NOcKRErR5RliU61pMc5LrNpT1/4hs/pRQIyncMdCulOIt+T9tcbg1QnSAqL7FSG8qKY5Zdt0DRjchuzG3rD4oy1TEosj/2EMhumsIx2oZmG1aXxL0I3C9cqFtER1sp90A1PnxeythtBwDy4sGwgpoNlThadepYmitoBcChkJnEz29xlU1/5QEP3tXygEUI4qyxqBW8YNJK5oIcLyOjnV1mkRqoWeAWdLO8zJjo/nCJeG4rvsUtjH8BR4TQLxdCD5Yj10IVnsXh54uwQvdQfpJ6+RPieIa5BND3n6es8epK73517ffwOA8C6mH7coViquW2dQ7ZpkgMIaJzP7b+g1f+opiNiotqHX8f+xNVTonYbrY3IbgzD4QxiQ1soQ+hjSWGxi4gjEMAmwJIcCDG5i2dEqKnTx5w4QL39VmDfDuF8RaKPPp3BeUOBTV9oP5XrD4e3B1a2WkRqULsSAo63cvu3OlyDfvQh0GnqpJi+awQ5SBUN7hByaazrwCDd8KQHh1vbgS6bFbK4leTK2k+5b35V4CDWDgd1ifhfQCmrcTayMgVCbJ5TEbGikAyCFLLABbBL4w3AuuUWERqInDglyZKLo7SMRek5Fdi90BJTETP6eob2Nsr5r2miHZY7NgzTfSEQAE72PQLib1H2jdKwNvoLqAaVJTFaNCOq54CGpAC/7tWUHvS/3x1CLo0mZQtmUIT8Ry9Q+noiRFRE9iBiZgd27nt1W5Be25FHbZ3IpmF5a2WaIGKHMKFkI7u2s20JEkOygpppMWuv4qUzw4h7xv0iEgWeSuaWMdjc6p/IJnf1YdJfXXJpyAAGIScP4j4vMY7Dgoxg55s7er2tz7wdpE17A9Zeuu2dY/CGJZcXwgNVVk08AuS7PqUmTKfWhGjKxBjqIfYSHmPmWvYbMmk96PQbLoBdGosAVnS+DGxz90AYr37S2LD3tpf2zu/HbghIRtfPfLovlA4g28+U4o9prNKTzjYdrzd4q9c4h4I4ZgAVyfCg3yLKCMkJ4CoJNaCqFGJzHGumCBU82+b+EFQNA1jGrP8ugF0aywBWGPuU6LDHGufWdrS33bi5peKh2oYAIXl7n+yrGx+lSEJwXOSzBkDhBjq7NEKTJ8STCeoF68tkYrrURsL4pYC3NZffcwHs0lgHsCLoiFdx+aqpI3K7Txw82HH9gf4pryKH855Wn7XJWJfssTsSYAZwYSWfURKlJVVha6Nvm9jeKuG4yA6hJzjDqvadIi4Par3XBbBL4wXAimaIoQeZ+vSseVhIRQKzVZEo/b2500e1DX56hzlzM4M5dIhA9hgittoGFEEIkxm4s6dErUwa8GcOBgb8EFw2kUTtGhrovvmwAPf1ofTLBbBL4w3AirBOiiUkRLvoFmUs58DQ9VP+uYaufi/taPLR1qYANR300sFeZKNMiNk5dVp2SYQ+O5lFY4Q3AqDKOAUdd3ZZlKZMillgNtRjcFmEFGJpyXT1xDIRMjj+9VAeggtgl8YrgBUht9J3KZWNT1Gj6JK/AKjhO90d8lI9i9fvMGfe0ey3tlmJxpyBC4PT1MlRWlAZoWO4lBbGknmqE5tw0wDDl0aIFb6OBm4LslU47l00+A21XAC7dMQBWNFHhCObu9kh8x5y9/6eBHQwdNUd8FvJ8na1YPsUTyK1h4esPXmxJxPSu0IkXjgtbHHfQRAC1r/N5QPGcTh5wEEDTv7DdvMugF06UgAMCopuDM+oauMcghyQ4dEKYQNHbu7y0sbdiT2QAF7LCFUco5llEQvAAd+ggLtAfvczlO733SugRcLvYXfjdAHs0pEEYEUwFMHQhfxMpca5u4UjW66UsFJjwzPotNB1fYPfmQEWcSQxh4HK3KHufkrECW88XDfqAtilIxHAipDs7loun6T0RGp9whWx6dZQE8XlC7eFgcrcBxeuoNcL1z+s5ALYpSMZwIpOFb30Qhu99GeU2LC7Jdf7oISLJ7bsON44t1G4O7j8iLiSuAB2aVQAXLur3S6A/XATdoC7jgYmu4PrIiKU4EwRynD9WcJZVxjHEQKJfFC/Eu4+YuQC2KWRorToH2zxGRt5d0ds44hlpysoPYMlRO3fUGJjpw/aXIfskkiT+rwBXsQBwzC2TDh5n/uaXToqAPxsbZC2A8Qjn6YNa6/YZhIxxvBH1veeOYkSnlGPC5eG1xf27MEu6rrfMnr9W6kDHbjJfb0uHVUi9MduidOM0gidMT9kOUn4vaO2jxHySSvXzALtOERpBCmaqWcfEz33xdF+oHBCWVztitAujQIHhitjfaufXngnSBt2B6g/PGrboGBtFktA2GD5Ae14ngFe7GqOnc8vHG3wYqoL8fPa2+ZzR5VLowNgxUEa23308tagVTp6vKPZv/UC0HMFoK1S4Pp4lQ3ARxy0sBlgomvt8tLmRj89sznfHVUujRj9nwADAFIAdCgbzMwPAAAAAElFTkSuQmCC"; + + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaScreenshot + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, + + captureToFile: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error capturing the screenshot.'); + } else { + defer.resolve("path"); + } + + return defer.promise; + }, + + captureToUri: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error capturing the screenshot.'); + } else { + defer.resolve(); + } + + return defer.promise; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaSocialSharing + * + * @description + * 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 = []; + + 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; + }, + + 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 + * + * @description + * A service for testing the splash screen + * in an app build with ngCordova. + */ +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; + } + }; +}); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaSQLite + * + * @description + * A service for testing SQLite + * in an app build with ngCordova. + */ + +ngCordovaMocks.factory('$cordovaSQLite', ['$q', function ($q) { + + return { + /** + * These properties are here for the purpose of automated testing only. + **/ + openDBShouldSucceedWith: null, + executeShouldSucceedWith: null, + insertCollectionShouldSucceedWith: null, + nestedExecuteShouldSucceedWith: null, + deleteDBShouldSucceedWith : null, + + openDB: function (options, background) { + if (this.openDBShouldSucceedWith !== null) { + $q.when(this.openDBShouldSucceedWith) + } else { + $q.reject() + } + }, + execute: function (db, query, binding) { + if (this.executeShouldSucceedWith !== null) { + $q.when(this.executeShouldSucceedWith) + } else { + $q.reject() + } + }, + insertCollection: function (db, query, bindings) { + if (this.insertCollectionShouldSucceedWith !== null) { + $q.when(this.insertCollectionShouldSucceedWith) + } else { + $q.reject() + } + }, + nestedExecute: function (db, query1, query2, binding1, binding2) { + if (this.nestedExecuteShouldSucceedWith !== null) { + $q.when(this.nestedExecuteShouldSucceedWith) + } else { + $q.reject() + } + }, + deleteDB: function (dbName) { + if (this.deleteDBShouldSucceedWith !== null) { + $q.when(this.deleteDBShouldSucceedWith) + } else { + $q.reject() + } + } + } +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaStatusbar + * + * @description + * A service for testing the status bar + * in an app build with ngCordova. + */ +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; + }, + + style: function (style) { + // TODO: Review + return style; + }, + + styleHex: function (colorHex) { + // TODO: review + return colorHex; + }, + + styleColor: function (color) { + // TODO: review + return color; + }, + + hide: function () { + this.isStatusBarVisible = false; + }, + + show: function () { + this.isStatusBarVisible = true; + }, + + isVisible: function () { + return this.isStatusBarVisible; + } + }; +}); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaToast + * + * @description + * A service for testing toasts + * in an app build with ngCordova. + * + * @example + */ +ngCordovaMocks.factory('$cordovaToast', ['$q', function ($q) { + var throwsError = false; + + return { + /** + * @ngdoc property + * @name throwsError + * @propertyOf ngCordovaMocks.cordovaToast + * + * @description + * A flag that signals whether a promise should be rejected or not. + * This property should only be used in automated tests. + **/ + throwsError: throwsError, + + showShortTop: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + showShortCenter: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + showShortBottom: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + showLongTop: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + showLongCenter: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + showLongBottom: function (message) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + show: function (message, duration, position) { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error showing the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + }, + hide: function () { + var defer = $q.defer(); + if (this.throwsError) { + defer.reject('There was an error hiding the toast.'); + } else { + defer.resolve(); + } + return defer.promise; + } + }; +}]); + +/** + * @ngdoc service + * @name ngCordovaMocks.cordovaVibration + * + * @description + * A service for testing vibration + * in an app build with ngCordova. + */ +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 + ); + } + } + }, + + /* 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; + } + } + } + }; +}]); + +})();
\ No newline at end of file diff --git a/www/lib/ngCordova/dist/ng-cordova-mocks.min.js b/www/lib/ngCordova/dist/ng-cordova-mocks.min.js new file mode 100644 index 00000000..798bbbdd --- /dev/null +++ b/www/lib/ngCordova/dist/ng-cordova-mocks.min.js @@ -0,0 +1,7 @@ +/*! + * ngCordova + * v0.1.26-alpha + * Copyright 2015 Drifty Co. http://drifty.com/ + * See LICENSE in this repository for license information + */ +!function(){var e=angular.module("ngCordovaMocks",[]);e.factory("$cordovaActionSheet",["$q",function(e){var r=!1;return{throwsError:r,show:function(){var r=e.defer();return this.throwsError?r.reject("There was an error on showing action sheet"):r.resolve(),r.promise}}}]),e.factory("$cordovaAppVersion",["$q",function(e){var r=!1;return{throwsError:r,getAppVersion:function(){var r=e.defer();return r.resolve("mock v"),r.promise}}}]),e.factory("$cordovaBarcodeScanner",["$q",function(e){var r=!1,t="",o="",n=!1;return{throwsError:r,scannedText:t,scannedFormat:o,wasCancelled:n,scan:function(){var r=e.defer();return this.throwsError?r.reject("There was an error scanning."):r.resolve({text:this.scannedText,format:this.scannedFormat,cancelled:this.wasCancelled}),r.promise},encode:function(r,t){this.scannedFormat=r,this.scannedText=t;var o=e.defer();return this.throwsError?o.reject("There was an error encoding the data."):o.resolve(),o.promise}}}]),e.factory("$cordovaBLE",["$q","$timeout","$interval","$log",function(e,r,t,o){var n={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},i={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"}]}]},s=new ArrayBuffer(8);return{scan:function(t,o){var i=e.defer();return r(function(){i.notify(n)},Math.round(1e3*o*Math.random())),r(function(){i.resolve()},1e3*o),i.promise},startScan:function(e,t,o){r(function(){t(n)},Math.round(1e3*Math.random()))},stopScan:function(){var t=e.defer();return r(function(){t.resolve()},500),t.promise},connect:function(t){var o=e.defer();return r(function(){o.resolve(i)},1500),o.promise},disconnect:function(t){var o=e.defer();return r(function(){o.resolve(!0)},500),o.promise},read:function(t,o,n){var i=e.defer();return r(function(){i.resolve(s)},100),i.promise},write:function(t,o,n,i){var s=e.defer();return r(function(){s.resolve(!0)},100),s.promise},writeWithoutResponse:function(t,o,n,i){var s=e.defer();return r(function(){s.resolve(!0)},100),s.promise},writeCommand:function(e,r,t,n){return o.warning("writeCommand is deprecated, use writeWithoutResponse"),this.writeWithoutResponse(e,r,t,n)},startNotification:function(e,r,o,n,i){t(function(){var e=new Uint8Array([Math.round(255*Math.random())]);n(e)},200,10)},stopNotification:function(t,o,n){var i=e.defer();return r(function(){i.resolve()},100),i.promise},isConnected:function(r){var t=e.defer();return t.resolve(!0),t.promise},enable:function(){var t=e.defer();return r(function(){t.resolve()},1500),t.promise},isEnabled:function(){var r=e.defer();return r.resolve(!0),r.promise}}}]),e.factory("$cordovaBrightness",["$q",function(e){var r=100;return{get:function(){var t=e.defer();return t.resolve(r),t.promise},set:function(t){var o=e.defer();return r=t,o.resolve("OK"),o.promise},setKeepScreenOn:function(r){var t=e.defer();return t.resolve("OK"),t.promise}}}]),e.factory("$cordovaCamera",["$q",function(e){var r=!1,t="";return{throwsError:r,imageData:t,getPicture:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error getting the picture."):(r&&(r=r),t.resolve(this.imageData)),t.promise}}}]),e.factory("$cordovaCapture",["$q",function(e){var r=!1;return{throwsError:r,captureAudio:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the audio."):r.resolve(),r.promise},captureImage:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the image."):r.resolve(),r.promise},captureVideo:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the video."):r.resolve(),r.promise}}}]),e.factory("$cordovaContacts",["$q",function(e){var r=!1,t=[];return{throwsError:r,contacts:t,save:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,n=0;n<this.contacts.length;n++)if(this.contacts[n].id===r.id){o=n;break}null===o?(this.contacts.push(r),t.resolve()):t.reject("Contact already exists.")}return t.promise},remove:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error saving the contact.");else{for(var o=null,n=0;n<this.contacts.length;n++)if(this.contacts[n].id===r.id){o=n;break}null===o?t.reject("Unable to find contact."):(this.contacts.splice(o,1),t.resolve())}return t.promise},find:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error finding the contact.");else{var o=r.fields||["id","displayName"];if(delete r.fields,o)if("*"===o)t.resolve(this.contacts);else{for(var n=[],i=0;i<this.contacts.length;i++)for(var s in this.contacts[i])var a=this.contacts[i][s];t.resolve(n)}else t.reject("ContactError.INVALID_ARGUMENT_ERROR")}return t.promise}}}]),e.factory("$cordovaDatePicker",["$q",function(e){return{show:function(r){var t=e.defer();return r=r||{date:new Date,mode:"date"},t.resolve(r.date),t.promise}}}]),e.factory("$cordovaDevice",function(){var e="",r="",t="",o="",n="",i="";return{device:e,cordova:r,model:t,platform:o,uuid:n,version:i,version:i,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},getManufacturer:function(){return this.manufacturer}}}),e.factory("$cordovaDeviceMotion",["$interval","$q",function(e,r){var t=null,o=!1,n=[],i=[];return{currentAcceleration:t,throwsError:o,positions:n,watchIntervals:i,getCurrentAcceleration:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the current acceleration."):e.resolve(this.currentAcceleration),e.promise},watchAcceleration:function(t){var o=r.defer(),n=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 i=1e4;t&&t.frequency&&(i=t.frequency),this.watchIntervals.push(e(function(){self.throwsError&&o.reject("There was an error watching the acceleration.");var e=Math.floor(100*Math.random()+1),r=Math.floor(100*Math.random()+1),t=Math.floor(100*Math.random()+1),n={x:e,y:r,z:t,timestamp:Date.now()};self.positions.push(n),o.notify(n)},i))}return{watchId:n,promise:o.promise}},clearWatch:function(t){var o=r.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){e.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}}}]),e.factory("$cordovaDeviceOrientation",["$interval","$q",function(e,r){var t=null,o=!1,n=[],i=[];return{currentHeading:t,throwsError:o,readings:n,watchIntervals:i,getCurrentHeading:function(){var e=r.defer();return this.throwsError?e.reject("There was an error getting the current heading."):e.resolve(this.currentHeading),e.promise},watchHeading:function(t){var o=r.defer(),n=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:n,interval:e(function(){s.throwsError&&o.reject("There was an error watching the acceleration.");var e=359.99*Math.random()+1,r=359.99*Math.random()+1,t=Math.floor(360*Math.random()+1),n={magneticHeading:e,trueHeading:r,headingAccuracy:t,timestamp:Date.now()};s.readings.push(n),o.notify(n)},a)})}var c=function(r){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===r){e.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(e){c(e||n)},o.promise.watchID=n,o.promise},clearWatch:function(t){var o=r.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){e.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}}}]),e.factory("$cordovaDialogs",["$q",function(e){var r=!1,t="",o="",n="",i=0,s=!0;return{dialogText:r,dialogTitle:t,defaultValue:o,promptResponse:n,buttonLabels:[],beepCount:i,useHostAbilities:s,alert:function(r,t,o){var n=e.defer();return this.useHostAbilities?(alert(r),n.resolve()):(this.dialogText=r,this.dialogTitle=t,this.buttonLabels.push(o),n.resolve()),n.promise},confirm:function(r,t,o){var n=e.defer();if(this.useHostAbilities){var i=confirm(r);n.resolve(i?2:1)}else this.dialogText=r,this.dialogTitle=t,this.buttonLabels.push(o),n.resolve(0);return n.promise},prompt:function(r,t,o,n){var i=e.defer();if(this.useHostAbilities){var s=prompt(r,n);i.resolve(s)}else{this.dialogText=r,this.dialogTitle=t,this.defaultValue=n;for(var a=0;a<o.length;a++)this.buttonLabels.push(o[a]);i.resolve(this.promptResponse)}return i.promise},beep:function(e){this.beepCount=e}}}]),e.factory("$cordovaFacebook",["$q",function(e){return{loginShouldSucceedWith:null,showDialogShouldSucceedWith:null,apiShouldSucceedWith:null,getAccessTokenShouldSucceedWith:null,getLoginStatusShouldSucceedWith:null,logoutShouldSuceedWith:null,login:function(r){return null!==this.loginShouldSucceedWith?e.when(this.loginShouldSucceedWith):e.reject()},showDialog:function(r){return null!==this.showDialogShouldSucceedWith?e.when(this.showDialogShouldSucceedWith):e.reject()},api:function(r,t){return null!==this.apiShouldSucceedWith?e.when(this.apiShouldSucceedWith):e.reject()},getAccessToken:function(){return null!==this.getAccessTokenShouldSucceedWith?e.when(this.getAccessTokenShouldSucceedWith):e.reject()},getLoginStatus:function(){return null!==this.getLoginStatusShouldSucceedWith?e.when(this.getLoginStatusShouldSucceedWith):e.reject()},logout:function(){return null!==this.logoutShouldSuceedWith?e.when(this.logoutShouldSuceedWith):e.reject()}}}]),e.factory("$cordovaFile",["$q",function(e){var r=!1,t={},o=!1,n={},i=function(r){var t=e.defer();return this.throwsError?t.reject(r):t.resolve(),t.promise};return{throwsError:r,fileSystem:t,shouldMockFiles:o,files:n,checkDir:function(r){if(this.shouldMockFiles){var t=e.defer();return this.files[r]&&!this.files[r].isFile?t.resolve():t.reject(),t.promise}return i.call(this,"There was an error checking the directory.")},createDir:function(r,t){if(this.shouldMockFiles){var o=e.defer();return this.files[r]={isFile:!1},o.resolve(),o.promise}return i.call(this,"There was an error creating the directory.")},listDir:function(e){return i.call(this,"There was an error listing the directory")},checkFile:function(r){if(this.shouldMockFiles){var t=e.defer();return this.files[r]&&this.files[r].isFile?t.resolve():t.reject(),t.promise}return i.call(this,"There was an error checking for the file.")},createFile:function(r,t){if(this.shouldMockFiles){var o=e.defer();return this.files[r]={isFile:!0,fileContent:""},o.resolve(),o.promise}return i.call(this,"There was an error creating the file.")},removeFile:function(e,r){return i.call(this,"There was an error removng the file.")},writeFile:function(e,r,t){return this.shouldMockFiles&&e&&r&&(this.files[e]={isFile:!0,fileContent:r}),i.call(this,"There was an error writing the file.")},readFile:function(e){return this.readAsText(e)},readAsText:function(r){if(this.shouldMockFiles){var t=e.defer();return n[r]&&n[r].isFile?t.resolve(n[r].fileContent):t.reject(),t.promise}return i.call(this,"There was an error reading the file as text.")},readAsDataURL:function(e){return i.call(this,"There was an error reading the file as a data url.")},readAsBinaryString:function(e){return i.call(this,"There was an error reading the file as a binary string.")},readAsArrayBuffer:function(e){return i.call(this,"There was an error reading the file as an array buffer.")},readFileMetadata:function(e){return i.call(this,"There was an error reading the file metadata")},readFileAbsolute:function(e){return i.call(this,"There was an error reading the file from the absolute path")},readFileMetadataAbsolute:function(e){return i.call(this,"There was an error reading the file metadta from the absolute path")}}}]),e.factory("$cordovaFileOpener2",["$q",function(e){var r=!1;return{throwsError:r,open:function(r,t){var o=e.defer();return this.throwError?o.reject({status:0,message:"There was an error capturing the file."}):o.resolve(),o.promise},uninstall:function(r){var t=e.defer();return this.throwError?t.reject({status:0,message:"There was an error capturing the packageId."}):t.resolve(),t.promise},appIsInstalled:function(r){var t=e.defer();return this.throwError?t.reject({status:0,message:"There was an error capturing the packageId."}):t.resolve(),t.promise}}}]),e.factory("$cordovaFileTransfer",["$q",function(e){var r=!1,t=function(r){var t=e.defer();return this.throwsError?t.reject(r):t.resolve(),t.promise};return{throwsError:r,download:function(e,r,o,n){return t.call(this,"There was an error downloading the file.")},upload:function(e,r,o){return t.call(this,"There was an error uploading the file.")}}}]),e.factory("$cordovaGeolocation",["$interval","$q",function(e,r){var t=!1,o=!0,n=[],i=[],s=null,a=null;return{throwsError:t,watchIntervals:n,locations:i,currentPosition:s,nextPosition:a,useHostAbilities:o,getCurrentPosition:function(e){var t=r.defer();return this.throwsError?t.reject("There was an error getting the location."):(e&&(e=e),this.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){this.currentPosition=e,t.resolve(this.currentPosition)},function(e){t.reject(e)}):t.reject("Geolocation is not supported by this browser."):t.resolve(this.currentPosition)),t.promise},watchPosition:function(t){var o=r.defer(),i=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:i,interval:e(function(){s.throwsError&&o.reject("There was an error watching the geolocation.");var e=s.nextPosition;null===e&&(s.useHostAbilities?navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){s.currentPosition=e,s.locations.push(e),o.resolve(e)},function(e){o.reject(e)}):o.reject("Geolocation is not supported by this browser."):(e={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=e,s.locations.push(e),o.notify(e)))},a)})}var c=function(r){for(var t=-1,o=0;o<s.watchIntervals.length;o++)if(s.watchIntervals[o].watchID===r){e.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(e){c(e||i)},o.promise.watchID=i,o.promise},clearWatch:function(t){var o=r.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){e.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}}}]),e.factory("$cordovaGlobalization",["$q",function(e){var r=!1,t=navigator.language?navigator.language:"en-US",o={value:t},n="Sunday",i={value:t};return{throwsError:r,preferredLanguage:o,localeName:i,firstDayOfWeek:n,getPreferredLanguage:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the preferred language."):r.resolve(this.preferredLanguage),r.promise},getLocaleName:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the locale name."):r.resolve(this.localeName),r.promise},getFirstDayOfWeek:function(){var r=e.defer();return this.throwsError?r.reject("There was an error getting the first day of week."):r.resolve(this.firstDayOfWeek),r.promise},dateToString:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error getting the string from the date.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},stringToDate:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error getting the date from the string.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},getDatePattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting the date pattern.");else{var o="";r=r,t.resolve(o)}return t.promise},getDateNames:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting the date names.");else{var o="";r=r,t.resolve(o)}return t.promise},isDayLightSavingsTime:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error getting if this is in daylight savings time mode.");else{var o="";r=r,t.resolve(o)}return t.promise},numberToString:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error convertng the number to a string.");else{var n="";r=r,t=t,o.resolve(n)}return o.promise},stringToNumber:function(r,t){var o=e.defer();if(this.throwsError)o.reject("There was an error convertng the string to a number.");else{var n="";t=t,o.resolve(n)}return o.promise},getNumberPattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";r=r,t.resolve(o)}return t.promise},getCurrencyPattern:function(r){var t=e.defer();if(this.throwsError)t.reject("There was an error convertng the string to a number.");else{var o="";r=r,t.resolve(o)}return t.promise}}}]),e.factory("$cordovaGoogleAnalytics",["$q",function(e){var r=!1,t={};t.throwsError=r;var o=["startTrackerWithId","setUserId","debugMode","trackView","addCustomDimension","trackEvent","trackException","trackTiming","addTransaction","addTransactionItem"];return o.forEach(function(r){t[r]=function(){var r=e.defer();return this.throwsError?r.reject():r.resolve(),r.promise}}),t}]),e.factory("$cordovaGooglePlayGame",["$q",function(e){var r=!1,t=!1,o="";return{_throwsError:r,_isSignedIn:t,_displayName:o,auth:function(){var r=e.defer();return this._throwsError?r.reject("There was a auth error."):(this.isSignedIn=!0,r.resolve("SIGN IN SUCCESS")),r.promise},signout:function(){var r=e.defer();return this.throwsError?r.reject("There was a signout error."):r.resolve(),r.promise},isSignedIn:function(){var r=e.defer();return this._throwsError?r.reject("There was a isSignedIn error."):r.resolve({isSignedIn:this._isSignedIn}),r.promise},showPlayer:function(){var r=e.defer();return this.throwsError?r.reject("There was a showPlayer error."):r.resolve({displayName:this._displayName}),r.promise},submitScore:function(r){var t=e.defer();return this._throwsError?t.reject("There was a submitScore error."):t.resolve("OK"),t.promise},showAllLeaderboards:function(){var r=e.defer();return this.throwsError?r.reject("There was a showAllLeaderboards error."):r.resolve("OK"),r.promise},showLeaderboard:function(r){var t=e.defer();return this._throwsError?t.reject("There was a showLeaderboard error."):t.resolve("OK"),t.promise},unlockAchievement:function(r){var t=e.defer();return this.throwsError?t.reject("There was a unlockAchievement error."):t.resolve("OK"),t.promise},incrementAchievement:function(r){var t=e.defer();return this._throwsError?t.reject("There was a incrementAchievement error."):t.resolve("OK"),t.promise},showAchievements:function(){var r=e.defer();return this.throwsError?r.reject("There was a showAchievements error."):r.resolve("OK"),r.promise}}}]),e.factory("$cordovaKeyboard",function(){var e=!1;return{hideAccessoryBar:function(e){},close:function(){e=!1},show:function(){e=!0},disableScroll:function(e){},isVisible:function(){return e}}}),e.factory("$cordovaKeychain",["$q",function(e){var r={};return{keychains:r,getForKey:function(r,t){var o=e.defer();return this.keychains[t]?o.resolve(this.keychains[t][r]):o.reject(),o.promise},setForKey:function(r,t,o){var n=e.defer();return this.keychains[t]||(this.keychains[t]={}),this.keychains[t][r]=o,n.resolve(),n.promise},removeForKey:function(r,t){var o=e.defer();return this.keychains[t]&&delete this.keychains[t][r],o.resolve(),o.promise}}}]),e.factory("$cordovaLocalNotification",["$q",function(e){function r(e){return o+e}function t(){for(var r=e.defer(),t=[],n=0,i=localStorage.length;i>n;++n)localStorage.key(n).indexOf(o)>-1&&t.push(parseInt(localStorage.key(n).split("-")[1]));return r.resolve(t),r.promise}var o="ngCordLocNotif-";return{cancel:function(t){var o=e.defer();return"number"==typeof t&&(t=[t]),t.forEach(function(e){localStorage.removeItem([r(e)])}),o.resolve(),o.promise},cancelAll:function(){var r=e.defer();return r.resolve(),r.promise},clear:function(t){"number"==typeof t&&(t=[t]);var o=e.defer();return t.forEach(function(e){localStorage.removeItem([r(e)])}),o.resolve(),o.promise},clearAll:function(){var r=e.defer();return r.promise},isScheduled:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!0):o.resolve(!1),o.promise},isPresent:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!0):o.resolve(!1),o.promise},isTriggered:function(t){var o=e.defer();return localStorage[r(t)]?o.resolve(!1):o.resolve(!0),o.promise},getAllIds:function(){return t()},getIds:function(){return t()},getScheduledIds:function(){return t()},getTriggeredIds:function(){var r=e.defer();return r.resolve([]),r.promise},hasPermission:function(r){var t=e.defer();return t.resolve(!0),t.promise},schedule:function(t){var o=e.defer(),n=r(t.id);return localStorage[n]=JSON.stringify(t),o.resolve(),o.promise},update:function(t){var o=e.defer(),n=r(t.id);return localStorage[n]=JSON.stringify(t),o.resolve(),o.promise}}}]),e.factory("$cordovaNetwork",["$rootScope",function(e){var r="WiFi connection",t=!0;return{connectionType:r,isConnected:t,switchToOnline:function(){this.isConnected=!0,e.$broadcast("$cordovaNetwork:online")},switchToOffline:function(){this.isConnected=!1,e.$broadcast("$cordovaNetwork:offline")},getNetwork:function(){return this.connectionType},isOnline:function(){return this.isConnected},isOffline:function(){return!this.isConnected}}}]),e.factory("$cordovaProgress",["$timeout",function(e){return{show:function(e){var r=e||"Please wait...";console.info("$cordovaProgress.message",r)},showSimple:function(e){var r=e||!1;console.info("$cordovaProgress.dim",r)},showSimpleWithLabel:function(e,r){var t=e||!1,o=r||"Loading...";console.group(),console.info("$cordovaProgress.dim",t),console.info("$cordovaProgress.label",o),console.groupEnd()},showSimpleWithLabelDetail:function(e,r,t){var o=e||!1,n=r||"Loading...",i=t||"Please wait";console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.label",n),console.info("$cordovaProgress.detail",i),console.groupEnd()},showDeterminate:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim show",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showDeterminateWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.timeout",i),console.info("$cordovaProgress.label",s),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showAnnular:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showAnnularWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.timeout",i),console.info("$cordovaProgress.label",s),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showBar:function(r,t){var o=r||!1,n=t||5e4;console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.timeout",n),console.groupEnd(),e(function(){console.info("$cordovaProgress.dim timeout",o)},n)},showBarWithLabel:function(r,t,o){var n=r||!1,i=t||5e4,s=o||"Loading...";console.group(),console.info("$cordovaProgress.dim",n),console.info("$cordovaProgress.label",s),console.info("$cordovaProgress.timeout",i),console.groupEnd(),e(function(){console.info("$cordovaProgress[dim, label] timeout",[n,s])},i)},showSuccess:function(e,r){var t=e||!1,o=r||"Success";console.group(),console.info("$cordovaProgress.dim",t),console.info("$cordovaProgress.label",o),console.groupEnd()},showText:function(e,r,t){var o=e||!1,n=r||"Warning",i=t||"center";console.group(),console.info("$cordovaProgress.dim",o),console.info("$cordovaProgress.text",n),console.info("$cordovaProgress.position",i),console.groupEnd()},hide:function(){console.info("$cordovaProgress.hide")}}}]),e.factory("$cordovaPush",["$q","$timeout","$rootScope",function(e,r,t){var o=!1,n="";return{throwsError:o,deviceToken:n,onNotification:function(e){r(function(){t.$broadcast("$cordovaPush:notificationReceived",e)})},register:function(r){var t=this,o=e.defer();return void 0!==r&&void 0===r.ecb&&(r.ecb=this.onNotification),this.throwsError?o.reject("There was a register error."):(o.resolve(this.deviceToken),r&&r.ecb&&r.ecb({event:"registered",regid:t.deviceToken})),o.promise},unregister:function(r){var t=e.defer();return this.throwsError?t.reject("There was a register error."):t.resolve(),t.promise}}}]),e.factory("$cordovaScreenshot",["$q",function(e){var r=!1;return{throwsError:r,captureToFile:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the screenshot."):r.resolve("path"),r.promise},captureToUri:function(){var r=e.defer();return this.throwsError?r.reject("There was an error capturing the screenshot."):r.resolve(),r.promise}}}]),e.factory("$cordovaSocialSharing",["$q",function(e){var r=!1,t="",o="",n="",i="",s="",a="",c=[],h=[],u=[];return{throwsError:r,message:t,image:o,link:n,number:i,subject:a,toAddresses:c,bccAddresses:h,socialService:s,attachments:u,shareViaTwitter:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via Twitter."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaWhatsApp:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via WhatsApp."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaFacebook:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error sharing via Facebook."):(this.message=r,this.image=t,this.link=o,n.resolve()),n.promise},shareViaSMS:function(r,t){var o=e.defer();return this.throwsError?o.reject("There was an error sharing via SMS."):(this.message=r,this.number=t,o.resolve()),o.promise},shareViaEmail:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=r,this.subject=t,this.toAddresses=o,this.bccAddressesc=n,this.attachments=i,s.resolve()),s.promise},canShareViaEmail:function(){var r=e.defer();return this.throwsError?r.reject(!1):r.resolve(!0),r.promise},canShareVia:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.message=t,this.socialService=r,this.subject=o,this.attachments=n,this.link=i,s.resolve()),s.promise},shareVia:function(r,t,o,n,i){var s=e.defer();return this.throwsError?s.reject("There was an error sharing via SMS."):(this.socialService=r,this.message=t,this.subject=o,this.attachments=n,this.link=i,s.resolve()),s.promise},share:function(r,t,o,n){var i=e.defer();return this.throwsError?i.reject("There was an error sharing via SMS."):(this.message=r,this.subject=t,this.attachments=o,this.link=n,i.resolve()),i.promise}}}]),e.factory("$cordovaSplashscreen",function(){var e=!1;return{isVisible:e,hide:function(){return this.isVisible=!1,!0},show:function(){return this.isVisible=!0,!0}}}),e.factory("$cordovaSQLite",["$q",function(e){return{openDBShouldSucceedWith:null,executeShouldSucceedWith:null,insertCollectionShouldSucceedWith:null,nestedExecuteShouldSucceedWith:null,deleteDBShouldSucceedWith:null,openDB:function(r,t){null!==this.openDBShouldSucceedWith?e.when(this.openDBShouldSucceedWith):e.reject()},execute:function(r,t,o){null!==this.executeShouldSucceedWith?e.when(this.executeShouldSucceedWith):e.reject()},insertCollection:function(r,t,o){null!==this.insertCollectionShouldSucceedWith?e.when(this.insertCollectionShouldSucceedWith):e.reject()},nestedExecute:function(r,t,o,n,i){null!==this.nestedExecuteShouldSucceedWith?e.when(this.nestedExecuteShouldSucceedWith):e.reject()},deleteDB:function(r){null!==this.deleteDBShouldSucceedWith?e.when(this.deleteDBShouldSucceedWith):e.reject()}}}]),e.factory("$cordovaStatusbar",function(){var e=!0,r=!0;return{isStatusBarVisible:e,canOverlayWebView:r,overlaysWebView:function(e){this.canOverlayWebView=e},style:function(e){return e},styleHex:function(e){return e},styleColor:function(e){return e},hide:function(){this.isStatusBarVisible=!1},show:function(){this.isStatusBarVisible=!0},isVisible:function(){return this.isStatusBarVisible}}}),e.factory("$cordovaToast",["$q",function(e){var r=!1;return{throwsError:r,showShortTop:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showShortCenter:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showShortBottom:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongTop:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongCenter:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},showLongBottom:function(r){var t=e.defer();return this.throwsError?t.reject("There was an error showing the toast."):t.resolve(),t.promise},show:function(r,t,o){var n=e.defer();return this.throwsError?n.reject("There was an error showing the toast."):n.resolve(),n.promise},hide:function(){var r=e.defer();return this.throwsError?r.reject("There was an error hiding the toast."):r.resolve(),r.promise}}}]),e.factory("$cordovaVibration",["$timeout",function(e){var r=!1,t=null;return{vibrateTimer:t,isVibrating:r,vibrate:function(r){r>0&&(this.isVibrating=!0,self=this,r instanceof Array?this.vibrateTimer=e(function(){self.isVibrating=!1,self.vibrateTimer=null},r[0]):this.vibrateTimer=e(function(){self.isVibrating=!1,self.vibrateTimer=null},r))},vibrateWithPattern:function(e,r){},cancelVibration:function(){null!==this.vibrateTimer&&this.isVibrating===!0&&(e.cancel(this.vibrateTimer),this.isVibrating=!1)}}}])}();
\ No newline at end of file diff --git a/www/lib/ngCordova/dist/ng-cordova.js b/www/lib/ngCordova/dist/ng-cordova.js new file mode 100644 index 00000000..a59620b6 --- /dev/null +++ b/www/lib/ngCordova/dist/ng-cordova.js @@ -0,0 +1,7061 @@ +/*! + * ngCordova + * v0.1.26-alpha + * Copyright 2015 Drifty Co. http://drifty.com/ + * See LICENSE in this repository for license information + */ +(function(){ + +angular.module('ngCordova', [ + 'ngCordova.plugins' +]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git +// link : https://github.com/EddyVerbruggen/cordova-plugin-actionsheet + +angular.module('ngCordova.plugins.actionSheet', []) + + .factory('$cordovaActionSheet', ['$q', '$window', function ($q, $window) { + + return { + show: function (options) { + var q = $q.defer(); + + $window.plugins.actionsheet.show(options, function (result) { + q.resolve(result); + }); + + return q.promise; + }, + + hide: function () { + return $window.plugins.actionsheet.hide(); + } + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-admob.git +// link : https://github.com/floatinghotpot/cordova-plugin-admob + +angular.module('ngCordova.plugins.adMob', []) + + .factory('$cordovaAdMob', ['$q', '$window', function ($q, $window) { + + return { + createBannerView: function (options) { + var d = $q.defer(); + + $window.plugins.AdMob.createBannerView(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createInterstitialView: function (options) { + var d = $q.defer(); + + $window.plugins.AdMob.createInterstitialView(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + requestAd: function (options) { + var d = $q.defer(); + + $window.plugins.AdMob.requestAd(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showAd: function (options) { + var d = $q.defer(); + + $window.plugins.AdMob.showAd(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + requestInterstitialAd: function (options) { + var d = $q.defer(); + + $window.plugins.AdMob.requestInterstitialAd(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/ohh2ahh/AppAvailability.git +// link : https://github.com/ohh2ahh/AppAvailability + +/* globals appAvailability: true */ +angular.module('ngCordova.plugins.appAvailability', []) + + .factory('$cordovaAppAvailability', ['$q', function ($q) { + + return { + check: function (urlScheme) { + var q = $q.defer(); + + appAvailability.check(urlScheme, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/pushandplay/cordova-plugin-apprate.git +// link : https://github.com/pushandplay/cordova-plugin-apprate + +/* globals AppRate: true */ +angular.module('ngCordova.plugins.appRate', []) + + .provider('$cordovaAppRate', [function () { + + /** + * Set defaults settings to AppRate + * + * @param {Object} defaults - AppRate default settings + * @param {string} defaults.language + * @param {string} defaults.appName + * @param {boolean} defaults.promptForNewVersion + * @param {boolean} defaults.openStoreInApp + * @param {number} defaults.usesUntilPrompt + * @param {boolean} defaults.useCustomRateDialog + * @param {string} defaults.iosURL + * @param {string} defaults.androidURL + * @param {string} defaults.blackberryURL + * @param {string} defaults.windowsURL + */ + this.setPreferences = function (defaults) { + if (!defaults || !angular.isObject(defaults)) { + return; + } + + AppRate.preferences.useLanguage = defaults.language || null; + AppRate.preferences.displayAppName = defaults.appName || ''; + AppRate.preferences.promptAgainForEachNewVersion = defaults.promptForNewVersion || true; + AppRate.preferences.openStoreInApp = defaults.openStoreInApp || false; + AppRate.preferences.usesUntilPrompt = defaults.usesUntilPrompt || 3; + AppRate.preferences.useCustomRateDialog = defaults.useCustomRateDialog || false; + AppRate.preferences.storeAppURL.ios = defaults.iosURL || null; + AppRate.preferences.storeAppURL.android = defaults.androidURL || null; + AppRate.preferences.storeAppURL.blackberry = defaults.blackberryURL || null; + AppRate.preferences.storeAppURL.windows8 = defaults.windowsURL || null; + }; + + /** + * Set custom locale + * + * @param {Object} customObj + * @param {string} customObj.title + * @param {string} customObj.cancelButtonLabel + * @param {string} customObj.laterButtonLabel + * @param {string} customObj.rateButtonLabel + */ + this.setCustomLocale = function (customObj) { + var strings = { + 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' + }; + + strings = angular.extend(strings, customObj); + + AppRate.preferences.customLocale = strings; + }; + + this.$get = ['$q', function ($q) { + return { + promptForRating: function (immediate) { + var q = $q.defer(); + var prompt = AppRate.promptForRating(immediate); + q.resolve(prompt); + + return q.promise; + }, + + navigateToAppStore: function () { + var q = $q.defer(); + var navigate = AppRate.navigateToAppStore(); + q.resolve(navigate); + + return q.promise; + }, + + onButtonClicked: function (cb) { + AppRate.onButtonClicked = function (buttonIndex) { + cb.call(this, buttonIndex); + }; + }, + + onRateDialogShow: function (cb) { + AppRate.onRateDialogShow = cb(); + } + }; + }]; + }]); + +// install : cordova plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git +// link : https://github.com/whiteoctober/cordova-plugin-app-version + +angular.module('ngCordova.plugins.appVersion', []) + + .factory('$cordovaAppVersion', ['$q', function ($q) { + + return { + getAppName: function () { + var q = $q.defer(); + cordova.getAppVersion.getAppName(function (name) { + q.resolve(name); + }); + + return q.promise; + }, + + getPackageName: function () { + var q = $q.defer(); + cordova.getAppVersion.getPackageName(function (pack) { + q.resolve(pack); + }); + + return q.promise; + }, + + getVersionNumber: function () { + var q = $q.defer(); + cordova.getAppVersion.getVersionNumber(function (version) { + q.resolve(version); + }); + + return q.promise; + }, + + getVersionCode: function () { + var q = $q.defer(); + cordova.getAppVersion.getVersionCode(function (code) { + q.resolve(code); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/christocracy/cordova-plugin-background-geolocation.git +// link : https://github.com/christocracy/cordova-plugin-background-geolocation + +angular.module('ngCordova.plugins.backgroundGeolocation', []) + + .factory('$cordovaBackgroundGeolocation', ['$q', '$window', function ($q, $window) { + + return { + + init: function () { + $window.navigator.geolocation.getCurrentPosition(function (location) { + return location; + }); + }, + + configure: function (options) { + + this.init(); + var q = $q.defer(); + + $window.plugins.backgroundGeoLocation.configure( + function (result) { + q.notify(result); + $window.plugins.backgroundGeoLocation.finish(); + }, + function (err) { + q.reject(err); + }, options); + + this.start(); + + return q.promise; + }, + + start: function () { + var q = $q.defer(); + + $window.plugins.backgroundGeoLocation.start( + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + + return q.promise; + }, + + stop: function () { + var q = $q.defer(); + + $window.plugins.backgroundGeoLocation.stop( + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + + return q.promise; + } + }; + } + + ]); + +// 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', []) + + .factory('$cordovaBadge', ['$q', function ($q) { + + return { + hasPermission: function () { + var q = $q.defer(); + cordova.plugins.notification.badge.hasPermission(function (permission) { + if (permission) { + q.resolve(true); + } else { + q.reject('You do not have permission'); + } + }); + + return q.promise; + }, + + promptForPermission: function () { + return cordova.plugins.notification.badge.promptForPermission(); + }, + + set: function (badge, callback, scope) { + var q = $q.defer(); + + cordova.plugins.notification.badge.hasPermission(function (permission) { + if (permission) { + q.resolve( + cordova.plugins.notification.badge.set(badge, callback, scope) + ); + } else { + q.reject('You do not have permission to set Badge'); + } + }); + return q.promise; + }, + + get: function () { + var q = $q.defer(); + cordova.plugins.notification.badge.hasPermission(function (permission) { + if (permission) { + cordova.plugins.notification.badge.get(function (badge) { + q.resolve(badge); + }); + } else { + q.reject('You do not have permission to get Badge'); + } + }); + + return q.promise; + }, + + clear: function (callback, scope) { + var q = $q.defer(); + + cordova.plugins.notification.badge.hasPermission(function (permission) { + if (permission) { + q.resolve(cordova.plugins.notification.badge.clear(callback, scope)); + } else { + q.reject('You do not have permission to clear Badge'); + } + }); + return q.promise; + }, + + increase: function (count, callback, scope) { + var q = $q.defer(); + + this.hasPermission().then(function (){ + q.resolve( + cordova.plugins.notification.badge.increase(count, callback, scope) + ); + }, function (){ + q.reject('You do not have permission to increase Badge'); + }) ; + + return q.promise; + }, + + decrease: function (count, callback, scope) { + var q = $q.defer(); + + this.hasPermission().then(function (){ + q.resolve( + cordova.plugins.notification.badge.decrease(count, callback, scope) + ); + }, function (){ + q.reject('You do not have permission to decrease Badge'); + }) ; + + return q.promise; + }, + + configure: function (config) { + return cordova.plugins.notification.badge.configure(config); + } + }; + }]); + +// install : cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git +// link : https://github.com/phonegap/phonegap-plugin-barcodescanner + +angular.module('ngCordova.plugins.barcodeScanner', []) + + .factory('$cordovaBarcodeScanner', ['$q', function ($q) { + + return { + scan: function (config) { + var q = $q.defer(); + + cordova.plugins.barcodeScanner.scan(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }, config); + + return q.promise; + }, + + encode: function (type, data) { + var q = $q.defer(); + type = type || 'TEXT_TYPE'; + + cordova.plugins.barcodeScanner.encode(type, data, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-battery-status +// link : https://github.com/apache/cordova-plugin-battery-status + +angular.module('ngCordova.plugins.batteryStatus', []) + + .factory('$cordovaBatteryStatus', ['$rootScope', '$window', '$timeout', function ($rootScope, $window, $timeout) { + + /** + * @param {string} status + */ + var batteryStatus = function (status) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBatteryStatus:status', status); + }); + }; + + /** + * @param {string} status + */ + var batteryCritical = function (status) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBatteryStatus:critical', status); + }); + }; + + /** + * @param {string} status + */ + var batteryLow = function (status) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBatteryStatus:low', status); + }); + }; + + document.addEventListener('deviceready', function () { + if (navigator.battery) { + $window.addEventListener('batterystatus', batteryStatus, false); + $window.addEventListener('batterycritical', batteryCritical, false); + $window.addEventListener('batterylow', batteryLow, false); + + } + }, false); + return true; + }]) + .run(['$injector', function ($injector) { + $injector.get('$cordovaBatteryStatus'); //ensure the factory and subsequent event listeners get initialised + }]); + +// install : cordova plugin add https://github.com/petermetz/cordova-plugin-ibeacon.git +// link : https://github.com/petermetz/cordova-plugin-ibeacon + +angular.module('ngCordova.plugins.beacon', []) + + .factory('$cordovaBeacon', ['$window', '$rootScope', '$timeout', '$q', function ($window, $rootScope, $timeout, $q) { + var callbackDidDetermineStateForRegion = null; + var callbackDidStartMonitoringForRegion = null; + var callbackDidExitRegion = null; + var callbackDidEnterRegion = null; + var callbackDidRangeBeaconsInRegion = null; + var callbackPeripheralManagerDidStartAdvertising = null; + var callbackPeripheralManagerDidUpdateState = null; + var callbackDidChangeAuthorizationStatus = null; + + document.addEventListener('deviceready', function () { + if ($window.cordova && + $window.cordova.plugins && + $window.cordova.plugins.locationManager) { + var delegate = new $window.cordova.plugins.locationManager.Delegate(); + + delegate.didDetermineStateForRegion = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didDetermineStateForRegion', pluginResult); + }); + + if (callbackDidDetermineStateForRegion) { + callbackDidDetermineStateForRegion(pluginResult); + } + }; + + delegate.didStartMonitoringForRegion = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didStartMonitoringForRegion', pluginResult); + }); + + if (callbackDidStartMonitoringForRegion) { + callbackDidStartMonitoringForRegion(pluginResult); + } + }; + + delegate.didExitRegion = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didExitRegion', pluginResult); + }); + + if (callbackDidExitRegion) { + callbackDidExitRegion(pluginResult); + } + }; + + delegate.didEnterRegion = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didEnterRegion', pluginResult); + }); + + if (callbackDidEnterRegion) { + callbackDidEnterRegion(pluginResult); + } + }; + + delegate.didRangeBeaconsInRegion = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didRangeBeaconsInRegion', pluginResult); + }); + + if (callbackDidRangeBeaconsInRegion) { + callbackDidRangeBeaconsInRegion(pluginResult); + } + }; + + delegate.peripheralManagerDidStartAdvertising = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:peripheralManagerDidStartAdvertising', pluginResult); + }); + + if (callbackPeripheralManagerDidStartAdvertising) { + callbackPeripheralManagerDidStartAdvertising(pluginResult); + } + }; + + delegate.peripheralManagerDidUpdateState = function (pluginResult) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:peripheralManagerDidUpdateState', pluginResult); + }); + + if (callbackPeripheralManagerDidUpdateState) { + callbackPeripheralManagerDidUpdateState(pluginResult); + } + }; + + delegate.didChangeAuthorizationStatus = function (status) { + $timeout(function () { + $rootScope.$broadcast('$cordovaBeacon:didChangeAuthorizationStatus', status); + }); + + if (callbackDidChangeAuthorizationStatus) { + callbackDidChangeAuthorizationStatus(status); + } + }; + + $window.cordova.plugins.locationManager.setDelegate(delegate); + } + }, false); + + return { + setCallbackDidDetermineStateForRegion: function (callback) { + callbackDidDetermineStateForRegion = callback; + }, + setCallbackDidStartMonitoringForRegion: function (callback) { + callbackDidStartMonitoringForRegion = callback; + }, + setCallbackDidExitRegion: function (callback) { + callbackDidExitRegion = callback; + }, + setCallbackDidEnterRegion: function (callback) { + callbackDidEnterRegion = callback; + }, + setCallbackDidRangeBeaconsInRegion: function (callback) { + callbackDidRangeBeaconsInRegion = callback; + }, + setCallbackPeripheralManagerDidStartAdvertising: function (callback) { + callbackPeripheralManagerDidStartAdvertising = callback; + }, + setCallbackPeripheralManagerDidUpdateState: function (callback) { + callbackPeripheralManagerDidUpdateState = callback; + }, + setCallbackDidChangeAuthorizationStatus: function (callback) { + callbackDidChangeAuthorizationStatus = callback; + }, + createBeaconRegion: function (identifier, uuid, major, minor, notifyEntryStateOnDisplay) { + major = major || undefined; + minor = minor || undefined; + + return new $window.cordova.plugins.locationManager.BeaconRegion( + identifier, + uuid, + major, + minor, + notifyEntryStateOnDisplay + ); + }, + isBluetoothEnabled: function () { + return $q.when($window.cordova.plugins.locationManager.isBluetoothEnabled()); + }, + enableBluetooth: function () { + return $q.when($window.cordova.plugins.locationManager.enableBluetooth()); + }, + disableBluetooth: function () { + return $q.when($window.cordova.plugins.locationManager.disableBluetooth()); + }, + startMonitoringForRegion: function (region) { + return $q.when($window.cordova.plugins.locationManager.startMonitoringForRegion(region)); + }, + stopMonitoringForRegion: function (region) { + return $q.when($window.cordova.plugins.locationManager.stopMonitoringForRegion(region)); + }, + requestStateForRegion: function (region) { + return $q.when($window.cordova.plugins.locationManager.requestStateForRegion(region)); + }, + startRangingBeaconsInRegion: function (region) { + return $q.when($window.cordova.plugins.locationManager.startRangingBeaconsInRegion(region)); + }, + stopRangingBeaconsInRegion: function (region) { + return $q.when($window.cordova.plugins.locationManager.stopRangingBeaconsInRegion(region)); + }, + getAuthorizationStatus: function () { + return $q.when($window.cordova.plugins.locationManager.getAuthorizationStatus()); + }, + requestWhenInUseAuthorization: function () { + return $q.when($window.cordova.plugins.locationManager.requestWhenInUseAuthorization()); + }, + requestAlwaysAuthorization: function () { + return $q.when($window.cordova.plugins.locationManager.requestAlwaysAuthorization()); + }, + getMonitoredRegions: function () { + return $q.when($window.cordova.plugins.locationManager.getMonitoredRegions()); + }, + getRangedRegions: function () { + return $q.when($window.cordova.plugins.locationManager.getRangedRegions()); + }, + isRangingAvailable: function () { + return $q.when($window.cordova.plugins.locationManager.isRangingAvailable()); + }, + isMonitoringAvailableForClass: function (region) { + return $q.when($window.cordova.plugins.locationManager.isMonitoringAvailableForClass(region)); + }, + startAdvertising: function (region, measuredPower) { + return $q.when($window.cordova.plugins.locationManager.startAdvertising(region, measuredPower)); + }, + stopAdvertising: function () { + return $q.when($window.cordova.plugins.locationManager.stopAdvertising()); + }, + isAdvertisingAvailable: function () { + return $q.when($window.cordova.plugins.locationManager.isAdvertisingAvailable()); + }, + isAdvertising: function () { + return $q.when($window.cordova.plugins.locationManager.isAdvertising()); + }, + disableDebugLogs: function () { + return $q.when($window.cordova.plugins.locationManager.disableDebugLogs()); + }, + enableDebugNotifications: function () { + return $q.when($window.cordova.plugins.locationManager.enableDebugNotifications()); + }, + disableDebugNotifications: function () { + return $q.when($window.cordova.plugins.locationManager.disableDebugNotifications()); + }, + enableDebugLogs: function () { + return $q.when($window.cordova.plugins.locationManager.enableDebugLogs()); + }, + appendToDeviceLog: function (message) { + return $q.when($window.cordova.plugins.locationManager.appendToDeviceLog(message)); + } + }; + }]); + +// install : cordova plugin add https://github.com/don/cordova-plugin-ble-central.git +// link : https://github.com/don/cordova-plugin-ble-central + +/* globals ble: true */ +angular.module('ngCordova.plugins.ble', []) + + .factory('$cordovaBLE', ['$q', '$timeout', '$log', function ($q, $timeout, $log) { + + return { + scan: function (services, seconds) { + var q = $q.defer(); + + ble.startScan(services, function (result) { + q.notify(result); + }, function (error) { + q.reject(error); + }); + + $timeout(function () { + ble.stopScan(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + }, seconds*1000); + + return q.promise; + }, + + startScan: function (services, callback, errorCallback) { + return ble.startScan(services, callback, errorCallback); + }, + + stopScan: function () { + var q = $q.defer(); + ble.stopScan(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + connect: function (deviceID) { + var q = $q.defer(); + ble.connect(deviceID, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + disconnect: function (deviceID) { + var q = $q.defer(); + ble.disconnect(deviceID, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + read: function (deviceID, serviceUUID, characteristicUUID) { + var q = $q.defer(); + ble.read(deviceID, serviceUUID, characteristicUUID, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + write: function (deviceID, serviceUUID, characteristicUUID, data) { + var q = $q.defer(); + ble.write(deviceID, serviceUUID, characteristicUUID, data, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + writeWithoutResponse: function (deviceID, serviceUUID, characteristicUUID, data) { + var q = $q.defer(); + ble.writeWithoutResponse(deviceID, serviceUUID, characteristicUUID, data, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + writeCommand: function (deviceID, serviceUUID, characteristicUUID, data) { + $log.warning('writeCommand is deprecated, use writeWithoutResponse'); + return this.writeWithoutResponse(deviceID, serviceUUID, characteristicUUID, data); + }, + + startNotification: function (deviceID, serviceUUID, characteristicUUID, callback, errorCallback) { + return ble.startNotification(deviceID, serviceUUID, characteristicUUID, callback, errorCallback); + }, + + stopNotification: function (deviceID, serviceUUID, characteristicUUID) { + var q = $q.defer(); + ble.stopNotification(deviceID, serviceUUID, characteristicUUID, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + isConnected: function (deviceID) { + var q = $q.defer(); + ble.isConnected(deviceID, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + enable: function () { + var q = $q.defer(); + ble.enable(function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + isEnabled: function () { + var q = $q.defer(); + ble.isEnabled(function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/don/BluetoothSerial.git +// link : https://github.com/don/BluetoothSerial + +angular.module('ngCordova.plugins.bluetoothSerial', []) + + .factory('$cordovaBluetoothSerial', ['$q', '$window', function ($q, $window) { + + return { + connect: function (address) { + var q = $q.defer(); + var disconnectionPromise = $q.defer(); + var isConnected = false; + $window.bluetoothSerial.connect(address, function () { + isConnected = true; + q.resolve(disconnectionPromise); + }, function (error) { + if(isConnected === false) { + disconnectionPromise.reject(error); + } + q.reject(error); + }); + return q.promise; + }, + + // not supported on iOS + connectInsecure: function (address) { + var q = $q.defer(); + $window.bluetoothSerial.connectInsecure(address, function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + disconnect: function () { + var q = $q.defer(); + $window.bluetoothSerial.disconnect(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + list: function () { + var q = $q.defer(); + $window.bluetoothSerial.list(function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + discoverUnpaired: function () { + var q = $q.defer(); + $window.bluetoothSerial.discoverUnpaired(function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + setDeviceDiscoveredListener: function () { + var q = $q.defer(); + $window.bluetoothSerial.setDeviceDiscoveredListener(function (data) { + q.notify(data); + }); + return q.promise; + }, + + clearDeviceDiscoveredListener: function () { + $window.bluetoothSerial.clearDeviceDiscoveredListener(); + }, + + showBluetoothSettings: function () { + var q = $q.defer(); + $window.bluetoothSerial.showBluetoothSettings(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + isEnabled: function () { + var q = $q.defer(); + $window.bluetoothSerial.isEnabled(function () { + q.resolve(); + }, function () { + q.reject(); + }); + return q.promise; + }, + + enable: function () { + var q = $q.defer(); + $window.bluetoothSerial.enable(function () { + q.resolve(); + }, function () { + q.reject(); + }); + return q.promise; + }, + + isConnected: function () { + var q = $q.defer(); + $window.bluetoothSerial.isConnected(function () { + q.resolve(); + }, function () { + q.reject(); + }); + return q.promise; + }, + + available: function () { + var q = $q.defer(); + $window.bluetoothSerial.available(function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + read: function () { + var q = $q.defer(); + $window.bluetoothSerial.read(function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + readUntil: function (delimiter) { + var q = $q.defer(); + $window.bluetoothSerial.readUntil(delimiter, function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + write: function (data) { + var q = $q.defer(); + $window.bluetoothSerial.write(data, function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + subscribe: function (delimiter) { + var q = $q.defer(); + $window.bluetoothSerial.subscribe(delimiter, function (data) { + q.notify(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + subscribeRawData: function () { + var q = $q.defer(); + $window.bluetoothSerial.subscribeRawData(function (data) { + q.notify(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + unsubscribe: function () { + var q = $q.defer(); + $window.bluetoothSerial.unsubscribe(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + unsubscribeRawData: function () { + var q = $q.defer(); + $window.bluetoothSerial.unsubscribeRawData(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + clear: function () { + var q = $q.defer(); + $window.bluetoothSerial.clear(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + readRSSI: function () { + var q = $q.defer(); + $window.bluetoothSerial.readRSSI(function (data) { + q.resolve(data); + }, function (error) { + q.reject(error); + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/fiscal-cliff/phonegap-plugin-brightness.git +// link : https://github.com/fiscal-cliff/phonegap-plugin-brightness + +angular.module('ngCordova.plugins.brightness', []) + + .factory('$cordovaBrightness', ['$q', '$window', function ($q, $window) { + + return { + get: function () { + var q = $q.defer(); + + if (!$window.cordova) { + q.reject('Not supported without cordova.js'); + } else { + $window.cordova.plugins.brightness.getBrightness(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + } + + return q.promise; + }, + + set: function (data) { + var q = $q.defer(); + + if (!$window.cordova) { + q.reject('Not supported without cordova.js'); + } else { + $window.cordova.plugins.brightness.setBrightness(data, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + } + + return q.promise; + }, + + setKeepScreenOn: function (bool) { + var q = $q.defer(); + + if (!$window.cordova) { + q.reject('Not supported without cordova.js'); + } else { + $window.cordova.plugins.brightness.setKeepScreenOn(bool, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + } + + return q.promise; + } + }; + }]); + + +// install : cordova plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin + +angular.module('ngCordova.plugins.calendar', []) + + .factory('$cordovaCalendar', ['$q', '$window', function ($q, $window) { + + return { + createCalendar: function (options) { + var d = $q.defer(), + createCalOptions = $window.plugins.calendar.getCreateCalendarOptions(); + + if (typeof options === 'string') { + createCalOptions.calendarName = options; + } else { + createCalOptions = angular.extend(createCalOptions, options); + } + + $window.plugins.calendar.createCalendar(createCalOptions, function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + deleteCalendar: function (calendarName) { + var d = $q.defer(); + + $window.plugins.calendar.deleteCalendar(calendarName, function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + createEvent: function (options) { + var d = $q.defer(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.createEvent( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + createEventWithOptions: function (options) { + var d = $q.defer(), + defaultOptionKeys = [], + calOptions = window.plugins.calendar.getCalendarOptions(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null + }; + + defaultOptionKeys = Object.keys(defaultOptions); + + for (var key in options) { + if (defaultOptionKeys.indexOf(key) === -1) { + calOptions[key] = options[key]; + } else { + defaultOptions[key] = options[key]; + } + } + + $window.plugins.calendar.createEventWithOptions( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + calOptions, + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + createEventInteractively: function (options) { + var d = $q.defer(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.createEventInteractively( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + createEventInNamedCalendar: function (options) { + var d = $q.defer(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null, + calendarName: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.createEventInNamedCalendar( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + defaultOptions.calendarName, + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + findEvent: function (options) { + var d = $q.defer(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.findEvent( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + function (foundEvent) { + d.resolve(foundEvent); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + listEventsInRange: function (startDate, endDate) { + var d = $q.defer(); + + $window.plugins.calendar.listEventsInRange(startDate, endDate, function (events) { + d.resolve(events); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + listCalendars: function () { + var d = $q.defer(); + + $window.plugins.calendar.listCalendars(function (calendars) { + d.resolve(calendars); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + findAllEventsInNamedCalendar: function (calendarName) { + var d = $q.defer(); + + $window.plugins.calendar.findAllEventsInNamedCalendar(calendarName, function (events) { + d.resolve(events); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + modifyEvent: function (options) { + var d = $q.defer(), + defaultOptions = { + title: null, + location: null, + notes: null, + startDate: null, + endDate: null, + newTitle: null, + newLocation: null, + newNotes: null, + newStartDate: null, + newEndDate: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.modifyEvent( + defaultOptions.title, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + defaultOptions.newTitle, + defaultOptions.newLocation, + defaultOptions.newNotes, + new Date(defaultOptions.newStartDate), + new Date(defaultOptions.newEndDate), + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + }, + + deleteEvent: function (options) { + var d = $q.defer(), + defaultOptions = { + newTitle: null, + location: null, + notes: null, + startDate: null, + endDate: null + }; + + defaultOptions = angular.extend(defaultOptions, options); + + $window.plugins.calendar.deleteEvent( + defaultOptions.newTitle, + defaultOptions.location, + defaultOptions.notes, + new Date(defaultOptions.startDate), + new Date(defaultOptions.endDate), + function (message) { + d.resolve(message); + }, function (error) { + d.reject(error); + } + ); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-camera +// link : https://github.com/apache/cordova-plugin-camera + +angular.module('ngCordova.plugins.camera', []) + + .factory('$cordovaCamera', ['$q', function ($q) { + + return { + getPicture: function (options) { + var q = $q.defer(); + + if (!navigator.camera) { + q.resolve(null); + return q.promise; + } + + navigator.camera.getPicture(function (imageData) { + q.resolve(imageData); + }, function (err) { + q.reject(err); + }, options); + + return q.promise; + }, + + cleanup: function () { + var q = $q.defer(); + + navigator.camera.cleanup(function () { + q.resolve(); + }, function (err) { + q.reject(err); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-media-capture +// link : https://github.com/apache/cordova-plugin-media-capture + +angular.module('ngCordova.plugins.capture', []) + + .factory('$cordovaCapture', ['$q', function ($q) { + + return { + captureAudio: function (options) { + var q = $q.defer(); + + if (!navigator.device.capture) { + q.resolve(null); + return q.promise; + } + + navigator.device.capture.captureAudio(function (audioData) { + q.resolve(audioData); + }, function (err) { + q.reject(err); + }, options); + + return q.promise; + }, + captureImage: function (options) { + var q = $q.defer(); + + if (!navigator.device.capture) { + q.resolve(null); + return q.promise; + } + + navigator.device.capture.captureImage(function (imageData) { + q.resolve(imageData); + }, function (err) { + q.reject(err); + }, options); + + return q.promise; + }, + captureVideo: function (options) { + var q = $q.defer(); + + if (!navigator.device.capture) { + q.resolve(null); + return q.promise; + } + + navigator.device.capture.captureVideo(function (videoData) { + q.resolve(videoData); + }, function (err) { + q.reject(err); + }, options); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/vkeepe/card.io.git +// link : https://github.com/vkeepe/card.io.git + +/* globals CardIO: true */ +angular.module('ngCordova.plugins.cardIO', []) + + .provider( + '$cordovaNgCardIO', [function () { + + /** + * Default array of response data from cardIO scan card + */ + var defaultRespFields = [ + 'card_type', + 'redacted_card_number', + 'card_number', + 'expiry_month', + 'expiry_year', + 'short_expiry_year', + 'cvv', + 'zip' + ]; + + /** + * Default config for cardIO scan function + */ + var defaultScanConfig = { + 'expiry': true, + 'cvv': true, + 'zip': false, + 'suppressManual': false, + 'suppressConfirm': false, + 'hideLogo': true + }; + + /** + * Configuring defaultRespFields using $cordovaNgCardIOProvider + * + */ + this.setCardIOResponseFields = function (fields) { + if (!fields || !angular.isArray(fields)) { + return; + } + defaultRespFields = fields; + }; + + /** + * + * Configuring defaultScanConfig using $cordovaNgCardIOProvider + */ + this.setScanerConfig = function (config) { + if (!config || !angular.isObject(config)) { + return; + } + + defaultScanConfig.expiry = config.expiry || true; + defaultScanConfig.cvv = config.cvv || true; + defaultScanConfig.zip = config.zip || false; + defaultScanConfig.suppressManual = config.suppressManual || false; + defaultScanConfig.suppressConfirm = config.suppressConfirm || false; + defaultScanConfig.hideLogo = config.hideLogo || true; + }; + + /** + * Function scanCard for $cordovaNgCardIO service to make scan of card + * + */ + this.$get = ['$q', function ($q) { + return { + scanCard: function () { + + var deferred = $q.defer(); + CardIO.scan( + defaultScanConfig, + function (response) { + + if (response === null) { + deferred.reject(null); + } else { + + var respData = {}; + for ( + var i = 0, len = defaultRespFields.length; i < len; i++) { + var field = defaultRespFields[i]; + + if (field === 'short_expiry_year') { + respData[field] = String(response.expiry_year).substr( // jshint ignore:line + 2, 2 + ) || ''; + } else { + respData[field] = response[field] || ''; + } + } + deferred.resolve(respData); + } + }, + function () { + deferred.reject(null); + } + ); + return deferred.promise; + } + }; + }]; + }] +); + +// install : cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git +// link : https://github.com/VersoSolutions/CordovaClipboard + +angular.module('ngCordova.plugins.clipboard', []) + + .factory('$cordovaClipboard', ['$q', '$window', function ($q, $window) { + + return { + copy: function (text) { + var q = $q.defer(); + + $window.cordova.plugins.clipboard.copy(text, + function () { + q.resolve(); + }, function () { + q.reject(); + }); + + return q.promise; + }, + + paste: function () { + var q = $q.defer(); + + $window.cordova.plugins.clipboard.paste(function (text) { + q.resolve(text); + }, function () { + q.reject(); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-contacts +// link : https://github.com/apache/cordova-plugin-contacts + +angular.module('ngCordova.plugins.contacts', []) + + .factory('$cordovaContacts', ['$q', function ($q) { + + return { + save: function (contact) { + var q = $q.defer(); + var deviceContact = navigator.contacts.create(contact); + + deviceContact.save(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + remove: function (contact) { + var q = $q.defer(); + var deviceContact = navigator.contacts.create(contact); + + deviceContact.remove(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + clone: function (contact) { + var deviceContact = navigator.contacts.create(contact); + return deviceContact.clone(contact); + }, + + find: function (options) { + var q = $q.defer(); + var fields = options.fields || ['id', 'displayName']; + delete options.fields; + if (Object.keys(options).length === 0) { + navigator.contacts.find(fields, function (results) { + q.resolve(results); + },function (err) { + q.reject(err); + }); + } + else { + navigator.contacts.find(fields, function (results) { + q.resolve(results); + }, function (err) { + q.reject(err); + }, options); + } + return q.promise; + }, + + pickContact: function () { + var q = $q.defer(); + + navigator.contacts.pickContact(function (contact) { + q.resolve(contact); + }, function (err) { + q.reject(err); + }); + + return q.promise; + } + + // TODO: method to set / get ContactAddress + // TODO: method to set / get ContactError + // TODO: method to set / get ContactField + // TODO: method to set / get ContactName + // TODO: method to set / get ContactOrganization + }; + }]); + +// install : cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git +// link : https://github.com/VitaliiBlagodir/cordova-plugin-datepicker + +angular.module('ngCordova.plugins.datePicker', []) + + .factory('$cordovaDatePicker', ['$window', '$q', function ($window, $q) { + + return { + show: function (options) { + var q = $q.defer(); + options = options || {date: new Date(), mode: 'date'}; + $window.datePicker.show(options, function (date) { + q.resolve(date); + }, function (error){ + q.reject(error); + }); + return q.promise; + } + }; + }]); +// install : cordova plugin add cordova-plugin-device +// link : https://github.com/apache/cordova-plugin-device + +/* globals device: true */ +angular.module('ngCordova.plugins.device', []) + + .factory('$cordovaDevice', [function () { + + return { + /** + * Returns the whole device object. + * @see https://github.com/apache/cordova-plugin-device + * @returns {Object} The device object. + */ + getDevice: function () { + return device; + }, + + /** + * Returns the Cordova version. + * @see https://github.com/apache/cordova-plugin-device#devicecordova + * @returns {String} The Cordova version. + */ + getCordova: function () { + return device.cordova; + }, + + /** + * Returns the name of the device's model or product. + * @see https://github.com/apache/cordova-plugin-device#devicemodel + * @returns {String} The name of the device's model or product. + */ + getModel: function () { + return device.model; + }, + + /** + * @deprecated device.name is deprecated as of version 2.3.0. Use device.model instead. + * @returns {String} + */ + getName: function () { + return device.name; + }, + + /** + * Returns the device's operating system name. + * @see https://github.com/apache/cordova-plugin-device#deviceplatform + * @returns {String} The device's operating system name. + */ + getPlatform: function () { + return device.platform; + }, + + /** + * Returns the device's Universally Unique Identifier. + * @see https://github.com/apache/cordova-plugin-device#deviceuuid + * @returns {String} The device's Universally Unique Identifier + */ + getUUID: function () { + return device.uuid; + }, + + /** + * Returns the operating system version. + * @see https://github.com/apache/cordova-plugin-device#deviceversion + * @returns {String} + */ + getVersion: function () { + return device.version; + }, + + /** + * Returns the device manufacturer. + * @returns {String} + */ + getManufacturer: function () { + return device.manufacturer; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-device-motion +// link : https://github.com/apache/cordova-plugin-device-motion + +angular.module('ngCordova.plugins.deviceMotion', []) + + .factory('$cordovaDeviceMotion', ['$q', function ($q) { + + return { + getCurrentAcceleration: function () { + var q = $q.defer(); + + if (angular.isUndefined(navigator.accelerometer) || + !angular.isFunction(navigator.accelerometer.getCurrentAcceleration)) { + q.reject('Device do not support watchAcceleration'); + return q.promise; + } + + navigator.accelerometer.getCurrentAcceleration(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + watchAcceleration: function (options) { + var q = $q.defer(); + + if (angular.isUndefined(navigator.accelerometer) || + !angular.isFunction(navigator.accelerometer.watchAcceleration)) { + q.reject('Device do not support watchAcceleration'); + return q.promise; + } + + var watchID = navigator.accelerometer.watchAcceleration(function (result) { + q.notify(result); + }, function (err) { + q.reject(err); + }, options); + + q.promise.cancel = function () { + navigator.accelerometer.clearWatch(watchID); + }; + + q.promise.clearWatch = function (id) { + navigator.accelerometer.clearWatch(id || watchID); + }; + + q.promise.watchID = watchID; + + return q.promise; + }, + + clearWatch: function (watchID) { + return navigator.accelerometer.clearWatch(watchID); + } + }; + }]); + +// 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(); + + if(!navigator.compass) { + q.reject('No compass on Device'); + return q.promise; + } + + navigator.compass.getCurrentHeading(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + watchHeading: function (options) { + var q = $q.defer(); + + if(!navigator.compass) { + q.reject('No compass on Device'); + return q.promise; + } + + var _options = angular.extend(defaultOptions, options); + var watchID = navigator.compass.watchHeading(function (result) { + q.notify(result); + }, function (err) { + q.reject(err); + }, _options); + + q.promise.cancel = function () { + navigator.compass.clearWatch(watchID); + }; + + q.promise.clearWatch = function (id) { + navigator.compass.clearWatch(id || watchID); + }; + + q.promise.watchID = watchID; + + return q.promise; + }, + + clearWatch: function (watchID) { + return navigator.compass.clearWatch(watchID); + } + }; + }]); + +// install : cordova plugin add cordova-plugin-dialogs +// link : https://github.com/apache/cordova-plugin-dialogs + +angular.module('ngCordova.plugins.dialogs', []) + + .factory('$cordovaDialogs', ['$q', '$window', function ($q, $window) { + + return { + alert: function (message, title, buttonName) { + var q = $q.defer(); + + if (!$window.navigator.notification) { + $window.alert(message); + q.resolve(); + } else { + navigator.notification.alert(message, function () { + q.resolve(); + }, title, buttonName); + } + + return q.promise; + }, + + confirm: function (message, title, buttonLabels) { + var q = $q.defer(); + + if (!$window.navigator.notification) { + if ($window.confirm(message)) { + q.resolve(1); + } else { + q.resolve(2); + } + } else { + navigator.notification.confirm(message, function (buttonIndex) { + q.resolve(buttonIndex); + }, title, buttonLabels); + } + + return q.promise; + }, + + prompt: function (message, title, buttonLabels, defaultText) { + var q = $q.defer(); + + if (!$window.navigator.notification) { + var res = $window.prompt(message, defaultText); + if (res !== null) { + q.resolve({input1: res, buttonIndex: 1}); + } else { + q.resolve({input1: res, buttonIndex: 2}); + } + } else { + navigator.notification.prompt(message, function (result) { + q.resolve(result); + }, title, buttonLabels, defaultText); + } + return q.promise; + }, + + beep: function (times) { + return navigator.notification.beep(times); + }, + + activityStart: function (message, title) { + var q = $q.defer(); + + if (cordova.platformId === 'android') { + navigator.notification.activityStart(title, message); + q.resolve(); + } else { + q.reject(message, title); + } + + return q.promise; + }, + + activityStop: function () { + var q = $q.defer(); + + if (cordova.platformId === 'android') { + navigator.notification.activityStop(); + q.resolve(); + } else { + q.reject(); + } + + return q.promise; + }, + + progressStart: function (message, title) { + var q = $q.defer(); + + if (cordova.platformId === 'android') { + navigator.notification.progressStart(title, message); + q.resolve(); + } else { + q.reject(message, title); + } + + return q.promise; + }, + + progressStop: function () { + var q = $q.defer(); + + if (cordova.platformId === 'android') { + navigator.notification.progressStop(); + q.resolve(); + } else { + q.reject(); + } + + return q.promise; + }, + + progressValue: function (value) { + var q = $q.defer(); + + if (cordova.platformId === 'android') { + navigator.notification.progressValue(value); + q.resolve(); + } else { + q.reject(value); + } + + return q.promise; + } + }; + }]); + +// 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', []) + + .factory('$cordovaEmailComposer', ['$q', function ($q) { + + return { + isAvailable: function () { + var q = $q.defer(); + + cordova.plugins.email.isAvailable(function (isAvailable) { + if (isAvailable) { + q.resolve(); + } else { + q.reject(); + } + }); + + return q.promise; + }, + + open: function (properties) { + var q = $q.defer(); + + cordova.plugins.email.open(properties, function () { + q.reject(); // user closed email composer + }); + + return q.promise; + }, + + addAlias: function (app, schema) { + cordova.plugins.email.addAlias(app, schema); + } + }; + }]); + +// 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 + +/* globals facebookConnectPlugin: true */ +angular.module('ngCordova.plugins.facebook', []) + + .provider('$cordovaFacebook', [function () { + + /** + * Init browser settings for Facebook plugin + * + * @param {number} id + * @param {string} version + */ + this.browserInit = function (id, version) { + this.appID = id; + this.appVersion = version || 'v2.0'; + facebookConnectPlugin.browserInit(this.appID, this.appVersion); + }; + + this.$get = ['$q', function ($q) { + return { + login: function (permissions) { + var q = $q.defer(); + facebookConnectPlugin.login(permissions, function (res) { + q.resolve(res); + }, function (res) { + q.reject(res); + }); + + return q.promise; + }, + + showDialog: function (options) { + var q = $q.defer(); + facebookConnectPlugin.showDialog(options, function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + api: function (path, permissions) { + var q = $q.defer(); + facebookConnectPlugin.api(path, permissions, function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + getAccessToken: function () { + var q = $q.defer(); + facebookConnectPlugin.getAccessToken(function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + getLoginStatus: function () { + var q = $q.defer(); + facebookConnectPlugin.getLoginStatus(function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + logout: function () { + var q = $q.defer(); + facebookConnectPlugin.logout(function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + } + }; + }]; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-facebookads.git +// link : https://github.com/floatinghotpot/cordova-plugin-facebookads + +angular.module('ngCordova.plugins.facebookAds', []) + + .factory('$cordovaFacebookAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.FacebookAds.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.FacebookAds.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.FacebookAds.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.FacebookAds.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.FacebookAds.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.FacebookAds.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.FacebookAds.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.FacebookAds.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-file +// link : https://github.com/apache/cordova-plugin-file + +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 ($q, $window, $cordovaFileError) { + + return { + + 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 \/'); + } + + try { + var directory = path + dir; + $window.resolveLocalFileSystemURL(directory, function (fileSystem) { + if (fileSystem.isDirectory === true) { + q.resolve(fileSystem); + } else { + q.reject({code: 13, message: 'input is not a directory'}); + } + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + } catch (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + } + + return q.promise; + }, + + checkFile: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('directory cannot start with \/'); + } + + try { + var directory = path + file; + $window.resolveLocalFileSystemURL(directory, function (fileSystem) { + if (fileSystem.isFile === true) { + q.resolve(fileSystem); + } else { + q.reject({code: 13, message: 'input is not a file'}); + } + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + } catch (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + } + + return q.promise; + }, + + createDir: function (path, dirName, replaceBool) { + var q = $q.defer(); + + if ((/^\//.test(dirName))) { + q.reject('directory cannot start with \/'); + } + + replaceBool = replaceBool ? false : true; + + var options = { + create: true, + exclusive: replaceBool + }; + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, options, function (result) { + q.resolve(result); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + createFile: function (path, fileName, replaceBool) { + var q = $q.defer(); + + if ((/^\//.test(fileName))) { + q.reject('file-name cannot start with \/'); + } + + replaceBool = replaceBool ? false : true; + + var options = { + create: true, + exclusive: replaceBool + }; + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, options, function (result) { + q.resolve(result); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + removeDir: function (path, dirName) { + var q = $q.defer(); + + if ((/^\//.test(dirName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, {create: false}, function (dirEntry) { + dirEntry.remove(function () { + q.resolve({success: true, fileRemoved: dirEntry}); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + }, function (er) { + er.message = $cordovaFileError[er.code]; + q.reject(er); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + removeFile: function (path, fileName) { + var q = $q.defer(); + + if ((/^\//.test(fileName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, {create: false}, function (fileEntry) { + fileEntry.remove(function () { + q.resolve({success: true, fileRemoved: fileEntry}); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + }, function (er) { + er.message = $cordovaFileError[er.code]; + q.reject(er); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + removeRecursively: function (path, dirName) { + var q = $q.defer(); + + if ((/^\//.test(dirName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, {create: false}, function (dirEntry) { + dirEntry.removeRecursively(function () { + q.resolve({success: true, fileRemoved: dirEntry}); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + }, function (er) { + er.message = $cordovaFileError[er.code]; + q.reject(er); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + writeFile: function (path, fileName, text, replaceBool) { + var q = $q.defer(); + + if ((/^\//.test(fileName))) { + q.reject('file-name cannot start with \/'); + } + + replaceBool = replaceBool ? false : true; + + var options = { + create: true, + exclusive: replaceBool + }; + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, options, function (fileEntry) { + fileEntry.createWriter(function (writer) { + if (options.append === true) { + writer.seek(writer.length); + } + + if (options.truncate) { + writer.truncate(options.truncate); + } + + writer.onwriteend = function (evt) { + if (this.error) { + q.reject(this.error); + } else { + q.resolve(evt); + } + }; + + writer.write(text); + + q.promise.abort = function () { + writer.abort(); + }; + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + writeExistingFile: function (path, fileName, text) { + var q = $q.defer(); + + if ((/^\//.test(fileName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, {create: false}, function (fileEntry) { + fileEntry.createWriter(function (writer) { + writer.seek(writer.length); + + writer.onwriteend = function (evt) { + if (this.error) { + q.reject(this.error); + } else { + q.resolve(evt); + } + }; + + writer.write(text); + + q.promise.abort = function () { + writer.abort(); + }; + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + readAsText: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(file, {create: false}, function (fileEntry) { + 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 { + q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); + } + }; + + reader.readAsText(fileData); + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + readAsDataURL: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(file, {create: false}, function (fileEntry) { + 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 { + q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); + } + }; + reader.readAsDataURL(fileData); + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + readAsBinaryString: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(file, {create: false}, function (fileEntry) { + 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 { + q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); + } + }; + reader.readAsBinaryString(fileData); + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + readAsArrayBuffer: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(file, {create: false}, function (fileEntry) { + 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 { + q.reject({code: null, message: 'READER_ONLOADEND_ERR'}); + } + }; + reader.readAsArrayBuffer(fileData); + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + moveFile: function (path, fileName, newPath, newFileName) { + var q = $q.defer(); + + newFileName = newFileName || fileName; + + if ((/^\//.test(fileName)) || (/^\//.test(newFileName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, {create: false}, function (fileEntry) { + $window.resolveLocalFileSystemURL(newPath, function (newFileEntry) { + fileEntry.moveTo(newFileEntry, newFileName, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + }, function (err) { + q.reject(err); + }); + }, function (err) { + q.reject(err); + }); + }, function (er) { + q.reject(er); + }); + } catch (e) { + q.reject(e); + } + return q.promise; + }, + + moveDir: function (path, dirName, newPath, newDirName) { + var q = $q.defer(); + + newDirName = newDirName || dirName; + + if (/^\//.test(dirName) || (/^\//.test(newDirName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, {create: false}, function (dirEntry) { + $window.resolveLocalFileSystemURL(newPath, function (newDirEntry) { + dirEntry.moveTo(newDirEntry, newDirName, function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }); + }, function (erro) { + q.reject(erro); + }); + }, function (err) { + q.reject(err); + }); + }, function (er) { + q.reject(er); + }); + } catch (e) { + q.reject(e); + } + return q.promise; + }, + + copyDir: function (path, dirName, newPath, newDirName) { + var q = $q.defer(); + + newDirName = newDirName || dirName; + + if (/^\//.test(dirName) || (/^\//.test(newDirName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, {create: false, exclusive: false}, function (dirEntry) { + + $window.resolveLocalFileSystemURL(newPath, function (newDirEntry) { + dirEntry.copyTo(newDirEntry, newDirName, function (result) { + q.resolve(result); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (erro) { + erro.message = $cordovaFileError[erro.code]; + q.reject(erro); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + }, function (er) { + er.message = $cordovaFileError[er.code]; + q.reject(er); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + copyFile: function (path, fileName, newPath, newFileName) { + var q = $q.defer(); + + newFileName = newFileName || fileName; + + if ((/^\//.test(fileName))) { + q.reject('file-name cannot start with \/'); + } + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getFile(fileName, {create: false, exclusive: false}, function (fileEntry) { + + $window.resolveLocalFileSystemURL(newPath, function (newFileEntry) { + fileEntry.copyTo(newFileEntry, newFileName, function (result) { + q.resolve(result); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (erro) { + erro.message = $cordovaFileError[erro.code]; + q.reject(erro); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + }, function (er) { + er.message = $cordovaFileError[er.code]; + q.reject(er); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + return q.promise; + }, + + readFileMetadata: function (path, file) { + var q = $q.defer(); + + if ((/^\//.test(file))) { + q.reject('directory cannot start with \/'); + } + + try { + var directory = path + file; + $window.resolveLocalFileSystemURL(directory, function (fileEntry) { + fileEntry.file(function (result) { + q.resolve(result); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + } + + /* + listFiles: function (path, dir) { + + }, + + listDir: function (path, dirName) { + var q = $q.defer(); + + try { + $window.resolveLocalFileSystemURL(path, function (fileSystem) { + fileSystem.getDirectory(dirName, options, function (parent) { + var reader = parent.createReader(); + reader.readEntries(function (entries) { + q.resolve(entries); + }, function () { + q.reject('DIR_READ_ERROR : ' + path + dirName); + }); + }, function (error) { + error.message = $cordovaFileError[error.code]; + q.reject(error); + }); + }, function (err) { + err.message = $cordovaFileError[err.code]; + q.reject(err); + }); + } catch (e) { + e.message = $cordovaFileError[e.code]; + q.reject(e); + } + + return q.promise; + }, + + */ + }; + + }]; + }]); + +// 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', []) + + .factory('$cordovaFileOpener2', ['$q', function ($q) { + + return { + open: function (file, type) { + var q = $q.defer(); + cordova.plugins.fileOpener2.open(file, type, { + error: function (e) { + q.reject(e); + }, success: function () { + q.resolve(); + } + }); + return q.promise; + }, + + uninstall: function (pack) { + var q = $q.defer(); + cordova.plugins.fileOpener2.uninstall(pack, { + error: function (e) { + q.reject(e); + }, success: function () { + q.resolve(); + } + }); + return q.promise; + }, + + appIsInstalled: function (pack) { + var q = $q.defer(); + cordova.plugins.fileOpener2.appIsInstalled(pack, { + success: function (res) { + q.resolve(res); + } + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-file-transfer +// link : https://github.com/apache/cordova-plugin-file-transfer + +/* globals FileTransfer: true */ +angular.module('ngCordova.plugins.fileTransfer', []) + + .factory('$cordovaFileTransfer', ['$q', '$timeout', function ($q, $timeout) { + return { + download: function (source, filePath, options, trustAllHosts) { + var q = $q.defer(); + var ft = new FileTransfer(); + var uri = (options && options.encodeURI === false) ? source : encodeURI(source); + + if (options && options.timeout !== undefined && options.timeout !== null) { + $timeout(function () { + ft.abort(); + }, options.timeout); + options.timeout = null; + } + + ft.onprogress = function (progress) { + q.notify(progress); + }; + + q.promise.abort = function () { + ft.abort(); + }; + + ft.download(uri, filePath, q.resolve, q.reject, trustAllHosts, options); + return q.promise; + }, + + upload: function (server, filePath, options, trustAllHosts) { + var q = $q.defer(); + var ft = new FileTransfer(); + var uri = (options && options.encodeURI === false) ? server : encodeURI(server); + + if (options && options.timeout !== undefined && options.timeout !== null) { + $timeout(function () { + ft.abort(); + }, options.timeout); + options.timeout = null; + } + + ft.onprogress = function (progress) { + q.notify(progress); + }; + + q.promise.abort = function () { + ft.abort(); + }; + + ft.upload(filePath, uri, q.resolve, q.reject, options, trustAllHosts); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin + +angular.module('ngCordova.plugins.flashlight', []) + + .factory('$cordovaFlashlight', ['$q', '$window', function ($q, $window) { + + return { + available: function () { + var q = $q.defer(); + $window.plugins.flashlight.available(function (isAvailable) { + q.resolve(isAvailable); + }); + return q.promise; + }, + + switchOn: function () { + var q = $q.defer(); + $window.plugins.flashlight.switchOn(function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + switchOff: function () { + var q = $q.defer(); + $window.plugins.flashlight.switchOff(function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + toggle: function () { + var q = $q.defer(); + $window.plugins.flashlight.toggle(function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-flurry.git +// link : https://github.com/floatinghotpot/cordova-plugin-flurry + +angular.module('ngCordova.plugins.flurryAds', []) + .factory('$cordovaFlurryAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.FlurryAds.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.FlurryAds.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.FlurryAds.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.FlurryAds.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.FlurryAds.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.FlurryAds.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.FlurryAds.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.FlurryAds.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/phonegap-build/GAPlugin.git +// link : https://github.com/phonegap-build/GAPlugin + +angular.module('ngCordova.plugins.ga', []) + + .factory('$cordovaGA', ['$q', '$window', function ($q, $window) { + + return { + init: function (id, mingap) { + var q = $q.defer(); + mingap = (mingap >= 0) ? mingap : 10; + $window.plugins.gaPlugin.init(function (result) { + q.resolve(result); + }, + function (error) { + q.reject(error); + }, + id, mingap); + return q.promise; + }, + + trackEvent: function (success, fail, category, eventAction, eventLabel, eventValue) { + var q = $q.defer(); + $window.plugins.gaPlugin.trackEvent(function (result) { + q.resolve(result); + }, + function (error) { + q.reject(error); + }, + category, eventAction, eventLabel, eventValue); + return q.promise; + }, + + trackPage: function (success, fail, pageURL) { + var q = $q.defer(); + $window.plugins.gaPlugin.trackPage(function (result) { + q.resolve(result); + }, + function (error) { + q.reject(error); + }, + pageURL); + return q.promise; + }, + + setVariable: function (success, fail, index, value) { + var q = $q.defer(); + $window.plugins.gaPlugin.setVariable(function (result) { + q.resolve(result); + }, + function (error) { + q.reject(error); + }, + index, value); + return q.promise; + }, + + exit: function () { + var q = $q.defer(); + $window.plugins.gaPlugin.exit(function (result) { + q.resolve(result); + }, + function (error) { + q.reject(error); + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-geolocation +// link : https://github.com/apache/cordova-plugin-geolocation + +angular.module('ngCordova.plugins.geolocation', []) + + .factory('$cordovaGeolocation', ['$q', function ($q) { + + return { + getCurrentPosition: function (options) { + var q = $q.defer(); + + navigator.geolocation.getCurrentPosition(function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }, options); + + return q.promise; + }, + + watchPosition: function (options) { + var q = $q.defer(); + + var watchID = navigator.geolocation.watchPosition(function (result) { + q.notify(result); + }, function (err) { + q.reject(err); + }, options); + + q.promise.cancel = function () { + navigator.geolocation.clearWatch(watchID); + }; + + q.promise.clearWatch = function (id) { + navigator.geolocation.clearWatch(id || watchID); + }; + + q.promise.watchID = watchID; + + return q.promise; + }, + + clearWatch: function (watchID) { + return navigator.geolocation.clearWatch(watchID); + } + }; + }]); + +// install : cordova plugin add cordova-plugin-globalization +// link : https://github.com/apache/cordova-plugin-globalization + +angular.module('ngCordova.plugins.globalization', []) + + .factory('$cordovaGlobalization', ['$q', function ($q) { + + return { + getPreferredLanguage: function () { + var q = $q.defer(); + + navigator.globalization.getPreferredLanguage(function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + return q.promise; + }, + + getLocaleName: function () { + var q = $q.defer(); + + navigator.globalization.getLocaleName(function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + return q.promise; + }, + + getFirstDayOfWeek: function () { + var q = $q.defer(); + + navigator.globalization.getFirstDayOfWeek(function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + return q.promise; + }, + + // "date" parameter must be a JavaScript Date Object. + dateToString: function (date, options) { + var q = $q.defer(); + + navigator.globalization.dateToString( + date, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + stringToDate: function (dateString, options) { + var q = $q.defer(); + + navigator.globalization.stringToDate( + dateString, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + getDatePattern: function (options) { + var q = $q.defer(); + + navigator.globalization.getDatePattern( + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + getDateNames: function (options) { + var q = $q.defer(); + + navigator.globalization.getDateNames( + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + // "date" parameter must be a JavaScript Date Object. + isDayLightSavingsTime: function (date) { + var q = $q.defer(); + + navigator.globalization.isDayLightSavingsTime( + date, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + return q.promise; + }, + + numberToString: function (number, options) { + var q = $q.defer(); + + navigator.globalization.numberToString( + number, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + stringToNumber: function (numberString, options) { + var q = $q.defer(); + + navigator.globalization.stringToNumber( + numberString, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + getNumberPattern: function (options) { + var q = $q.defer(); + + navigator.globalization.getNumberPattern( + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }, + options); + return q.promise; + }, + + getCurrencyPattern: function (currencyCode) { + var q = $q.defer(); + + navigator.globalization.getCurrencyPattern( + currencyCode, + function (result) { + q.resolve(result); + }, + function (err) { + q.reject(err); + }); + return q.promise; + } + + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-admob-pro.git +// link : https://github.com/floatinghotpot/cordova-admob-pro + +angular.module('ngCordova.plugins.googleAds', []) + + .factory('$cordovaGoogleAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.AdMob.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.AdMob.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.AdMob.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.AdMob.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.AdMob.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.AdMob.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.AdMob.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.AdMob.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/danwilson/google-analytics-plugin.git +// link : https://github.com/danwilson/google-analytics-plugin + +angular.module('ngCordova.plugins.googleAnalytics', []) + + .factory('$cordovaGoogleAnalytics', ['$q', '$window', function ($q, $window) { + + return { + startTrackerWithId: function (id) { + var d = $q.defer(); + + $window.analytics.startTrackerWithId(id, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + setUserId: function (id) { + var d = $q.defer(); + + $window.analytics.setUserId(id, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + debugMode: function () { + var d = $q.defer(); + + $window.analytics.debugMode(function (response) { + d.resolve(response); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + trackView: function (screenName) { + var d = $q.defer(); + + $window.analytics.trackView(screenName, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + addCustomDimension: function (key, value) { + var d = $q.defer(); + + $window.analytics.addCustomDimension(key, value, function () { + d.resolve(); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + trackEvent: function (category, action, label, value) { + var d = $q.defer(); + + $window.analytics.trackEvent(category, action, label, value, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + 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(); + + $window.analytics.addTransaction(transactionId, affiliation, revenue, tax, shipping, currencyCode, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + }, + + addTransactionItem: function (transactionId, name, sku, category, price, quantity, currencyCode) { + var d = $q.defer(); + + $window.analytics.addTransactionItem(transactionId, name, sku, category, price, quantity, currencyCode, function (response) { + d.resolve(response); + }, function (error) { + d.reject(error); + }); + + return d.promise; + } + }; + }]); + +// install : +// link : + +// Google Maps needs ALOT of work! +// Not for production use + +angular.module('ngCordova.plugins.googleMap', []) + + .factory('$cordovaGoogleMap', ['$q', '$window', function ($q, $window) { + + var map = null; + + return { + getMap: function (options) { + var q = $q.defer(); + + if (!$window.plugin.google.maps) { + q.reject(null); + } else { + var div = document.getElementById('map_canvas'); + map = $window.plugin.google.maps.Map.getMap(options); + map.setDiv(div); + q.resolve(map); + } + return q.promise; + }, + + isMapLoaded: function () { // check if an instance of the map exists + return !!map; + }, + addMarker: function (markerOptions) { // add a marker to the map with given markerOptions + var q = $q.defer(); + map.addMarker(markerOptions, function (marker) { + q.resolve(marker); + }); + + return q.promise; + }, + getMapTypeIds: function () { + return $window.plugin.google.maps.mapTypeId; + }, + setVisible: function (isVisible) { + var q = $q.defer(); + map.setVisible(isVisible); + return q.promise; + }, + // I don't know how to deallocate te map and the google map plugin. + cleanup: function () { + map = null; + // delete map; + } + }; + }]); + +// install : cordova plugin add https://github.com/ptgamr/cordova-google-play-game.git --variable APP_ID=123456789 +// link : https://github.com/ptgamr/cordova-google-play-game + +/* globals googleplaygame: true */ +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 https://github.com/EddyVerbruggen/cordova-plugin-googleplus.git +// link : https://github.com/EddyVerbruggen/cordova-plugin-googleplus + +angular.module('ngCordova.plugins.googlePlus', []) + + .factory('$cordovaGooglePlus', ['$q', '$window', function ($q, $window) { + + return { + 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) { + var q = $q.defer(); + + 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 () { + var q = $q.defer(); + $window.plugins.googleplus.logout(function (response) { + q.resolve(response); + }); + }, + + disconnect: function () { + var q = $q.defer(); + $window.plugins.googleplus.disconnect(function (response) { + q.resolve(response); + }); + }, + + isAvailable: function () { + var q = $q.defer(); + $window.plugins.googleplus.isAvailable(function (available) { + if (available) { + q.resolve(available); + } else { + q.reject(available); + } + }); + + return q.promise; + } + }; + + }]); + +// 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', []) + + .factory('$cordovaHealthKit', ['$q', '$window', function ($q, $window) { + + return { + isAvailable: function () { + var q = $q.defer(); + + $window.plugins.healthkit.available(function (success) { + q.resolve(success); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + /** + * Check whether or not the user granted your app access to a specific HealthKit type. + * Reference for possible types: + * https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Constants/ + */ + checkAuthStatus: function (type) { + var q = $q.defer(); + + type = type || 'HKQuantityTypeIdentifierHeight'; + + $window.plugins.healthkit.checkAuthStatus({ + 'type': type + }, function (success) { + q.resolve(success); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + /** + * Request authorization to access HealthKit data. See the full HealthKit constants + * reference for possible read and write types: + * https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HealthKit_Constants/ + */ + requestAuthorization: function (readTypes, writeTypes) { + var q = $q.defer(); + + readTypes = readTypes || [ + 'HKCharacteristicTypeIdentifierDateOfBirth', 'HKQuantityTypeIdentifierActiveEnergyBurned', 'HKQuantityTypeIdentifierHeight' + ]; + writeTypes = writeTypes || [ + 'HKQuantityTypeIdentifierActiveEnergyBurned', 'HKQuantityTypeIdentifierHeight', 'HKQuantityTypeIdentifierDistanceCycling' + ]; + + $window.plugins.healthkit.requestAuthorization({ + 'readTypes': readTypes, + 'writeTypes': writeTypes + }, function (success) { + q.resolve(success); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + readDateOfBirth: function () { + var q = $q.defer(); + $window.plugins.healthkit.readDateOfBirth( + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + + return q.promise; + }, + + readGender: function () { + var q = $q.defer(); + $window.plugins.healthkit.readGender( + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + + return q.promise; + }, + + saveWeight: function (value, units, date) { + var q = $q.defer(); + $window.plugins.healthkit.saveWeight({ + 'unit': units || 'lb', + 'amount': value, + 'date': date || new Date() + }, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + return q.promise; + }, + + readWeight: function (units) { + var q = $q.defer(); + $window.plugins.healthkit.readWeight({ + 'unit': units || 'lb' + }, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + + return q.promise; + }, + saveHeight: function (value, units, date) { + var q = $q.defer(); + $window.plugins.healthkit.saveHeight({ + 'unit': units || 'in', + 'amount': value, + 'date': date || new Date() + }, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + return q.promise; + }, + readHeight: function (units) { + var q = $q.defer(); + $window.plugins.healthkit.readHeight({ + 'unit': units || 'in' + }, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + + return q.promise; + }, + + findWorkouts: function () { + var q = $q.defer(); + $window.plugins.healthkit.findWorkouts({}, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + return q.promise; + }, + + /** + * Save a workout. + * + * Workout param should be of the format: + { + 'activityType': 'HKWorkoutActivityTypeCycling', // HKWorkoutActivityType constant (https://developer.apple.com/library/ios/documentation/HealthKit/Reference/HKWorkout_Class/#//apple_ref/c/tdef/HKWorkoutActivityType) + 'quantityType': 'HKQuantityTypeIdentifierDistanceCycling', + 'startDate': new Date(), // mandatory + 'endDate': null, // optional, use either this or duration + 'duration': 3600, // in seconds, optional, use either this or endDate + 'energy': 300, // + 'energyUnit': 'kcal', // J|cal|kcal + 'distance': 11, // optional + 'distanceUnit': 'km' // probably useful with the former param + // 'extraData': "", // Not sure how necessary this is + }, + */ + saveWorkout: function (workout) { + var q = $q.defer(); + $window.plugins.healthkit.saveWorkout(workout, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + return q.promise; + }, + + /** + * Sample any kind of health data through a given date range. + * sampleQuery of the format: + { + 'startDate': yesterday, // mandatory + 'endDate': tomorrow, // mandatory + 'sampleType': 'HKQuantityTypeIdentifierHeight', + 'unit' : 'cm' + }, + */ + querySampleType: function (sampleQuery) { + var q = $q.defer(); + $window.plugins.healthkit.querySampleType(sampleQuery, + function (success) { + q.resolve(success); + }, + function (err) { + q.resolve(err); + } + ); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-httpd.git +// link : https://github.com/floatinghotpot/cordova-httpd + +angular.module('ngCordova.plugins.httpd', []) + + .factory('$cordovaHttpd', ['$q', function ($q) { + + return { + startServer: function (options) { + var d = $q.defer(); + + cordova.plugins.CorHttpd.startServer(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + stopServer: function () { + var d = $q.defer(); + + cordova.plugins.CorHttpd.stopServer(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + getURL: function () { + var d = $q.defer(); + + cordova.plugins.CorHttpd.getURL(function (url) { + d.resolve(url); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + getLocalPath: function () { + var d = $q.defer(); + + cordova.plugins.CorHttpd.getLocalPath(function (path) { + d.resolve(path); + }, function () { + d.reject(); + }); + + return d.promise; + } + + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-iad.git +// link : https://github.com/floatinghotpot/cordova-plugin-iad + +angular.module('ngCordova.plugins.iAd', []) + .factory('$cordovaiAd', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.iAd.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.iAd.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.iAd.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.iAd.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.iAd.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.iAd.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.iAd.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.iAd.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/wymsee/cordova-imagePicker.git +// link : https://github.com/wymsee/cordova-imagePicker + +angular.module('ngCordova.plugins.imagePicker', []) + + .factory('$cordovaImagePicker', ['$q', '$window', function ($q, $window) { + + return { + getPictures: function (options) { + var q = $q.defer(); + + $window.imagePicker.getPictures(function (results) { + q.resolve(results); + }, function (error) { + q.reject(error); + }, options); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-inappbrowser +// link : https://github.com/apache/cordova-plugin-inappbrowser + +angular.module('ngCordova.plugins.inAppBrowser', []) + + .provider('$cordovaInAppBrowser', [function () { + + var ref; + var defaultOptions = this.defaultOptions = {}; + + this.setDefaultOptions = function (config) { + defaultOptions = angular.extend(defaultOptions, config); + }; + + this.$get = ['$rootScope', '$q', '$window', '$timeout', function ($rootScope, $q, $window, $timeout) { + return { + open: function (url, target, requestOptions) { + var q = $q.defer(); + + if (requestOptions && !angular.isObject(requestOptions)) { + q.reject('options must be an object'); + return q.promise; + } + + var options = angular.extend({}, defaultOptions, requestOptions); + + var opt = []; + angular.forEach(options, function (value, key) { + opt.push(key + '=' + value); + }); + var optionsString = opt.join(); + + ref = $window.open(url, target, optionsString); + + ref.addEventListener('loadstart', function (event) { + $timeout(function () { + $rootScope.$broadcast('$cordovaInAppBrowser:loadstart', event); + }); + }, false); + + ref.addEventListener('loadstop', function (event) { + q.resolve(event); + $timeout(function () { + $rootScope.$broadcast('$cordovaInAppBrowser:loadstop', event); + }); + }, false); + + ref.addEventListener('loaderror', function (event) { + q.reject(event); + $timeout(function () { + $rootScope.$broadcast('$cordovaInAppBrowser:loaderror', event); + }); + }, false); + + ref.addEventListener('exit', function (event) { + $timeout(function () { + $rootScope.$broadcast('$cordovaInAppBrowser:exit', event); + }); + }, false); + + return q.promise; + }, + + close: function () { + ref.close(); + ref = null; + }, + + show: function () { + ref.show(); + }, + + executeScript: function (details) { + var q = $q.defer(); + + ref.executeScript(details, function (result) { + q.resolve(result); + }); + + return q.promise; + }, + + insertCSS: function (details) { + var q = $q.defer(); + + ref.insertCSS(details, function (result) { + q.resolve(result); + }); + + return q.promise; + } + }; + }]; + }]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin +angular.module('ngCordova.plugins.insomnia', []) + + .factory('$cordovaInsomnia', ['$window', function ($window) { + + return { + keepAwake: function () { + return $window.plugins.insomnia.keepAwake(); + }, + allowSleepAgain: function () { + return $window.plugins.insomnia.allowSleepAgain(); + } + }; + + }]); + +// install : cordova plugins add https://github.com/vstirbu/InstagramPlugin.git +// link : https://github.com/vstirbu/InstagramPlugin + +/* globals Instagram: true */ +angular.module('ngCordova.plugins.instagram', []) + +.factory('$cordovaInstagram', ['$q', function ($q) { + + return { + share: function (options) { + var q = $q.defer(); + + if (!window.Instagram) { + console.error('Tried to call Instagram.share but the Instagram plugin isn\'t installed!'); + q.resolve(null); + return q.promise; + } + + Instagram.share(options.image, options.caption, function (err) { + if(err) { + q.reject(err); + } else { + q.resolve(true); + } + }); + return q.promise; + }, + isInstalled: function () { + var q = $q.defer(); + + if (!window.Instagram) { + console.error('Tried to call Instagram.isInstalled but the Instagram plugin isn\'t installed!'); + q.resolve(null); + return q.promise; + } + + Instagram.isInstalled(function (err, installed) { + if (err) { + q.reject(err); + } else { + q.resolve(installed); + } + }); + return q.promise; + } + }; +}]); + +// install : cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard.git +// link : https://github.com/driftyco/ionic-plugins-keyboard + +angular.module('ngCordova.plugins.keyboard', []) + + .factory('$cordovaKeyboard', ['$rootScope', function ($rootScope) { + + var keyboardShowEvent = function () { + $rootScope.$evalAsync(function () { + $rootScope.$broadcast('$cordovaKeyboard:show'); + }); + }; + + var keyboardHideEvent = function () { + $rootScope.$evalAsync(function () { + $rootScope.$broadcast('$cordovaKeyboard:hide'); + }); + }; + + document.addEventListener('deviceready', function () { + if (cordova.plugins.Keyboard) { + window.addEventListener('native.keyboardshow', keyboardShowEvent, false); + window.addEventListener('native.keyboardhide', keyboardHideEvent, false); + } + }); + + return { + hideAccessoryBar: function (bool) { + return cordova.plugins.Keyboard.hideKeyboardAccessoryBar(bool); + }, + + close: function () { + return cordova.plugins.Keyboard.close(); + }, + + show: function () { + return cordova.plugins.Keyboard.show(); + }, + + disableScroll: function (bool) { + return cordova.plugins.Keyboard.disableScroll(bool); + }, + + isVisible: function () { + return cordova.plugins.Keyboard.isVisible; + }, + + clearShowWatch: function () { + document.removeEventListener('native.keyboardshow', keyboardShowEvent); + $rootScope.$$listeners['$cordovaKeyboard:show'] = []; + }, + + clearHideWatch: function () { + document.removeEventListener('native.keyboardhide', keyboardHideEvent); + $rootScope.$$listeners['$cordovaKeyboard:hide'] = []; + } + }; + }]); + +// install : cordova plugin add https://github.com/shazron/KeychainPlugin.git +// link : https://github.com/shazron/KeychainPlugin + +/* globals Keychain: true */ +angular.module('ngCordova.plugins.keychain', []) + + .factory('$cordovaKeychain', ['$q', function ($q) { + + return { + getForKey: function (key, serviceName) { + var defer = $q.defer(), + kc = new Keychain(); + + kc.getForKey(defer.resolve, defer.reject, key, serviceName); + + return defer.promise; + }, + + setForKey: function (key, serviceName, value) { + var defer = $q.defer(), + kc = new Keychain(); + + kc.setForKey(defer.resolve, defer.reject, key, serviceName, value); + + return defer.promise; + }, + + removeForKey: function (key, serviceName) { + var defer = $q.defer(), + kc = new Keychain(); + + kc.removeForKey(defer.resolve, defer.reject, key, serviceName); + + return defer.promise; + } + }; + }]); + +// install : cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator +// link : https://github.com/dpa99c/phonegap-launch-navigator + +/* globals launchnavigator: true */ +angular.module('ngCordova.plugins.launchNavigator', []) + + .factory('$cordovaLaunchNavigator', ['$q', function ($q) { + + return { + navigate: function (destination, start, options) { + var q = $q.defer(); + launchnavigator.navigate( + destination, + start, + function (){ + q.resolve(); + }, + function (error){ + q.reject(error); + }, + options); + return q.promise; + } + }; + + }]); + +// 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.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:schedule', notification, state); + }); + }); + + // A local notification was triggered + $window.cordova.plugins.notification.local.on('trigger', function (notification, state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:trigger', notification, state); + }); + }); + + // ----- "Update" events + + // A local notification was updated + $window.cordova.plugins.notification.local.on('update', function (notification, state) { + $timeout(function () { + $rootScope.$broadcast('$cordovaLocalNotification:update', notification, state); + }); + }); + + // ----- "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: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.cordova.plugins.notification.local.clearAll(function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + cancel: function (ids, scope) { + var q = $q.defer(); + scope = scope || null; + + $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.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.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); + + return q.promise; + }, + + hasPermission: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.hasPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } + }, scope); + + return q.promise; + }, + + registerPermission: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.registerPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } + }, scope); + + return q.promise; + }, + + promptForPermission: function (scope) { + console.warn('Deprecated: use "registerPermission" instead.'); + + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.registerPermission(function (result) { + if (result) { + q.resolve(result); + } else { + q.reject(result); + } + }, scope); + + return q.promise; + }, + + getAllIds: function (scope) { + var q = $q.defer(); + scope = scope || null; + + $window.cordova.plugins.notification.local.getAllIds(function (result) { + q.resolve(result); + }, scope); + + return q.promise; + }, + + 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(); + 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(); + 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.cordova.plugins.notification.local.getDefaults(); + }, + + setDefaults: function (Object) { + $window.cordova.plugins.notification.local.setDefaults(Object); + } + }; + }]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mmedia.git +// link : https://github.com/floatinghotpot/cordova-plugin-mmedia + +angular.module('ngCordova.plugins.mMediaAds', []) + + .factory('$cordovaMMediaAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.mMedia.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.mMedia.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.mMedia.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.mMedia.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.mMedia.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.mMedia.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.mMedia.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.mMedia.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-media +// link : https://github.com/apache/cordova-plugin-media + +/* globals Media: true */ +angular.module('ngCordova.plugins.media', []) + +.service('NewMedia', ['$q', '$interval', function ($q, $interval) { + var q, q2, q3, mediaStatus = null, mediaPosition = -1, mediaTimer, mediaDuration = -1; + + function setTimer(media) { + if (angular.isDefined(mediaTimer)) { + return; + } + + mediaTimer = $interval(function () { + if (mediaDuration < 0) { + mediaDuration = media.getDuration(); + if (q && mediaDuration > 0) { + q.notify({duration: mediaDuration}); + } + } + + media.getCurrentPosition( + // success callback + function (position) { + if (position > -1) { + mediaPosition = position; + } + }, + // error callback + function (e) { + console.log('Error getting pos=' + e); + }); + + if (q) { + q.notify({position: mediaPosition}); + } + + }, 1000); + } + + function clearTimer() { + if (angular.isDefined(mediaTimer)) { + $interval.cancel(mediaTimer); + mediaTimer = undefined; + } + } + + function resetValues() { + mediaPosition = -1; + mediaDuration = -1; + } + + function NewMedia(src) { + this.media = new Media(src, + function (success) { + clearTimer(); + resetValues(); + q.resolve(success); + }, function (error) { + clearTimer(); + resetValues(); + q.reject(error); + }, function (status) { + mediaStatus = status; + q.notify({status: mediaStatus}); + }); + } + + // iOS quirks : + // - myMedia.play({ numberOfLoops: 2 }) -> looping + // - myMedia.play({ playAudioWhenScreenIsLocked : false }) + NewMedia.prototype.play = function (options) { + q = $q.defer(); + + if (typeof options !== 'object') { + options = {}; + } + + this.media.play(options); + + setTimer(this.media); + + return q.promise; + }; + + NewMedia.prototype.pause = function () { + clearTimer(); + this.media.pause(); + }; + + NewMedia.prototype.stop = function () { + this.media.stop(); + }; + + NewMedia.prototype.release = function () { + this.media.release(); + this.media = undefined; + }; + + NewMedia.prototype.seekTo = function (timing) { + this.media.seekTo(timing); + }; + + NewMedia.prototype.setVolume = function (volume) { + this.media.setVolume(volume); + }; + + NewMedia.prototype.startRecord = function () { + this.media.startRecord(); + }; + + NewMedia.prototype.stopRecord = function () { + this.media.stopRecord(); + }; + + NewMedia.prototype.currentTime = function () { + q2 = $q.defer(); + this.media.getCurrentPosition(function (position){ + q2.resolve(position); + }); + return q2.promise; + }; + + NewMedia.prototype.getDuration = function () { + q3 = $q.defer(); + this.media.getDuration(function (duration){ + q3.resolve(duration); + }); + return q3.promise; + }; + + return NewMedia; + +}]) +.factory('$cordovaMedia', ['NewMedia', function (NewMedia) { + return { + newMedia: function (src) { + return new NewMedia(src); + } + }; +}]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-mobfox-pro.git +// link : https://github.com/floatinghotpot/cordova-mobfox-pro + +angular.module('ngCordova.plugins.mobfoxAds', []) + + .factory('$cordovaMobFoxAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.MobFox.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.MobFox.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.MobFox.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.MobFox.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.MobFox.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.MobFox.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.MobFox.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.MobFox.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.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.beacon', + '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.googlePlus', + 'ngCordova.plugins.healthKit', + 'ngCordova.plugins.httpd', + 'ngCordova.plugins.iAd', + 'ngCordova.plugins.imagePicker', + 'ngCordova.plugins.inAppBrowser', + 'ngCordova.plugins.instagram', + 'ngCordova.plugins.keyboard', + 'ngCordova.plugins.keychain', + 'ngCordova.plugins.launchNavigator', + 'ngCordova.plugins.localNotification', + 'ngCordova.plugins.media', + 'ngCordova.plugins.mMediaAds', + 'ngCordova.plugins.mobfoxAds', + 'ngCordova.plugins.mopubAds', + 'ngCordova.plugins.nativeAudio', + 'ngCordova.plugins.network', + 'ngCordova.plugins.pinDialog', + 'ngCordova.plugins.preferences', + 'ngCordova.plugins.printer', + 'ngCordova.plugins.progressIndicator', + 'ngCordova.plugins.push', + 'ngCordova.plugins.push_v5', + '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' +]); + +// install : cordova plugin add https://github.com/floatinghotpot/cordova-plugin-mopub.git +// link : https://github.com/floatinghotpot/cordova-plugin-mopub + +angular.module('ngCordova.plugins.mopubAds', []) + .factory('$cordovaMoPubAds', ['$q', '$window', function ($q, $window) { + + return { + setOptions: function (options) { + var d = $q.defer(); + + $window.MoPub.setOptions(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + createBanner: function (options) { + var d = $q.defer(); + + $window.MoPub.createBanner(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + removeBanner: function () { + var d = $q.defer(); + + $window.MoPub.removeBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBanner: function (position) { + var d = $q.defer(); + + $window.MoPub.showBanner(position, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showBannerAtXY: function (x, y) { + var d = $q.defer(); + + $window.MoPub.showBannerAtXY(x, y, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + hideBanner: function () { + var d = $q.defer(); + + $window.MoPub.hideBanner(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + prepareInterstitial: function (options) { + var d = $q.defer(); + + $window.MoPub.prepareInterstitial(options, function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + }, + + showInterstitial: function () { + var d = $q.defer(); + + $window.MoPub.showInterstitial(function () { + d.resolve(); + }, function () { + d.reject(); + }); + + return d.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/sidneys/cordova-plugin-nativeaudio.git +// link : https://github.com/sidneys/cordova-plugin-nativeaudio + +angular.module('ngCordova.plugins.nativeAudio', []) + + .factory('$cordovaNativeAudio', ['$q', '$window', function ($q, $window) { + + return { + preloadSimple: function (id, assetPath) { + var q = $q.defer(); + $window.plugins.NativeAudio.preloadSimple(id, assetPath, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + preloadComplex: function (id, assetPath, volume, voices, delay) { + var q = $q.defer(); + $window.plugins.NativeAudio.preloadComplex(id, assetPath, volume, voices, delay, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + play: function (id, completeCallback) { + var q = $q.defer(); + $window.plugins.NativeAudio.play(id, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }, completeCallback); + + return q.promise; + }, + + stop: function (id) { + var q = $q.defer(); + $window.plugins.NativeAudio.stop(id, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + return q.promise; + }, + + loop: function (id) { + var q = $q.defer(); + $window.plugins.NativeAudio.loop(id, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + unload: function (id) { + var q = $q.defer(); + $window.plugins.NativeAudio.unload(id, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + }, + + setVolumeForComplexAsset: function (id, volume) { + var q = $q.defer(); + $window.plugins.NativeAudio.setVolumeForComplexAsset(id, volume, function (result) { + q.resolve(result); + }, function (err) { + q.reject(err); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-network-information +// link : https://github.com/apache/cordova-plugin-network-information + +/* globals Connection: true */ +angular.module('ngCordova.plugins.network', []) + + .factory('$cordovaNetwork', ['$rootScope', '$timeout', function ($rootScope, $timeout) { + + /** + * Fires offline a event + */ + var offlineEvent = function () { + var networkState = navigator.connection.type; + $timeout(function () { + $rootScope.$broadcast('$cordovaNetwork:offline', networkState); + }); + }; + + /** + * Fires online a event + */ + var onlineEvent = function () { + var networkState = navigator.connection.type; + $timeout(function () { + $rootScope.$broadcast('$cordovaNetwork:online', networkState); + }); + }; + + document.addEventListener('deviceready', function () { + if (navigator.connection) { + document.addEventListener('offline', offlineEvent, false); + document.addEventListener('online', onlineEvent, false); + } + }); + + return { + getNetwork: function () { + return navigator.connection.type; + }, + + isOnline: function () { + var networkState = navigator.connection.type; + return networkState !== Connection.UNKNOWN && networkState !== Connection.NONE; + }, + + isOffline: function () { + var networkState = navigator.connection.type; + return networkState === Connection.UNKNOWN || networkState === Connection.NONE; + }, + + clearOfflineWatch: function () { + document.removeEventListener('offline', offlineEvent); + $rootScope.$$listeners['$cordovaNetwork:offline'] = []; + }, + + clearOnlineWatch: function () { + document.removeEventListener('online', onlineEvent); + $rootScope.$$listeners['$cordovaNetwork:online'] = []; + } + }; + }]) + .run(['$injector', function ($injector) { + $injector.get('$cordovaNetwork'); //ensure the factory always gets initialised + }]); + +// install : cordova plugin add https://github.com/Paldom/PinDialog.git +// link : https://github.com/Paldom/PinDialog + +angular.module('ngCordova.plugins.pinDialog', []) + + .factory('$cordovaPinDialog', ['$q', '$window', function ($q, $window) { + + return { + prompt: function (message, title, buttons) { + var q = $q.defer(); + + $window.plugins.pinDialog.prompt(message, function (res) { + q.resolve(res); + }, title, buttons); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-app-preferences +// link : https://github.com/apla/me.apla.cordova.app-preferences + +angular.module('ngCordova.plugins.preferences', []) + + .factory('$cordovaPreferences', ['$window', '$q', function ($window, $q) { + + return { + + pluginNotEnabledMessage: 'Plugin not enabled', + + /** + * Decorate the promise object. + * @param promise The promise object. + */ + decoratePromise: function (promise){ + promise.success = function (fn) { + promise.then(fn); + return promise; + }; + + promise.error = function (fn) { + promise.then(null, fn); + return promise; + }; + }, + + /** + * Store the value of the given dictionary and key. + * @param key The key of the preference. + * @param value The value to set. + * @param dict The dictionary. It's optional. + * @returns Returns a promise. + */ + store: function (key, value, dict) { + var deferred = $q.defer(); + var promise = deferred.promise; + + function ok(value){ + deferred.resolve(value); + } + + function errorCallback(error){ + deferred.reject(new Error(error)); + } + + if($window.plugins){ + var storeResult; + if(arguments.length === 3){ + storeResult = $window.plugins.appPreferences.store(dict, key, value); + } else { + storeResult = $window.plugins.appPreferences.store(key, value); + } + + storeResult.then(ok, errorCallback); + } else { + deferred.reject(new Error(this.pluginNotEnabledMessage)); + } + + this.decoratePromise(promise); + return promise; + }, + + /** + * Fetch the value by the given dictionary and key. + * @param key The key of the preference to retrieve. + * @param dict The dictionary. It's optional. + * @returns Returns a promise. + */ + fetch: function (key, dict) { + var deferred = $q.defer(); + var promise = deferred.promise; + + function ok(value){ + deferred.resolve(value); + } + + function errorCallback(error){ + deferred.reject(new Error(error)); + } + + if($window.plugins){ + var fetchResult; + if(arguments.length === 2){ + fetchResult = $window.plugins.appPreferences.fetch(dict, key); + } else { + fetchResult = $window.plugins.appPreferences.fetch(key); + } + fetchResult.then(ok, errorCallback); + } else { + deferred.reject(new Error(this.pluginNotEnabledMessage)); + } + + this.decoratePromise(promise); + return promise; + }, + + /** + * Remove the value by the given key. + * @param key The key of the preference to retrieve. + * @param dict The dictionary. It's optional. + * @returns Returns a promise. + */ + remove: function (key, dict) { + var deferred = $q.defer(); + var promise = deferred.promise; + + function ok(value){ + deferred.resolve(value); + } + + function errorCallback(error){ + deferred.reject(new Error(error)); + } + + if($window.plugins){ + var removeResult; + if(arguments.length === 2){ + removeResult = $window.plugins.appPreferences.remove(dict, key); + } else { + removeResult = $window.plugins.appPreferences.remove(key); + } + removeResult.then(ok, errorCallback); + } else { + deferred.reject(new Error(this.pluginNotEnabledMessage)); + } + + this.decoratePromise(promise); + return promise; + }, + + /** + * Show the application preferences. + * @returns Returns a promise. + */ + show: function () { + var deferred = $q.defer(); + var promise = deferred.promise; + + function ok(value){ + deferred.resolve(value); + } + + function errorCallback(error){ + deferred.reject(new Error(error)); + } + + if($window.plugins){ + $window.plugins.appPreferences.show() + .then(ok, errorCallback); + } else { + deferred.reject(new Error(this.pluginNotEnabledMessage)); + } + + this.decoratePromise(promise); + return promise; + } + }; + + }]); + +// 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', []) + + .factory('$cordovaPrinter', ['$q', '$window', function ($q, $window) { + + return { + isAvailable: function () { + var q = $q.defer(); + + $window.plugin.printer.isAvailable(function (isAvailable) { + q.resolve(isAvailable); + }); + + return q.promise; + }, + + print: function (doc, options) { + var q = $q.defer(); + $window.plugin.printer.print(doc, options, function () { + q.resolve(); + }); + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/pbernasconi/cordova-progressIndicator.git +// link : http://pbernasconi.github.io/cordova-progressIndicator/ + +/* globals ProgressIndicator: true */ +angular.module('ngCordova.plugins.progressIndicator', []) + + .factory('$cordovaProgress', [function () { + + return { + show: function (_message) { + var message = _message || 'Please wait...'; + return ProgressIndicator.show(message); + }, + + showSimple: function (_dim) { + var dim = _dim || false; + return ProgressIndicator.showSimple(dim); + }, + + showSimpleWithLabel: function (_dim, _label) { + var dim = _dim || false; + var label = _label || 'Loading...'; + return ProgressIndicator.showSimpleWithLabel(dim, label); + }, + + showSimpleWithLabelDetail: function (_dim, _label, _detail) { + var dim = _dim || false; + var label = _label || 'Loading...'; + var detail = _detail || 'Please wait'; + return ProgressIndicator.showSimpleWithLabelDetail(dim, label, detail); + }, + + showDeterminate: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + return ProgressIndicator.showDeterminate(dim, timeout); + }, + + showDeterminateWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + + return ProgressIndicator.showDeterminateWithLabel(dim, timeout, label); + }, + + showAnnular: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + return ProgressIndicator.showAnnular(dim, timeout); + }, + + showAnnularWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + return ProgressIndicator.showAnnularWithLabel(dim, timeout, label); + }, + + showBar: function (_dim, _timeout) { + var dim = _dim || false; + var timeout = _timeout || 50000; + return ProgressIndicator.showBar(dim, timeout); + }, + + showBarWithLabel: function (_dim, _timeout, _label) { + var dim = _dim || false; + var timeout = _timeout || 50000; + var label = _label || 'Loading...'; + return ProgressIndicator.showBarWithLabel(dim, timeout, label); + }, + + showSuccess: function (_dim, _label) { + var dim = _dim || false; + var label = _label || 'Success'; + return ProgressIndicator.showSuccess(dim, label); + }, + + showText: function (_dim, _text, _position) { + var dim = _dim || false; + var text = _text || 'Warning'; + var position = _position || 'center'; + return ProgressIndicator.showText(dim, text, position); + }, + + hide: function () { + return ProgressIndicator.hide(); + } + }; + + }]); + +// install : cordova plugin add https://github.com/phonegap-build/PushPlugin.git +// link : https://github.com/phonegap-build/PushPlugin + +angular.module('ngCordova.plugins.push', []) + + .factory('$cordovaPush', ['$q', '$window', '$rootScope', '$timeout', function ($q, $window, $rootScope, $timeout) { + + return { + onNotification: function (notification) { + $timeout(function () { + $rootScope.$broadcast('$cordovaPush:notificationReceived', notification); + }); + }, + + register: function (config) { + var q = $q.defer(); + var injector; + if (config !== undefined && config.ecb === undefined) { + if (document.querySelector('[ng-app]') === null) { + injector = 'document.body'; + } + else { + injector = 'document.querySelector(\'[ng-app]\')'; + } + config.ecb = 'angular.element(' + injector + ').injector().get(\'$cordovaPush\').onNotification'; + } + + $window.plugins.pushNotification.register(function (token) { + q.resolve(token); + }, function (error) { + q.reject(error); + }, config); + + return q.promise; + }, + + unregister: function (options) { + var q = $q.defer(); + $window.plugins.pushNotification.unregister(function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }, options); + + return q.promise; + }, + + // iOS only + setBadgeNumber: function (number) { + var q = $q.defer(); + $window.plugins.pushNotification.setApplicationIconBadgeNumber(function (result) { + q.resolve(result); + }, function (error) { + q.reject(error); + }, number); + return q.promise; + } + }; + }]); + + +// install : cordova plugin add phonegap-plugin-push +// link : https://github.com/phonegap/phonegap-plugin-push + +angular.module('ngCordova.plugins.push_v5', []) + .factory('$cordovaPushV5',['$q', '$rootScope', '$timeout', function ($q, $rootScope, $timeout) { + /*global PushNotification*/ + + var push; + return { + initialize : function (options) { + var q = $q.defer(); + push = PushNotification.init(options); + q.resolve(push); + return q.promise; + }, + onNotification : function () { + $timeout(function () { + push.on('notification', function (notification) { + $rootScope.$emit('$cordovaPushV5:notificationReceived', notification); + }); + }); + }, + onError : function () { + $timeout(function () { + push.on('error', function (error) { $rootScope.$emit('$cordovaPushV5:errorOccurred', error);}); + }); + }, + register : function () { + var q = $q.defer(); + if (push === undefined) { + q.reject(new Error('init must be called before any other operation')); + } else { + push.on('registration', function (data) { + q.resolve(data.registrationId); + }); + } + return q.promise; + }, + unregister : function () { + var q = $q.defer(); + if (push === undefined) { + q.reject(new Error('init must be called before any other operation')); + } else { + push.unregister(function (success) { + q.resolve(success); + },function (error) { + q.reject(error); + }); + } + return q.promise; + }, + getBadgeNumber : function () { + var q = $q.defer(); + if (push === undefined) { + q.reject(new Error('init must be called before any other operation')); + } else { + push.getApplicationIconBadgeNumber(function (success) { + q.resolve(success); + }, function (error) { + q.reject(error); + }); + } + return q.promise; + }, + setBadgeNumber : function (number) { + var q = $q.defer(); + if (push === undefined) { + q.reject(new Error('init must be called before any other operation')); + } else { + push.setApplicationIconBadgeNumber(function (success) { + q.resolve(success); + }, function (error) { + q.reject(error); + }, number); + } + return q.promise; + }, + finish: function (){ + var q = $q.defer(); + if (push === undefined) { + q.reject(new Error('init must be called before any other operation')); + } else { + push.finish(function (success) { + q.resolve(success); + }, function (error) { + q.reject(error); + }); + } + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/gitawego/cordova-screenshot.git +// link : https://github.com/gitawego/cordova-screenshot + +angular.module('ngCordova.plugins.screenshot', []) +.factory('$cordovaScreenshot', ['$q', function ($q) { + return { + captureToFile: function (opts) { + + var options = opts || {}; + + var extension = options.extension || 'jpg'; + var quality = options.quality || '100'; + + var defer = $q.defer(); + + if (!navigator.screenshot) { + defer.resolve(null); + return defer.promise; + } + + navigator.screenshot.save(function (error, res) { + if (error) { + defer.reject(error); + } else { + defer.resolve(res.filePath); + } + }, extension, quality, options.filename); + + return defer.promise; + }, + captureToUri: function (opts) { + + var options = opts || {}; + + var extension = options.extension || 'jpg'; + var quality = options.quality || '100'; + + var defer = $q.defer(); + + if (!navigator.screenshot) { + defer.resolve(null); + return defer.promise; + } + + navigator.screenshot.URI(function (error, res) { + if (error) { + defer.reject(error); + } else { + defer.resolve(res.URI); + } + }, extension, quality, options.filename); + + return defer.promise; + } + }; +}]); +// install : cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git +// link : https://github.com/cordova-sms/cordova-sms-plugin + +/* globals sms: true */ +angular.module('ngCordova.plugins.sms', []) + + .factory('$cordovaSms', ['$q', function ($q) { + + return { + send: function (number, message, options) { + var q = $q.defer(); + sms.send(number, message, options, function (res) { + q.resolve(res); + }, function (err) { + q.reject(err); + }); + return q.promise; + } + }; + + }]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin + +// NOTE: shareViaEmail -> if user cancels sharing email, success is still called +// TODO: add support for iPad + +angular.module('ngCordova.plugins.socialSharing', []) + + .factory('$cordovaSocialSharing', ['$q', '$window', function ($q, $window) { + + return { + share: function (message, subject, file, link) { + var q = $q.defer(); + subject = subject || null; + file = file || null; + link = link || null; + $window.plugins.socialsharing.share(message, subject, file, link, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaTwitter: function (message, file, link) { + var q = $q.defer(); + file = file || null; + link = link || null; + $window.plugins.socialsharing.shareViaTwitter(message, file, link, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaWhatsApp: function (message, file, link) { + var q = $q.defer(); + file = file || null; + link = link || null; + $window.plugins.socialsharing.shareViaWhatsApp(message, file, link, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaFacebook: function (message, file, link) { + var q = $q.defer(); + message = message || null; + file = file || null; + link = link || null; + $window.plugins.socialsharing.shareViaFacebook(message, file, link, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaFacebookWithPasteMessageHint: function (message, file, link, pasteMessageHint) { + var q = $q.defer(); + file = file || null; + link = link || null; + $window.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(message, file, link, pasteMessageHint, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaSMS: function (message, commaSeparatedPhoneNumbers) { + var q = $q.defer(); + $window.plugins.socialsharing.shareViaSMS(message, commaSeparatedPhoneNumbers, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareViaEmail: function (message, subject, toArr, ccArr, bccArr, fileArr) { + var q = $q.defer(); + toArr = toArr || null; + ccArr = ccArr || null; + bccArr = bccArr || null; + fileArr = fileArr || null; + $window.plugins.socialsharing.shareViaEmail(message, subject, toArr, ccArr, bccArr, fileArr, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + shareVia: function (via, message, subject, file, link) { + var q = $q.defer(); + message = message || null; + subject = subject || null; + file = file || null; + link = link || null; + $window.plugins.socialsharing.shareVia(via, message, subject, file, link, function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + canShareViaEmail: function () { + var q = $q.defer(); + $window.plugins.socialsharing.canShareViaEmail(function () { + q.resolve(true); + }, function () { + q.reject(false); + }); + return q.promise; + }, + + canShareVia: function (via, message, subject, file, link) { + var q = $q.defer(); + $window.plugins.socialsharing.canShareVia(via, message, subject, file, link, function (success) { + q.resolve(success); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + available: function () { + var q = $q.defer(); + window.plugins.socialsharing.available(function (isAvailable) { + if (isAvailable) { + q.resolve(); + } + else { + q.reject(); + } + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/Paldom/SpinnerDialog.git +// link : https://github.com/Paldom/SpinnerDialog + +angular.module('ngCordova.plugins.spinnerDialog', []) + + .factory('$cordovaSpinnerDialog', ['$window', function ($window) { + + return { + show: function (title, message, fixed) { + fixed = fixed || false; + return $window.plugins.spinnerDialog.show(title, message, fixed); + }, + hide: function () { + return $window.plugins.spinnerDialog.hide(); + } + }; + + }]); + +// install : cordova plugin add cordova-plugin-splashscreen +// link : https://github.com/apache/cordova-plugin-splashscreen + +angular.module('ngCordova.plugins.splashscreen', []) + + .factory('$cordovaSplashscreen', [function () { + + return { + hide: function () { + return navigator.splashscreen.hide(); + }, + + show: function () { + return navigator.splashscreen.show(); + } + }; + + }]); + +// 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', []) + + .factory('$cordovaSQLite', ['$q', '$window', function ($q, $window) { + + return { + openDB: function (options, background) { + + if (angular.isObject(options) && !angular.isString(options)) { + if (typeof background !== 'undefined') { + options.bgType = background; + } + return $window.sqlitePlugin.openDatabase(options); + } + + return $window.sqlitePlugin.openDatabase({ + name: options, + bgType: background + }); + }, + + execute: function (db, query, binding) { + var q = $q.defer(); + db.transaction(function (tx) { + tx.executeSql(query, binding, function (tx, result) { + q.resolve(result); + }, + function (transaction, error) { + q.reject(error); + }); + }); + return q.promise; + }, + + insertCollection: function (db, query, bindings) { + var q = $q.defer(); + var coll = bindings.slice(0); // clone collection + + db.transaction(function (tx) { + (function insertOne() { + var record = coll.splice(0, 1)[0]; // get the first record of coll and reduce coll by one + try { + tx.executeSql(query, record, function (tx, result) { + if (coll.length === 0) { + q.resolve(result); + } else { + insertOne(); + } + }, function (transaction, error) { + q.reject(error); + return; + }); + } catch (exception) { + q.reject(exception); + } + })(); + }); + return q.promise; + }, + + nestedExecute: function (db, query1, query2, binding1, binding2) { + var q = $q.defer(); + + db.transaction(function (tx) { + tx.executeSql(query1, binding1, function (tx, result) { + q.resolve(result); + tx.executeSql(query2, binding2, function (tx, res) { + q.resolve(res); + }); + }); + }, + function (transaction, error) { + q.reject(error); + }); + + return q.promise; + }, + + deleteDB: function (dbName) { + var q = $q.defer(); + + $window.sqlitePlugin.deleteDatabase(dbName, function (success) { + q.resolve(success); + }, function (error) { + q.reject(error); + }); + + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-statusbar +// link : https://github.com/apache/cordova-plugin-statusbar + +/* globals StatusBar: true */ +angular.module('ngCordova.plugins.statusbar', []) + +.factory('$cordovaStatusbar', [function () { + + return { + + /** + * @param {boolean} bool + */ + overlaysWebView: function (bool) { + return StatusBar.overlaysWebView(!!bool); + }, + + STYLES: { + DEFAULT: 0, + LIGHT_CONTENT: 1, + BLACK_TRANSLUCENT: 2, + BLACK_OPAQUE: 3 + }, + + /** + * @param {number} style + */ + style: function (style) { + switch (style) { + // Default + case 0: + return StatusBar.styleDefault(); + + // LightContent + case 1: + return StatusBar.styleLightContent(); + + // BlackTranslucent + case 2: + return StatusBar.styleBlackTranslucent(); + + // BlackOpaque + case 3: + return StatusBar.styleBlackOpaque(); + + default: + return StatusBar.styleDefault(); + } + }, + + // supported names: + // black, darkGray, lightGray, white, gray, red, green, + // blue, cyan, yellow, magenta, orange, purple, brown + styleColor: function (color) { + return StatusBar.backgroundColorByName(color); + }, + + styleHex: function (colorHex) { + return StatusBar.backgroundColorByHexString(colorHex); + }, + + hide: function () { + return StatusBar.hide(); + }, + + show: function () { + return StatusBar.show(); + }, + + isVisible: function () { + return StatusBar.isVisible; + } + }; +}]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin + +angular.module('ngCordova.plugins.toast', []) + + .factory('$cordovaToast', ['$q', '$window', function ($q, $window) { + + return { + showShortTop: function (message) { + var q = $q.defer(); + $window.plugins.toast.showShortTop(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + showShortCenter: function (message) { + var q = $q.defer(); + $window.plugins.toast.showShortCenter(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + showShortBottom: function (message) { + var q = $q.defer(); + $window.plugins.toast.showShortBottom(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + showLongTop: function (message) { + var q = $q.defer(); + $window.plugins.toast.showLongTop(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + showLongCenter: function (message) { + var q = $q.defer(); + $window.plugins.toast.showLongCenter(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + showLongBottom: function (message) { + var q = $q.defer(); + $window.plugins.toast.showLongBottom(message, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + show: function (message, duration, position) { + var q = $q.defer(); + $window.plugins.toast.show(message, duration, position, function (response) { + q.resolve(response); + }, function (error) { + q.reject(error); + }); + return q.promise; + }, + + hide: function () { + var q = $q.defer(); + try { + $window.plugins.toast.hide(); + q.resolve(); + } catch (error) { + q.reject(error && error.message); + } + return q.promise; + } + }; + + }]); + +// install : cordova plugin add https://github.com/leecrossley/cordova-plugin-touchid.git +// link : https://github.com/leecrossley/cordova-plugin-touchid + +/* globals touchid: true */ +angular.module('ngCordova.plugins.touchid', []) + + .factory('$cordovaTouchID', ['$q', function ($q) { + + return { + checkSupport: function () { + var defer = $q.defer(); + if (!window.cordova) { + defer.reject('Not supported without cordova.js'); + } else { + touchid.checkSupport(function (value) { + defer.resolve(value); + }, function (err) { + defer.reject(err); + }); + } + + return defer.promise; + }, + + authenticate: function (authReasonText) { + var defer = $q.defer(); + if (!window.cordova) { + defer.reject('Not supported without cordova.js'); + } else { + touchid.authenticate(function (value) { + defer.resolve(value); + }, function (err) { + defer.reject(err); + }, authReasonText); + } + + return defer.promise; + } + }; + }]); + +// install : cordova plugin add https://github.com/aerogear/aerogear-cordova-push.git +// link : https://github.com/aerogear/aerogear-cordova-push + +angular.module('ngCordova.plugins.upsPush', []) + + .factory('$cordovaUpsPush', ['$q', '$window', '$rootScope', '$timeout', function ($q, $window, $rootScope, $timeout) { + return { + register: function (config) { + var q = $q.defer(); + + $window.push.register(function (notification) { + $timeout(function () { + $rootScope.$broadcast('$cordovaUpsPush:notificationReceived', notification); + }); + }, function () { + q.resolve(); + }, function (error) { + q.reject(error); + }, config); + + return q.promise; + }, + + unregister: function (options) { + var q = $q.defer(); + $window.push.unregister(function () { + q.resolve(); + }, function (error) { + q.reject(error); + }, options); + + return q.promise; + }, + + // iOS only + setBadgeNumber: function (number) { + var q = $q.defer(); + $window.push.setApplicationIconBadgeNumber(function () { + q.resolve(); + }, number); + return q.promise; + } + }; + }]); + +// install : cordova plugin add cordova-plugin-vibration +// link : https://github.com/apache/cordova-plugin-vibration + +angular.module('ngCordova.plugins.vibration', []) + + .factory('$cordovaVibration', [function () { + + return { + vibrate: function (times) { + return navigator.notification.vibrate(times); + }, + vibrateWithPattern: function (pattern, repeat) { + return navigator.notification.vibrateWithPattern(pattern, repeat); + }, + cancelVibration: function () { + return navigator.notification.cancelVibration(); + } + }; + }]); + +// install : cordova plugin add https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin.git +// link : https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin + +angular.module('ngCordova.plugins.videoCapturePlus', []) + + .provider('$cordovaVideoCapturePlus', [function () { + + var defaultOptions = {}; + + + /** + * the nr of videos to record, default 1 (on iOS always 1) + * + * @param limit + */ + this.setLimit = function setLimit(limit) { + defaultOptions.limit = limit; + }; + + + /** + * max duration in seconds, default 0, which is 'forever' + * + * @param seconds + */ + this.setMaxDuration = function setMaxDuration(seconds) { + defaultOptions.duration = seconds; + }; + + + /** + * set to true to override the default low quality setting + * + * @param {Boolean} highquality + */ + this.setHighQuality = function setHighQuality(highquality) { + defaultOptions.highquality = highquality; + }; + + /** + * you'll want to sniff the user-Agent/device and pass the best overlay based on that.. + * set to true to override the default backfacing camera setting. iOS: works fine, Android: YMMV (#18) + * + * @param {Boolean} frontcamera + */ + this.useFrontCamera = function useFrontCamera(frontcamera) { + defaultOptions.frontcamera = frontcamera; + }; + + + /** + * put the png in your www folder + * + * @param {String} imageUrl + */ + this.setPortraitOverlay = function setPortraitOverlay(imageUrl) { + defaultOptions.portraitOverlay = imageUrl; + }; + + + /** + * + * @param {String} imageUrl + */ + this.setLandscapeOverlay = function setLandscapeOverlay(imageUrl) { + defaultOptions.landscapeOverlay = imageUrl; + }; + + + /** + * iOS only + * + * @param text + */ + this.setOverlayText = function setOverlayText(text) { + defaultOptions.overlayText = text; + }; + + + this.$get = ['$q', '$window', function ($q, $window) { + return { + captureVideo: function (options) { + var q = $q.defer(); + + if (!$window.plugins.videocaptureplus) { + q.resolve(null); + return q.promise; + } + + $window.plugins.videocaptureplus.captureVideo(q.resolve, q.reject, + angular.extend({}, defaultOptions, options)); + + return q.promise; + } + }; + }]; + }]); + +// install : cordova plugin add https://github.com/MobileChromeApps/zip.git +// link : https://github.com/MobileChromeApps/zip + +angular.module('ngCordova.plugins.zip', []) + + .factory('$cordovaZip', ['$q', '$window', function ($q, $window) { + + return { + unzip: function (source, destination) { + var q = $q.defer(); + + $window.zip.unzip(source, destination, function (isError) { + if (isError === 0) { + q.resolve(); + } else { + q.reject(); + } + }, function (progressEvent) { + q.notify(progressEvent); + }); + + return q.promise; + } + }; + }]); + +})();
\ No newline at end of file diff --git a/www/lib/ngCordova/dist/ng-cordova.min.js b/www/lib/ngCordova/dist/ng-cordova.min.js new file mode 100644 index 00000000..4ae32822 --- /dev/null +++ b/www/lib/ngCordova/dist/ng-cordova.min.js @@ -0,0 +1,9 @@ +/*! + * ngCordova + * v0.1.26-alpha + * Copyright 2015 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(r){var o=e.defer();return n.plugins.actionsheet.show(r,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(r){var o=e.defer();return n.plugins.AdMob.createBannerView(r,function(){o.resolve()},function(){o.reject()}),o.promise},createInterstitialView:function(r){var o=e.defer();return n.plugins.AdMob.createInterstitialView(r,function(){o.resolve()},function(){o.reject()}),o.promise},requestAd:function(r){var o=e.defer();return n.plugins.AdMob.requestAd(r,function(){o.resolve()},function(){o.reject()}),o.promise},showAd:function(r){var o=e.defer();return n.plugins.AdMob.showAd(r,function(){o.resolve()},function(){o.reject()}),o.promise},requestInterstitialAd:function(r){var o=e.defer();return n.plugins.AdMob.requestInterstitialAd(r,function(){o.resolve()},function(){o.reject()}),o.promise}}}]),angular.module("ngCordova.plugins.appAvailability",[]).factory("$cordovaAppAvailability",["$q",function(e){return{check:function(n){var r=e.defer();return appAvailability.check(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.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 r=e.defer(),o=AppRate.promptForRating(n);return r.resolve(o),r.promise},navigateToAppStore:function(){var n=e.defer(),r=AppRate.navigateToAppStore();return n.resolve(r),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{getAppName:function(){var n=e.defer();return cordova.getAppVersion.getAppName(function(e){n.resolve(e)}),n.promise},getPackageName:function(){var n=e.defer();return cordova.getAppVersion.getPackageName(function(e){n.resolve(e)}),n.promise},getVersionNumber:function(){var n=e.defer();return cordova.getAppVersion.getVersionNumber(function(e){n.resolve(e)}),n.promise},getVersionCode:function(){var n=e.defer();return cordova.getAppVersion.getVersionCode(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(r){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)},r),this.start(),o.promise},start:function(){var r=e.defer();return n.plugins.backgroundGeoLocation.start(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},stop:function(){var r=e.defer();return n.plugins.backgroundGeoLocation.stop(function(e){r.resolve(e)},function(e){r.reject(e)}),r.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,r,o){var t=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?t.resolve(cordova.plugins.notification.badge.set(n,r,o)):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(n,r){var o=e.defer();return cordova.plugins.notification.badge.hasPermission(function(e){e?o.resolve(cordova.plugins.notification.badge.clear(n,r)):o.reject("You do not have permission to clear Badge")}),o.promise},increase:function(n,r,o){var t=e.defer();return this.hasPermission().then(function(){t.resolve(cordova.plugins.notification.badge.increase(n,r,o))},function(){t.reject("You do not have permission to increase Badge")}),t.promise},decrease:function(n,r,o){var t=e.defer();return this.hasPermission().then(function(){t.resolve(cordova.plugins.notification.badge.decrease(n,r,o))},function(){t.reject("You do not have permission to decrease Badge")}),t.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 r=e.defer();return cordova.plugins.barcodeScanner.scan(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},encode:function(n,r){var o=e.defer();return n=n||"TEXT_TYPE",cordova.plugins.barcodeScanner.encode(n,r,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,r){var o=function(n){r(function(){e.$broadcast("$cordovaBatteryStatus:status",n)})},t=function(n){r(function(){e.$broadcast("$cordovaBatteryStatus:critical",n)})},i=function(n){r(function(){e.$broadcast("$cordovaBatteryStatus:low",n)})};return document.addEventListener("deviceready",function(){navigator.battery&&(n.addEventListener("batterystatus",o,!1),n.addEventListener("batterycritical",t,!1),n.addEventListener("batterylow",i,!1))},!1),!0}]).run(["$injector",function(e){e.get("$cordovaBatteryStatus")}]),angular.module("ngCordova.plugins.beacon",[]).factory("$cordovaBeacon",["$window","$rootScope","$timeout","$q",function(e,n,r,o){var t=null,i=null,a=null,c=null,u=null,s=null,l=null,f=null;return document.addEventListener("deviceready",function(){if(e.cordova&&e.cordova.plugins&&e.cordova.plugins.locationManager){var o=new e.cordova.plugins.locationManager.Delegate;o.didDetermineStateForRegion=function(e){r(function(){n.$broadcast("$cordovaBeacon:didDetermineStateForRegion",e)}),t&&t(e)},o.didStartMonitoringForRegion=function(e){r(function(){n.$broadcast("$cordovaBeacon:didStartMonitoringForRegion",e)}),i&&i(e)},o.didExitRegion=function(e){r(function(){n.$broadcast("$cordovaBeacon:didExitRegion",e)}),a&&a(e)},o.didEnterRegion=function(e){r(function(){n.$broadcast("$cordovaBeacon:didEnterRegion",e)}),c&&c(e)},o.didRangeBeaconsInRegion=function(e){r(function(){n.$broadcast("$cordovaBeacon:didRangeBeaconsInRegion",e)}),u&&u(e)},o.peripheralManagerDidStartAdvertising=function(e){r(function(){n.$broadcast("$cordovaBeacon:peripheralManagerDidStartAdvertising",e)}),s&&s(e)},o.peripheralManagerDidUpdateState=function(e){r(function(){n.$broadcast("$cordovaBeacon:peripheralManagerDidUpdateState",e)}),l&&l(e)},o.didChangeAuthorizationStatus=function(e){r(function(){n.$broadcast("$cordovaBeacon:didChangeAuthorizationStatus",e)}),f&&f(e)},e.cordova.plugins.locationManager.setDelegate(o)}},!1),{setCallbackDidDetermineStateForRegion:function(e){t=e},setCallbackDidStartMonitoringForRegion:function(e){i=e},setCallbackDidExitRegion:function(e){a=e},setCallbackDidEnterRegion:function(e){c=e},setCallbackDidRangeBeaconsInRegion:function(e){u=e},setCallbackPeripheralManagerDidStartAdvertising:function(e){s=e},setCallbackPeripheralManagerDidUpdateState:function(e){l=e},setCallbackDidChangeAuthorizationStatus:function(e){f=e},createBeaconRegion:function(n,r,o,t,i){return o=o||void 0,t=t||void 0,new e.cordova.plugins.locationManager.BeaconRegion(n,r,o,t,i)},isBluetoothEnabled:function(){return o.when(e.cordova.plugins.locationManager.isBluetoothEnabled())},enableBluetooth:function(){return o.when(e.cordova.plugins.locationManager.enableBluetooth())},disableBluetooth:function(){return o.when(e.cordova.plugins.locationManager.disableBluetooth())},startMonitoringForRegion:function(n){return o.when(e.cordova.plugins.locationManager.startMonitoringForRegion(n))},stopMonitoringForRegion:function(n){return o.when(e.cordova.plugins.locationManager.stopMonitoringForRegion(n))},requestStateForRegion:function(n){return o.when(e.cordova.plugins.locationManager.requestStateForRegion(n))},startRangingBeaconsInRegion:function(n){return o.when(e.cordova.plugins.locationManager.startRangingBeaconsInRegion(n))},stopRangingBeaconsInRegion:function(n){return o.when(e.cordova.plugins.locationManager.stopRangingBeaconsInRegion(n))},getAuthorizationStatus:function(){return o.when(e.cordova.plugins.locationManager.getAuthorizationStatus())},requestWhenInUseAuthorization:function(){return o.when(e.cordova.plugins.locationManager.requestWhenInUseAuthorization())},requestAlwaysAuthorization:function(){return o.when(e.cordova.plugins.locationManager.requestAlwaysAuthorization())},getMonitoredRegions:function(){return o.when(e.cordova.plugins.locationManager.getMonitoredRegions())},getRangedRegions:function(){return o.when(e.cordova.plugins.locationManager.getRangedRegions())},isRangingAvailable:function(){return o.when(e.cordova.plugins.locationManager.isRangingAvailable())},isMonitoringAvailableForClass:function(n){return o.when(e.cordova.plugins.locationManager.isMonitoringAvailableForClass(n))},startAdvertising:function(n,r){return o.when(e.cordova.plugins.locationManager.startAdvertising(n,r))},stopAdvertising:function(){return o.when(e.cordova.plugins.locationManager.stopAdvertising())},isAdvertisingAvailable:function(){return o.when(e.cordova.plugins.locationManager.isAdvertisingAvailable())},isAdvertising:function(){return o.when(e.cordova.plugins.locationManager.isAdvertising())},disableDebugLogs:function(){return o.when(e.cordova.plugins.locationManager.disableDebugLogs())},enableDebugNotifications:function(){return o.when(e.cordova.plugins.locationManager.enableDebugNotifications())},disableDebugNotifications:function(){return o.when(e.cordova.plugins.locationManager.disableDebugNotifications())},enableDebugLogs:function(){return o.when(e.cordova.plugins.locationManager.enableDebugLogs())},appendToDeviceLog:function(n){return o.when(e.cordova.plugins.locationManager.appendToDeviceLog(n))}}}]),angular.module("ngCordova.plugins.ble",[]).factory("$cordovaBLE",["$q","$timeout","$log",function(e,n,r){return{scan:function(r,o){var t=e.defer();return ble.startScan(r,function(e){t.notify(e)},function(e){t.reject(e)}),n(function(){ble.stopScan(function(){t.resolve()},function(e){t.reject(e)})},1e3*o),t.promise},startScan:function(e,n,r){return ble.startScan(e,n,r)},stopScan:function(){var n=e.defer();return ble.stopScan(function(){n.resolve()},function(e){n.reject(e)}),n.promise},connect:function(n){var r=e.defer();return ble.connect(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},disconnect:function(n){var r=e.defer();return ble.disconnect(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},read:function(n,r,o){var t=e.defer();return ble.read(n,r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},write:function(n,r,o,t){var i=e.defer();return ble.write(n,r,o,t,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},writeWithoutResponse:function(n,r,o,t){var i=e.defer();return ble.writeWithoutResponse(n,r,o,t,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},writeCommand:function(e,n,o,t){return r.warning("writeCommand is deprecated, use writeWithoutResponse"),this.writeWithoutResponse(e,n,o,t)},startNotification:function(e,n,r,o,t){return ble.startNotification(e,n,r,o,t)},stopNotification:function(n,r,o){var t=e.defer();return ble.stopNotification(n,r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},isConnected:function(n){var r=e.defer();return ble.isConnected(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},enable:function(){var n=e.defer();return ble.enable(function(e){n.resolve(e)},function(e){n.reject(e)}),n.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(r){var o=e.defer(),t=e.defer(),i=!1;return n.bluetoothSerial.connect(r,function(){i=!0,o.resolve(t)},function(e){i===!1&&t.reject(e),o.reject(e)}),o.promise},connectInsecure:function(r){var o=e.defer();return n.bluetoothSerial.connectInsecure(r,function(){o.resolve()},function(e){o.reject(e)}),o.promise},disconnect:function(){var r=e.defer();return n.bluetoothSerial.disconnect(function(){r.resolve()},function(e){r.reject(e)}),r.promise},list:function(){var r=e.defer();return n.bluetoothSerial.list(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},discoverUnpaired:function(){var r=e.defer();return n.bluetoothSerial.discoverUnpaired(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},setDeviceDiscoveredListener:function(){var r=e.defer();return n.bluetoothSerial.setDeviceDiscoveredListener(function(e){r.notify(e)}),r.promise},clearDeviceDiscoveredListener:function(){n.bluetoothSerial.clearDeviceDiscoveredListener()},showBluetoothSettings:function(){var r=e.defer();return n.bluetoothSerial.showBluetoothSettings(function(){r.resolve()},function(e){r.reject(e)}),r.promise},isEnabled:function(){var r=e.defer();return n.bluetoothSerial.isEnabled(function(){r.resolve()},function(){r.reject()}),r.promise},enable:function(){var r=e.defer();return n.bluetoothSerial.enable(function(){r.resolve()},function(){r.reject()}),r.promise},isConnected:function(){var r=e.defer();return n.bluetoothSerial.isConnected(function(){r.resolve()},function(){r.reject()}),r.promise},available:function(){var r=e.defer();return n.bluetoothSerial.available(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},read:function(){var r=e.defer();return n.bluetoothSerial.read(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},readUntil:function(r){var o=e.defer();return n.bluetoothSerial.readUntil(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},write:function(r){var o=e.defer();return n.bluetoothSerial.write(r,function(){o.resolve()},function(e){o.reject(e)}),o.promise},subscribe:function(r){var o=e.defer();return n.bluetoothSerial.subscribe(r,function(e){o.notify(e)},function(e){o.reject(e)}),o.promise},subscribeRawData:function(){var r=e.defer();return n.bluetoothSerial.subscribeRawData(function(e){r.notify(e)},function(e){r.reject(e)}),r.promise},unsubscribe:function(){var r=e.defer();return n.bluetoothSerial.unsubscribe(function(){r.resolve()},function(e){r.reject(e)}),r.promise},unsubscribeRawData:function(){var r=e.defer();return n.bluetoothSerial.unsubscribeRawData(function(){r.resolve()},function(e){r.reject(e)}),r.promise},clear:function(){var r=e.defer();return n.bluetoothSerial.clear(function(){r.resolve()},function(e){r.reject(e)}),r.promise},readRSSI:function(){var r=e.defer();return n.bluetoothSerial.readRSSI(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.brightness",[]).factory("$cordovaBrightness",["$q","$window",function(e,n){return{get:function(){var r=e.defer();return n.cordova?n.cordova.plugins.brightness.getBrightness(function(e){r.resolve(e)},function(e){r.reject(e)}):r.reject("Not supported without cordova.js"),r.promise},set:function(r){var o=e.defer();return n.cordova?n.cordova.plugins.brightness.setBrightness(r,function(e){o.resolve(e)},function(e){o.reject(e)}):o.reject("Not supported without cordova.js"),o.promise},setKeepScreenOn:function(r){var o=e.defer();return n.cordova?n.cordova.plugins.brightness.setKeepScreenOn(r,function(e){o.resolve(e)},function(e){o.reject(e)}):o.reject("Not supported without cordova.js"),o.promise}}}]),angular.module("ngCordova.plugins.calendar",[]).factory("$cordovaCalendar",["$q","$window",function(e,n){return{createCalendar:function(r){var o=e.defer(),t=n.plugins.calendar.getCreateCalendarOptions();return"string"==typeof r?t.calendarName=r:t=angular.extend(t,r),n.plugins.calendar.createCalendar(t,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},deleteCalendar:function(r){var o=e.defer();return n.plugins.calendar.deleteCalendar(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEvent:function(r){var o=e.defer(),t={title:null,location:null,notes:null,startDate:null,endDate:null};return t=angular.extend(t,r),n.plugins.calendar.createEvent(t.title,t.location,t.notes,new Date(t.startDate),new Date(t.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEventWithOptions:function(r){var o=e.defer(),t=[],i=window.plugins.calendar.getCalendarOptions(),a={title:null,location:null,notes:null,startDate:null,endDate:null};t=Object.keys(a);for(var c in r)-1===t.indexOf(c)?i[c]=r[c]:a[c]=r[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(r){var o=e.defer(),t={title:null,location:null,notes:null,startDate:null,endDate:null};return t=angular.extend(t,r),n.plugins.calendar.createEventInteractively(t.title,t.location,t.notes,new Date(t.startDate),new Date(t.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},createEventInNamedCalendar:function(r){var o=e.defer(),t={title:null,location:null,notes:null,startDate:null,endDate:null,calendarName:null};return t=angular.extend(t,r),n.plugins.calendar.createEventInNamedCalendar(t.title,t.location,t.notes,new Date(t.startDate),new Date(t.endDate),t.calendarName,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},findEvent:function(r){var o=e.defer(),t={title:null,location:null,notes:null,startDate:null,endDate:null};return t=angular.extend(t,r),n.plugins.calendar.findEvent(t.title,t.location,t.notes,new Date(t.startDate),new Date(t.endDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},listEventsInRange:function(r,o){var t=e.defer();return n.plugins.calendar.listEventsInRange(r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},listCalendars:function(){var r=e.defer();return n.plugins.calendar.listCalendars(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},findAllEventsInNamedCalendar:function(r){var o=e.defer();return n.plugins.calendar.findAllEventsInNamedCalendar(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},modifyEvent:function(r){var o=e.defer(),t={title:null,location:null,notes:null,startDate:null,endDate:null,newTitle:null,newLocation:null,newNotes:null,newStartDate:null,newEndDate:null};return t=angular.extend(t,r),n.plugins.calendar.modifyEvent(t.title,t.location,t.notes,new Date(t.startDate),new Date(t.endDate),t.newTitle,t.newLocation,t.newNotes,new Date(t.newStartDate),new Date(t.newEndDate),function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},deleteEvent:function(r){var o=e.defer(),t={newTitle:null,location:null,notes:null,startDate:null,endDate:null};return t=angular.extend(t,r),n.plugins.calendar.deleteEvent(t.newTitle,t.location,t.notes,new Date(t.startDate),new Date(t.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 r=e.defer();return navigator.camera?(navigator.camera.getPicture(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise):(r.resolve(null),r.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 r=e.defer();return navigator.device.capture?(navigator.device.capture.captureAudio(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise):(r.resolve(null),r.promise)},captureImage:function(n){var r=e.defer();return navigator.device.capture?(navigator.device.capture.captureImage(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise):(r.resolve(null),r.promise)},captureVideo:function(n){var r=e.defer();return navigator.device.capture?(navigator.device.capture.captureVideo(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise):(r.resolve(null),r.promise)}}}]),angular.module("ngCordova.plugins.cardIO",[]).provider("$cordovaNgCardIO",[function(){var e=["card_type","redacted_card_number","card_number","expiry_month","expiry_year","short_expiry_year","cvv","zip"],n={expiry:!0,cvv:!0,zip:!1,suppressManual:!1,suppressConfirm:!1,hideLogo:!0};this.setCardIOResponseFields=function(n){n&&angular.isArray(n)&&(e=n)},this.setScanerConfig=function(e){e&&angular.isObject(e)&&(n.expiry=e.expiry||!0,n.cvv=e.cvv||!0,n.zip=e.zip||!1,n.suppressManual=e.suppressManual||!1,n.suppressConfirm=e.suppressConfirm||!1,n.hideLogo=e.hideLogo||!0)},this.$get=["$q",function(r){return{scanCard:function(){var o=r.defer();return CardIO.scan(n,function(n){if(null===n)o.reject(null);else{for(var r={},t=0,i=e.length;i>t;t++){var a=e[t];"short_expiry_year"===a?r[a]=String(n.expiry_year).substr(2,2)||"":r[a]=n[a]||""}o.resolve(r)}},function(){o.reject(null)}),o.promise}}}]}]),angular.module("ngCordova.plugins.clipboard",[]).factory("$cordovaClipboard",["$q","$window",function(e,n){return{copy:function(r){var o=e.defer();return n.cordova.plugins.clipboard.copy(r,function(){o.resolve()},function(){o.reject()}),o.promise},paste:function(){var r=e.defer();return n.cordova.plugins.clipboard.paste(function(e){r.resolve(e)},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.contacts",[]).factory("$cordovaContacts",["$q",function(e){return{save:function(n){var r=e.defer(),o=navigator.contacts.create(n);return o.save(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},remove:function(n){var r=e.defer(),o=navigator.contacts.create(n);return o.remove(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},clone:function(e){var n=navigator.contacts.create(e);return n.clone(e)},find:function(n){var r=e.defer(),o=n.fields||["id","displayName"];return delete n.fields,0===Object.keys(n).length?navigator.contacts.find(o,function(e){r.resolve(e)},function(e){r.reject(e)}):navigator.contacts.find(o,function(e){r.resolve(e)},function(e){r.reject(e)},n),r.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(r){var o=n.defer();return r=r||{date:new Date,mode:"date"},e.datePicker.show(r,function(e){o.resolve(e)},function(e){o.reject(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},getManufacturer:function(){return device.manufacturer}}}]),angular.module("ngCordova.plugins.deviceMotion",[]).factory("$cordovaDeviceMotion",["$q",function(e){return{getCurrentAcceleration:function(){var n=e.defer();return angular.isUndefined(navigator.accelerometer)||!angular.isFunction(navigator.accelerometer.getCurrentAcceleration)?(n.reject("Device do not support watchAcceleration"),n.promise):(navigator.accelerometer.getCurrentAcceleration(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise)},watchAcceleration:function(n){var r=e.defer();if(angular.isUndefined(navigator.accelerometer)||!angular.isFunction(navigator.accelerometer.watchAcceleration))return r.reject("Device do not support watchAcceleration"),r.promise;var o=navigator.accelerometer.watchAcceleration(function(e){r.notify(e)},function(e){r.reject(e)},n);return r.promise.cancel=function(){navigator.accelerometer.clearWatch(o)},r.promise.clearWatch=function(e){navigator.accelerometer.clearWatch(e||o)},r.promise.watchID=o,r.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?(navigator.compass.getCurrentHeading(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise):(n.reject("No compass on Device"),n.promise)},watchHeading:function(r){var o=e.defer();if(!navigator.compass)return o.reject("No compass on Device"),o.promise;var t=angular.extend(n,r),i=navigator.compass.watchHeading(function(e){o.notify(e)},function(e){o.reject(e)},t);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(r,o,t){var i=e.defer();return n.navigator.notification?navigator.notification.alert(r,function(){i.resolve()},o,t):(n.alert(r),i.resolve()),i.promise},confirm:function(r,o,t){var i=e.defer();return n.navigator.notification?navigator.notification.confirm(r,function(e){i.resolve(e)},o,t):n.confirm(r)?i.resolve(1):i.resolve(2),i.promise},prompt:function(r,o,t,i){var a=e.defer();if(n.navigator.notification)navigator.notification.prompt(r,function(e){a.resolve(e)},o,t,i);else{var c=n.prompt(r,i);null!==c?a.resolve({input1:c,buttonIndex:1}):a.resolve({input1:c,buttonIndex:2})}return a.promise},beep:function(e){return navigator.notification.beep(e)},activityStart:function(n,r){var o=e.defer();return"android"===cordova.platformId?(navigator.notification.activityStart(r,n),o.resolve()):o.reject(n,r),o.promise},activityStop:function(){var n=e.defer();return"android"===cordova.platformId?(navigator.notification.activityStop(),n.resolve()):n.reject(),n.promise},progressStart:function(n,r){var o=e.defer();return"android"===cordova.platformId?(navigator.notification.progressStart(r,n),o.resolve()):o.reject(n,r),o.promise},progressStop:function(){var n=e.defer();return"android"===cordova.platformId?(navigator.notification.progressStop(),n.resolve()):n.reject(),n.promise},progressValue:function(n){var r=e.defer();return"android"===cordova.platformId?(navigator.notification.progressValue(n),r.resolve()):r.reject(n),r.promise}}}]),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 r=e.defer();return cordova.plugins.email.open(n,function(){r.reject()}),r.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 r=e.defer();return facebookConnectPlugin.login(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},showDialog:function(n){var r=e.defer();return facebookConnectPlugin.showDialog(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},api:function(n,r){var o=e.defer();return facebookConnectPlugin.api(n,r,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(r){var o=e.defer();return n.FacebookAds.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.FacebookAds.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.FacebookAds.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.FacebookAds.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.FacebookAds.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.FacebookAds.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.FacebookAds.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.FacebookAds.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.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,r){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,t){var i=e.defer();/^\//.test(t)&&i.reject("directory cannot start with /");try{var a=o+t;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=r[e.code],i.reject(e)})}catch(c){c.message=r[c.code],i.reject(c)}return i.promise},checkFile:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("directory cannot start with /");try{var a=o+t;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=r[e.code],i.reject(e)})}catch(c){c.message=r[c.code],i.reject(c)}return i.promise},createDir:function(o,t,i){var a=e.defer();/^\//.test(t)&&a.reject("directory cannot start with /"), +i=i?!1:!0;var c={create:!0,exclusive:i};try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(t,c,function(e){a.resolve(e)},function(e){e.message=r[e.code],a.reject(e)})},function(e){e.message=r[e.code],a.reject(e)})}catch(u){u.message=r[u.code],a.reject(u)}return a.promise},createFile:function(o,t,i){var a=e.defer();/^\//.test(t)&&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(t,c,function(e){a.resolve(e)},function(e){e.message=r[e.code],a.reject(e)})},function(e){e.message=r[e.code],a.reject(e)})}catch(u){u.message=r[u.code],a.reject(u)}return a.promise},removeDir:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(t,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},removeFile:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{create:!1},function(e){e.remove(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},removeRecursively:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(t,{create:!1},function(e){e.removeRecursively(function(){i.resolve({success:!0,fileRemoved:e})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},writeFile:function(o,t,i,a){var c=e.defer();/^\//.test(t)&&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(t,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=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})}catch(s){s.message=r[s.code],c.reject(s)}return c.promise},writeExistingFile:function(o,t,i){var a=e.defer();/^\//.test(t)&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{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=r[e.code],a.reject(e)})},function(e){e.message=r[e.code],a.reject(e)})}catch(c){c.message=r[c.code],a.reject(c)}return a.promise},readAsText:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{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):void 0!==e.target.error||null!==e.target.error?i.reject(e.target.error):i.reject({code:null,message:"READER_ONLOADEND_ERR"})},n.readAsText(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},readAsDataURL:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{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):void 0!==e.target.error||null!==e.target.error?i.reject(e.target.error):i.reject({code:null,message:"READER_ONLOADEND_ERR"})},n.readAsDataURL(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},readAsBinaryString:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{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):void 0!==e.target.error||null!==e.target.error?i.reject(e.target.error):i.reject({code:null,message:"READER_ONLOADEND_ERR"})},n.readAsBinaryString(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},readAsArrayBuffer:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{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):void 0!==e.target.error||null!==e.target.error?i.reject(e.target.error):i.reject({code:null,message:"READER_ONLOADEND_ERR"})},n.readAsArrayBuffer(e)})},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(a){a.message=r[a.code],i.reject(a)}return i.promise},moveFile:function(r,o,t,i){var a=e.defer();i=i||o,(/^\//.test(o)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getFile(o,{create:!1},function(e){n.resolveLocalFileSystemURL(t,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(r,o,t,i){var a=e.defer();i=i||o,(/^\//.test(o)||/^\//.test(i))&&a.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(r,function(e){e.getDirectory(o,{create:!1},function(e){n.resolveLocalFileSystemURL(t,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,t,i,a){var c=e.defer();a=a||t,(/^\//.test(t)||/^\//.test(a))&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getDirectory(t,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})}catch(u){u.message=r[u.code],c.reject(u)}return c.promise},copyFile:function(o,t,i,a){var c=e.defer();a=a||t,/^\//.test(t)&&c.reject("file-name cannot start with /");try{n.resolveLocalFileSystemURL(o,function(e){e.getFile(t,{create:!1,exclusive:!1},function(e){n.resolveLocalFileSystemURL(i,function(n){e.copyTo(n,a,function(e){c.resolve(e)},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})},function(e){e.message=r[e.code],c.reject(e)})}catch(u){u.message=r[u.code],c.reject(u)}return c.promise},readFileMetadata:function(o,t){var i=e.defer();/^\//.test(t)&&i.reject("directory cannot start with /");try{var a=o+t;n.resolveLocalFileSystemURL(a,function(e){e.file(function(e){i.resolve(e)},function(e){e.message=r[e.code],i.reject(e)})},function(e){e.message=r[e.code],i.reject(e)})}catch(c){c.message=r[c.code],i.reject(c)}return i.promise}}}]}]),angular.module("ngCordova.plugins.fileOpener2",[]).factory("$cordovaFileOpener2",["$q",function(e){return{open:function(n,r){var o=e.defer();return cordova.plugins.fileOpener2.open(n,r,{error:function(e){o.reject(e)},success:function(){o.resolve()}}),o.promise},uninstall:function(n){var r=e.defer();return cordova.plugins.fileOpener2.uninstall(n,{error:function(e){r.reject(e)},success:function(){r.resolve()}}),r.promise},appIsInstalled:function(n){var r=e.defer();return cordova.plugins.fileOpener2.appIsInstalled(n,{success:function(e){r.resolve(e)}}),r.promise}}}]),angular.module("ngCordova.plugins.fileTransfer",[]).factory("$cordovaFileTransfer",["$q","$timeout",function(e,n){return{download:function(r,o,t,i){var a=e.defer(),c=new FileTransfer,u=t&&t.encodeURI===!1?r:encodeURI(r);return t&&void 0!==t.timeout&&null!==t.timeout&&(n(function(){c.abort()},t.timeout),t.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort()},c.download(u,o,a.resolve,a.reject,i,t),a.promise},upload:function(r,o,t,i){var a=e.defer(),c=new FileTransfer,u=t&&t.encodeURI===!1?r:encodeURI(r);return t&&void 0!==t.timeout&&null!==t.timeout&&(n(function(){c.abort()},t.timeout),t.timeout=null),c.onprogress=function(e){a.notify(e)},a.promise.abort=function(){c.abort()},c.upload(o,u,a.resolve,a.reject,t,i),a.promise}}}]),angular.module("ngCordova.plugins.flashlight",[]).factory("$cordovaFlashlight",["$q","$window",function(e,n){return{available:function(){var r=e.defer();return n.plugins.flashlight.available(function(e){r.resolve(e)}),r.promise},switchOn:function(){var r=e.defer();return n.plugins.flashlight.switchOn(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},switchOff:function(){var r=e.defer();return n.plugins.flashlight.switchOff(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},toggle:function(){var r=e.defer();return n.plugins.flashlight.toggle(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.flurryAds",[]).factory("$cordovaFlurryAds",["$q","$window",function(e,n){return{setOptions:function(r){var o=e.defer();return n.FlurryAds.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.FlurryAds.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.FlurryAds.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.FlurryAds.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.FlurryAds.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.FlurryAds.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.FlurryAds.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.FlurryAds.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.ga",[]).factory("$cordovaGA",["$q","$window",function(e,n){return{init:function(r,o){var t=e.defer();return o=o>=0?o:10,n.plugins.gaPlugin.init(function(e){t.resolve(e)},function(e){t.reject(e)},r,o),t.promise},trackEvent:function(r,o,t,i,a,c){var u=e.defer();return n.plugins.gaPlugin.trackEvent(function(e){u.resolve(e)},function(e){u.reject(e)},t,i,a,c),u.promise},trackPage:function(r,o,t){var i=e.defer();return n.plugins.gaPlugin.trackPage(function(e){i.resolve(e)},function(e){i.reject(e)},t),i.promise},setVariable:function(r,o,t,i){var a=e.defer();return n.plugins.gaPlugin.setVariable(function(e){a.resolve(e)},function(e){a.reject(e)},t,i),a.promise},exit:function(){var r=e.defer();return n.plugins.gaPlugin.exit(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.geolocation",[]).factory("$cordovaGeolocation",["$q",function(e){return{getCurrentPosition:function(n){var r=e.defer();return navigator.geolocation.getCurrentPosition(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},watchPosition:function(n){var r=e.defer(),o=navigator.geolocation.watchPosition(function(e){r.notify(e)},function(e){r.reject(e)},n);return r.promise.cancel=function(){navigator.geolocation.clearWatch(o)},r.promise.clearWatch=function(e){navigator.geolocation.clearWatch(e||o)},r.promise.watchID=o,r.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,r){var o=e.defer();return navigator.globalization.dateToString(n,function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise},stringToDate:function(n,r){var o=e.defer();return navigator.globalization.stringToDate(n,function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise},getDatePattern:function(n){var r=e.defer();return navigator.globalization.getDatePattern(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},getDateNames:function(n){var r=e.defer();return navigator.globalization.getDateNames(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},isDayLightSavingsTime:function(n){var r=e.defer();return navigator.globalization.isDayLightSavingsTime(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},numberToString:function(n,r){var o=e.defer();return navigator.globalization.numberToString(n,function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise},stringToNumber:function(n,r){var o=e.defer();return navigator.globalization.stringToNumber(n,function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise},getNumberPattern:function(n){var r=e.defer();return navigator.globalization.getNumberPattern(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},getCurrencyPattern:function(n){var r=e.defer();return navigator.globalization.getCurrencyPattern(n,function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.googleAds",[]).factory("$cordovaGoogleAds",["$q","$window",function(e,n){return{setOptions:function(r){var o=e.defer();return n.AdMob.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.AdMob.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.AdMob.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.AdMob.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.AdMob.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.AdMob.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.AdMob.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.AdMob.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.googleAnalytics",[]).factory("$cordovaGoogleAnalytics",["$q","$window",function(e,n){return{startTrackerWithId:function(r){var o=e.defer();return n.analytics.startTrackerWithId(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},setUserId:function(r){var o=e.defer();return n.analytics.setUserId(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},debugMode:function(){var r=e.defer();return n.analytics.debugMode(function(e){r.resolve(e)},function(){r.reject()}),r.promise},trackView:function(r){var o=e.defer();return n.analytics.trackView(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},addCustomDimension:function(r,o){var t=e.defer();return n.analytics.addCustomDimension(r,o,function(){t.resolve()},function(e){t.reject(e)}),t.promise},trackEvent:function(r,o,t,i){var a=e.defer();return n.analytics.trackEvent(r,o,t,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},trackException:function(r,o){var t=e.defer();return n.analytics.trackException(r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},trackTiming:function(r,o,t,i){var a=e.defer();return n.analytics.trackTiming(r,o,t,i,function(e){a.resolve(e)},function(e){a.reject(e)}),a.promise},addTransaction:function(r,o,t,i,a,c){var u=e.defer();return n.analytics.addTransaction(r,o,t,i,a,c,function(e){u.resolve(e)},function(e){u.reject(e)}),u.promise},addTransactionItem:function(r,o,t,i,a,c,u){var s=e.defer();return n.analytics.addTransactionItem(r,o,t,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 r=null;return{getMap:function(o){var t=e.defer();if(n.plugin.google.maps){var i=document.getElementById("map_canvas");r=n.plugin.google.maps.Map.getMap(o),r.setDiv(i),t.resolve(r)}else t.reject(null);return t.promise},isMapLoaded:function(){return!!r},addMarker:function(n){var o=e.defer();return r.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 r.setVisible(n),o.promise},cleanup:function(){r=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 r=e.defer();return googleplaygame.submitScore(n,function(e){return r.resolve(e)},function(e){return r.reject(e)}),r.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 r=e.defer();return googleplaygame.showLeaderboard(n,function(e){return r.resolve(e)},function(e){return r.reject(e)}),r.promise},unlockAchievement:function(n){var r=e.defer();return googleplaygame.unlockAchievement(n,function(e){return r.resolve(e)},function(e){return r.reject(e)}),r.promise},incrementAchievement:function(n){var r=e.defer();return googleplaygame.incrementAchievement(n,function(e){return r.resolve(e)},function(e){return r.reject(e)}),r.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(r){var o=e.defer();return void 0===r&&(r={}),n.plugins.googleplus.login({iOSApiKey:r},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},silentLogin:function(r){var o=e.defer();return void 0===r&&(r={}),n.plugins.googleplus.trySilentLogin({iOSApiKey:r},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},logout:function(){var r=e.defer();n.plugins.googleplus.logout(function(e){r.resolve(e)})},disconnect:function(){var r=e.defer();n.plugins.googleplus.disconnect(function(e){r.resolve(e)})},isAvailable:function(){var r=e.defer();return n.plugins.googleplus.isAvailable(function(e){e?r.resolve(e):r.reject(e)}),r.promise}}}]),angular.module("ngCordova.plugins.healthKit",[]).factory("$cordovaHealthKit",["$q","$window",function(e,n){return{isAvailable:function(){var r=e.defer();return n.plugins.healthkit.available(function(e){r.resolve(e)},function(e){r.reject(e)}),r.promise},checkAuthStatus:function(r){var o=e.defer();return r=r||"HKQuantityTypeIdentifierHeight",n.plugins.healthkit.checkAuthStatus({type:r},function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},requestAuthorization:function(r,o){var t=e.defer();return r=r||["HKCharacteristicTypeIdentifierDateOfBirth","HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight"],o=o||["HKQuantityTypeIdentifierActiveEnergyBurned","HKQuantityTypeIdentifierHeight","HKQuantityTypeIdentifierDistanceCycling"],n.plugins.healthkit.requestAuthorization({readTypes:r,writeTypes:o},function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},readDateOfBirth:function(){var r=e.defer();return n.plugins.healthkit.readDateOfBirth(function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},readGender:function(){var r=e.defer();return n.plugins.healthkit.readGender(function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},saveWeight:function(r,o,t){var i=e.defer();return n.plugins.healthkit.saveWeight({unit:o||"lb",amount:r,date:t||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readWeight:function(r){var o=e.defer();return n.plugins.healthkit.readWeight({unit:r||"lb"},function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},saveHeight:function(r,o,t){var i=e.defer();return n.plugins.healthkit.saveHeight({unit:o||"in",amount:r,date:t||new Date},function(e){i.resolve(e)},function(e){i.resolve(e)}),i.promise},readHeight:function(r){var o=e.defer();return n.plugins.healthkit.readHeight({unit:r||"in"},function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},findWorkouts:function(){var r=e.defer();return n.plugins.healthkit.findWorkouts({},function(e){r.resolve(e)},function(e){r.resolve(e)}),r.promise},saveWorkout:function(r){var o=e.defer();return n.plugins.healthkit.saveWorkout(r,function(e){o.resolve(e)},function(e){o.resolve(e)}),o.promise},querySampleType:function(r){var o=e.defer();return n.plugins.healthkit.querySampleType(r,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 r=e.defer();return cordova.plugins.CorHttpd.startServer(n,function(){r.resolve()},function(){r.reject()}),r.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(r){var o=e.defer();return n.iAd.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.iAd.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.iAd.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.iAd.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.iAd.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.iAd.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.iAd.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.iAd.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.imagePicker",[]).factory("$cordovaImagePicker",["$q","$window",function(e,n){return{getPictures:function(r){var o=e.defer();return n.imagePicker.getPictures(function(e){o.resolve(e)},function(e){o.reject(e)},r),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(r,o,t,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=t.open(a,c,d),e.addEventListener("loadstart",function(e){i(function(){r.$broadcast("$cordovaInAppBrowser:loadstart",e)})},!1),e.addEventListener("loadstop",function(e){s.resolve(e),i(function(){r.$broadcast("$cordovaInAppBrowser:loadstop",e)})},!1),e.addEventListener("loaderror",function(e){s.reject(e),i(function(){r.$broadcast("$cordovaInAppBrowser:loaderror",e)})},!1),e.addEventListener("exit",function(e){i(function(){r.$broadcast("$cordovaInAppBrowser:exit",e)})},!1),s.promise},close:function(){e.close(),e=null},show:function(){e.show()},executeScript:function(n){var r=o.defer();return e.executeScript(n,function(e){r.resolve(e)}),r.promise},insertCSS:function(n){var r=o.defer();return e.insertCSS(n,function(e){r.resolve(e)}),r.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 r=e.defer();return window.Instagram?(Instagram.share(n.image,n.caption,function(e){e?r.reject(e):r.resolve(!0)}),r.promise):(console.error("Tried to call Instagram.share but the Instagram plugin isn't installed!"),r.resolve(null),r.promise)},isInstalled:function(){var n=e.defer();return window.Instagram?(Instagram.isInstalled(function(e,r){e?n.reject(e):n.resolve(r)}),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",function(e){var n=function(){e.$evalAsync(function(){e.$broadcast("$cordovaKeyboard:show")})},r=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",r,!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",r),e.$$listeners["$cordovaKeyboard:hide"]=[]}}}]),angular.module("ngCordova.plugins.keychain",[]).factory("$cordovaKeychain",["$q",function(e){return{getForKey:function(n,r){var o=e.defer(),t=new Keychain;return t.getForKey(o.resolve,o.reject,n,r),o.promise},setForKey:function(n,r,o){var t=e.defer(),i=new Keychain;return i.setForKey(t.resolve,t.reject,n,r,o),t.promise},removeForKey:function(n,r){var o=e.defer(),t=new Keychain;return t.removeForKey(o.resolve,o.reject,n,r),o.promise}}}]),angular.module("ngCordova.plugins.launchNavigator",[]).factory("$cordovaLaunchNavigator",["$q",function(e){return{navigate:function(n,r,o){var t=e.defer();return launchnavigator.navigate(n,r,function(){t.resolve()},function(e){t.reject(e)},o),t.promise}}}]),angular.module("ngCordova.plugins.localNotification",[]).factory("$cordovaLocalNotification",["$q","$window","$rootScope","$timeout",function(e,n,r,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(){r.$broadcast("$cordovaLocalNotification:schedule",e,n)})}),n.cordova.plugins.notification.local.on("trigger",function(e,n){o(function(){r.$broadcast("$cordovaLocalNotification:trigger",e,n)})}),n.cordova.plugins.notification.local.on("update",function(e,n){o(function(){r.$broadcast("$cordovaLocalNotification:update",e,n)})}),n.cordova.plugins.notification.local.on("clear",function(e,n){o(function(){r.$broadcast("$cordovaLocalNotification:clear",e,n)})}),n.cordova.plugins.notification.local.on("clearall",function(e){o(function(){r.$broadcast("$cordovaLocalNotification:clearall",e)})}),n.cordova.plugins.notification.local.on("cancel",function(e,n){o(function(){r.$broadcast("$cordovaLocalNotification:cancel",e,n)})}),n.cordova.plugins.notification.local.on("cancelall",function(e){o(function(){r.$broadcast("$cordovaLocalNotification:cancelall",e)})}),n.cordova.plugins.notification.local.on("click",function(e,n){o(function(){r.$broadcast("$cordovaLocalNotification:click",e,n)})}))},!1),{schedule:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.schedule(r,function(e){t.resolve(e)},o),t.promise},add:function(r,o){console.warn('Deprecated: use "schedule" instead.');var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.schedule(r,function(e){t.resolve(e)},o),t.promise},update:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.update(r,function(e){t.resolve(e)},o),t.promise},clear:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.clear(r,function(e){t.resolve(e)},o),t.promise},clearAll:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.clearAll(function(e){o.resolve(e)},r),o.promise},cancel:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.cancel(r,function(e){t.resolve(e)},o),t.promise},cancelAll:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.cancelAll(function(e){o.resolve(e)},r),o.promise},isPresent:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.isPresent(r,function(e){t.resolve(e)},o),t.promise},isScheduled:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.isScheduled(r,function(e){t.resolve(e)},o),t.promise},isTriggered:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.isTriggered(r,function(e){t.resolve(e)},o),t.promise},hasPermission:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.hasPermission(function(e){e?o.resolve(e):o.reject(e)},r),o.promise},registerPermission:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.registerPermission(function(e){e?o.resolve(e):o.reject(e)},r),o.promise},promptForPermission:function(r){console.warn('Deprecated: use "registerPermission" instead.');var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.registerPermission(function(e){ +e?o.resolve(e):o.reject(e)},r),o.promise},getAllIds:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getAllIds(function(e){o.resolve(e)},r),o.promise},getIds:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getIds(function(e){o.resolve(e)},r),o.promise},getScheduledIds:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getScheduledIds(function(e){o.resolve(e)},r),o.promise},getTriggeredIds:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getTriggeredIds(function(e){o.resolve(e)},r),o.promise},get:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.get(r,function(e){t.resolve(e)},o),t.promise},getAll:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getAll(function(e){o.resolve(e)},r),o.promise},getScheduled:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.getScheduled(r,function(e){t.resolve(e)},o),t.promise},getAllScheduled:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getAllScheduled(function(e){o.resolve(e)},r),o.promise},getTriggered:function(r,o){var t=e.defer();return o=o||null,n.cordova.plugins.notification.local.getTriggered(r,function(e){t.resolve(e)},o),t.promise},getAllTriggered:function(r){var o=e.defer();return r=r||null,n.cordova.plugins.notification.local.getAllTriggered(function(e){o.resolve(e)},r),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(r){var o=e.defer();return n.mMedia.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.mMedia.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.mMedia.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.mMedia.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.mMedia.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.mMedia.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.mMedia.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.mMedia.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.media",[]).service("NewMedia",["$q","$interval",function(e,n){function r(e){angular.isDefined(s)||(s=n(function(){0>d&&(d=e.getDuration(),a&&d>0&&a.notify({duration:d})),e.getCurrentPosition(function(e){e>-1&&(f=e)},function(e){console.log("Error getting pos="+e)}),a&&a.notify({position:f})},1e3))}function o(){angular.isDefined(s)&&(n.cancel(s),s=void 0)}function t(){f=-1,d=-1}function i(e){this.media=new Media(e,function(e){o(),t(),a.resolve(e)},function(e){o(),t(),a.reject(e)},function(e){l=e,a.notify({status:l})})}var a,c,u,s,l=null,f=-1,d=-1;return i.prototype.play=function(n){return a=e.defer(),"object"!=typeof n&&(n={}),this.media.play(n),r(this.media),a.promise},i.prototype.pause=function(){o(),this.media.pause()},i.prototype.stop=function(){this.media.stop()},i.prototype.release=function(){this.media.release(),this.media=void 0},i.prototype.seekTo=function(e){this.media.seekTo(e)},i.prototype.setVolume=function(e){this.media.setVolume(e)},i.prototype.startRecord=function(){this.media.startRecord()},i.prototype.stopRecord=function(){this.media.stopRecord()},i.prototype.currentTime=function(){return c=e.defer(),this.media.getCurrentPosition(function(e){c.resolve(e)}),c.promise},i.prototype.getDuration=function(){return u=e.defer(),this.media.getDuration(function(e){u.resolve(e)}),u.promise},i}]).factory("$cordovaMedia",["NewMedia",function(e){return{newMedia:function(n){return new e(n)}}}]),angular.module("ngCordova.plugins.mobfoxAds",[]).factory("$cordovaMobFoxAds",["$q","$window",function(e,n){return{setOptions:function(r){var o=e.defer();return n.MobFox.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.MobFox.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.MobFox.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.MobFox.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.MobFox.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.MobFox.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.MobFox.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.MobFox.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.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.beacon","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.googlePlus","ngCordova.plugins.healthKit","ngCordova.plugins.httpd","ngCordova.plugins.iAd","ngCordova.plugins.imagePicker","ngCordova.plugins.inAppBrowser","ngCordova.plugins.instagram","ngCordova.plugins.keyboard","ngCordova.plugins.keychain","ngCordova.plugins.launchNavigator","ngCordova.plugins.localNotification","ngCordova.plugins.media","ngCordova.plugins.mMediaAds","ngCordova.plugins.mobfoxAds","ngCordova.plugins.mopubAds","ngCordova.plugins.nativeAudio","ngCordova.plugins.network","ngCordova.plugins.pinDialog","ngCordova.plugins.preferences","ngCordova.plugins.printer","ngCordova.plugins.progressIndicator","ngCordova.plugins.push","ngCordova.plugins.push_v5","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(r){var o=e.defer();return n.MoPub.setOptions(r,function(){o.resolve()},function(){o.reject()}),o.promise},createBanner:function(r){var o=e.defer();return n.MoPub.createBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},removeBanner:function(){var r=e.defer();return n.MoPub.removeBanner(function(){r.resolve()},function(){r.reject()}),r.promise},showBanner:function(r){var o=e.defer();return n.MoPub.showBanner(r,function(){o.resolve()},function(){o.reject()}),o.promise},showBannerAtXY:function(r,o){var t=e.defer();return n.MoPub.showBannerAtXY(r,o,function(){t.resolve()},function(){t.reject()}),t.promise},hideBanner:function(){var r=e.defer();return n.MoPub.hideBanner(function(){r.resolve()},function(){r.reject()}),r.promise},prepareInterstitial:function(r){var o=e.defer();return n.MoPub.prepareInterstitial(r,function(){o.resolve()},function(){o.reject()}),o.promise},showInterstitial:function(){var r=e.defer();return n.MoPub.showInterstitial(function(){r.resolve()},function(){r.reject()}),r.promise}}}]),angular.module("ngCordova.plugins.nativeAudio",[]).factory("$cordovaNativeAudio",["$q","$window",function(e,n){return{preloadSimple:function(r,o){var t=e.defer();return n.plugins.NativeAudio.preloadSimple(r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise},preloadComplex:function(r,o,t,i,a){var c=e.defer();return n.plugins.NativeAudio.preloadComplex(r,o,t,i,a,function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise},play:function(r,o){var t=e.defer();return n.plugins.NativeAudio.play(r,function(e){t.resolve(e)},function(e){t.reject(e)},o),t.promise},stop:function(r){var o=e.defer();return n.plugins.NativeAudio.stop(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},loop:function(r){var o=e.defer();return n.plugins.NativeAudio.loop(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},unload:function(r){var o=e.defer();return n.plugins.NativeAudio.unload(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},setVolumeForComplexAsset:function(r,o){var t=e.defer();return n.plugins.NativeAudio.setVolumeForComplexAsset(r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.network",[]).factory("$cordovaNetwork",["$rootScope","$timeout",function(e,n){var r=function(){var r=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:offline",r)})},o=function(){var r=navigator.connection.type;n(function(){e.$broadcast("$cordovaNetwork:online",r)})};return document.addEventListener("deviceready",function(){navigator.connection&&(document.addEventListener("offline",r,!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",r),e.$$listeners["$cordovaNetwork:offline"]=[]},clearOnlineWatch:function(){document.removeEventListener("online",o),e.$$listeners["$cordovaNetwork:online"]=[]}}}]).run(["$injector",function(e){e.get("$cordovaNetwork")}]),angular.module("ngCordova.plugins.pinDialog",[]).factory("$cordovaPinDialog",["$q","$window",function(e,n){return{prompt:function(r,o,t){var i=e.defer();return n.plugins.pinDialog.prompt(r,function(e){i.resolve(e)},o,t),i.promise}}}]),angular.module("ngCordova.plugins.preferences",[]).factory("$cordovaPreferences",["$window","$q",function(e,n){return{pluginNotEnabledMessage:"Plugin not enabled",decoratePromise:function(e){e.success=function(n){return e.then(n),e},e.error=function(n){return e.then(null,n),e}},store:function(r,o,t){function i(e){c.resolve(e)}function a(e){c.reject(new Error(e))}var c=n.defer(),u=c.promise;if(e.plugins){var s;s=3===arguments.length?e.plugins.appPreferences.store(t,r,o):e.plugins.appPreferences.store(r,o),s.then(i,a)}else c.reject(new Error(this.pluginNotEnabledMessage));return this.decoratePromise(u),u},fetch:function(r,o){function t(e){a.resolve(e)}function i(e){a.reject(new Error(e))}var a=n.defer(),c=a.promise;if(e.plugins){var u;u=2===arguments.length?e.plugins.appPreferences.fetch(o,r):e.plugins.appPreferences.fetch(r),u.then(t,i)}else a.reject(new Error(this.pluginNotEnabledMessage));return this.decoratePromise(c),c},remove:function(r,o){function t(e){a.resolve(e)}function i(e){a.reject(new Error(e))}var a=n.defer(),c=a.promise;if(e.plugins){var u;u=2===arguments.length?e.plugins.appPreferences.remove(o,r):e.plugins.appPreferences.remove(r),u.then(t,i)}else a.reject(new Error(this.pluginNotEnabledMessage));return this.decoratePromise(c),c},show:function(){function r(e){t.resolve(e)}function o(e){t.reject(new Error(e))}var t=n.defer(),i=t.promise;return e.plugins?e.plugins.appPreferences.show().then(r,o):t.reject(new Error(this.pluginNotEnabledMessage)),this.decoratePromise(i),i}}}]),angular.module("ngCordova.plugins.printer",[]).factory("$cordovaPrinter",["$q","$window",function(e,n){return{isAvailable:function(){var r=e.defer();return n.plugin.printer.isAvailable(function(e){r.resolve(e)}),r.promise},print:function(r,o){var t=e.defer();return n.plugin.printer.print(r,o,function(){t.resolve()}),t.promise}}}]),angular.module("ngCordova.plugins.progressIndicator",[]).factory("$cordovaProgress",[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 r=e||!1,o=n||"Loading...";return ProgressIndicator.showSimpleWithLabel(r,o)},showSimpleWithLabelDetail:function(e,n,r){var o=e||!1,t=n||"Loading...",i=r||"Please wait";return ProgressIndicator.showSimpleWithLabelDetail(o,t,i)},showDeterminate:function(e,n){var r=e||!1,o=n||5e4;return ProgressIndicator.showDeterminate(r,o)},showDeterminateWithLabel:function(e,n,r){var o=e||!1,t=n||5e4,i=r||"Loading...";return ProgressIndicator.showDeterminateWithLabel(o,t,i)},showAnnular:function(e,n){var r=e||!1,o=n||5e4;return ProgressIndicator.showAnnular(r,o)},showAnnularWithLabel:function(e,n,r){var o=e||!1,t=n||5e4,i=r||"Loading...";return ProgressIndicator.showAnnularWithLabel(o,t,i)},showBar:function(e,n){var r=e||!1,o=n||5e4;return ProgressIndicator.showBar(r,o)},showBarWithLabel:function(e,n,r){var o=e||!1,t=n||5e4,i=r||"Loading...";return ProgressIndicator.showBarWithLabel(o,t,i)},showSuccess:function(e,n){var r=e||!1,o=n||"Success";return ProgressIndicator.showSuccess(r,o)},showText:function(e,n,r){var o=e||!1,t=n||"Warning",i=r||"center";return ProgressIndicator.showText(o,t,i)},hide:function(){return ProgressIndicator.hide()}}}]),angular.module("ngCordova.plugins.push",[]).factory("$cordovaPush",["$q","$window","$rootScope","$timeout",function(e,n,r,o){return{onNotification:function(e){o(function(){r.$broadcast("$cordovaPush:notificationReceived",e)})},register:function(r){var o,t=e.defer();return void 0!==r&&void 0===r.ecb&&(o=null===document.querySelector("[ng-app]")?"document.body":"document.querySelector('[ng-app]')",r.ecb="angular.element("+o+").injector().get('$cordovaPush').onNotification"),n.plugins.pushNotification.register(function(e){t.resolve(e)},function(e){t.reject(e)},r),t.promise},unregister:function(r){var o=e.defer();return n.plugins.pushNotification.unregister(function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise},setBadgeNumber:function(r){var o=e.defer();return n.plugins.pushNotification.setApplicationIconBadgeNumber(function(e){o.resolve(e)},function(e){o.reject(e)},r),o.promise}}}]),angular.module("ngCordova.plugins.push_v5",[]).factory("$cordovaPushV5",["$q","$rootScope","$timeout",function(e,n,r){var o;return{initialize:function(n){var r=e.defer();return o=PushNotification.init(n),r.resolve(o),r.promise},onNotification:function(){r(function(){o.on("notification",function(e){n.$emit("$cordovaPushV5:notificationReceived",e)})})},onError:function(){r(function(){o.on("error",function(e){n.$emit("$cordovaPushV5:errorOccurred",e)})})},register:function(){var n=e.defer();return void 0===o?n.reject(new Error("init must be called before any other operation")):o.on("registration",function(e){n.resolve(e.registrationId)}),n.promise},unregister:function(){var n=e.defer();return void 0===o?n.reject(new Error("init must be called before any other operation")):o.unregister(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},getBadgeNumber:function(){var n=e.defer();return void 0===o?n.reject(new Error("init must be called before any other operation")):o.getApplicationIconBadgeNumber(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise},setBadgeNumber:function(n){var r=e.defer();return void 0===o?r.reject(new Error("init must be called before any other operation")):o.setApplicationIconBadgeNumber(function(e){r.resolve(e)},function(e){r.reject(e)},n),r.promise},finish:function(){var n=e.defer();return void 0===o?n.reject(new Error("init must be called before any other operation")):o.finish(function(e){n.resolve(e)},function(e){n.reject(e)}),n.promise}}}]),angular.module("ngCordova.plugins.screenshot",[]).factory("$cordovaScreenshot",["$q",function(e){return{captureToFile:function(n){var r=n||{},o=r.extension||"jpg",t=r.quality||"100",i=e.defer();return navigator.screenshot?(navigator.screenshot.save(function(e,n){e?i.reject(e):i.resolve(n.filePath)},o,t,r.filename),i.promise):(i.resolve(null),i.promise)},captureToUri:function(n){var r=n||{},o=r.extension||"jpg",t=r.quality||"100",i=e.defer();return navigator.screenshot?(navigator.screenshot.URI(function(e,n){e?i.reject(e):i.resolve(n.URI)},o,t,r.filename),i.promise):(i.resolve(null),i.promise)}}}]),angular.module("ngCordova.plugins.sms",[]).factory("$cordovaSms",["$q",function(e){return{send:function(n,r,o){var t=e.defer();return sms.send(n,r,o,function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}}}]),angular.module("ngCordova.plugins.socialSharing",[]).factory("$cordovaSocialSharing",["$q","$window",function(e,n){return{share:function(r,o,t,i){var a=e.defer();return o=o||null,t=t||null,i=i||null,n.plugins.socialsharing.share(r,o,t,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaTwitter:function(r,o,t){var i=e.defer();return o=o||null,t=t||null,n.plugins.socialsharing.shareViaTwitter(r,o,t,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaWhatsApp:function(r,o,t){var i=e.defer();return o=o||null,t=t||null,n.plugins.socialsharing.shareViaWhatsApp(r,o,t,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebook:function(r,o,t){var i=e.defer();return r=r||null,o=o||null,t=t||null,n.plugins.socialsharing.shareViaFacebook(r,o,t,function(){i.resolve(!0)},function(){i.reject(!1)}),i.promise},shareViaFacebookWithPasteMessageHint:function(r,o,t,i){var a=e.defer();return o=o||null,t=t||null,n.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(r,o,t,i,function(){a.resolve(!0)},function(){a.reject(!1)}),a.promise},shareViaSMS:function(r,o){var t=e.defer();return n.plugins.socialsharing.shareViaSMS(r,o,function(){t.resolve(!0)},function(){t.reject(!1)}),t.promise},shareViaEmail:function(r,o,t,i,a,c){var u=e.defer();return t=t||null,i=i||null,a=a||null,c=c||null,n.plugins.socialsharing.shareViaEmail(r,o,t,i,a,c,function(){u.resolve(!0)},function(){u.reject(!1)}),u.promise},shareVia:function(r,o,t,i,a){var c=e.defer();return o=o||null,t=t||null,i=i||null,a=a||null,n.plugins.socialsharing.shareVia(r,o,t,i,a,function(){c.resolve(!0)},function(){c.reject(!1)}),c.promise},canShareViaEmail:function(){var r=e.defer();return n.plugins.socialsharing.canShareViaEmail(function(){r.resolve(!0)},function(){r.reject(!1)}),r.promise},canShareVia:function(r,o,t,i,a){var c=e.defer();return n.plugins.socialsharing.canShareVia(r,o,t,i,a,function(e){c.resolve(e)},function(e){c.reject(e)}),c.promise},available:function(){var n=e.defer();return window.plugins.socialsharing.available(function(e){e?n.resolve():n.reject()}),n.promise}}}]),angular.module("ngCordova.plugins.spinnerDialog",[]).factory("$cordovaSpinnerDialog",["$window",function(e){return{show:function(n,r,o){return o=o||!1,e.plugins.spinnerDialog.show(n,r,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,r){return angular.isObject(e)&&!angular.isString(e)?("undefined"!=typeof r&&(e.bgType=r),n.sqlitePlugin.openDatabase(e)):n.sqlitePlugin.openDatabase({name:e,bgType:r})},execute:function(n,r,o){var t=e.defer();return n.transaction(function(e){e.executeSql(r,o,function(e,n){t.resolve(n)},function(e,n){t.reject(n)})}),t.promise},insertCollection:function(n,r,o){var t=e.defer(),i=o.slice(0);return n.transaction(function(e){!function n(){var o=i.splice(0,1)[0];try{e.executeSql(r,o,function(e,r){0===i.length?t.resolve(r):n()},function(e,n){t.reject(n)})}catch(a){t.reject(a)}}()}),t.promise},nestedExecute:function(n,r,o,t,i){var a=e.defer();return n.transaction(function(e){e.executeSql(r,t,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(r){var o=e.defer();return n.sqlitePlugin.deleteDatabase(r,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(r){var o=e.defer();return n.plugins.toast.showShortTop(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showShortCenter:function(r){var o=e.defer();return n.plugins.toast.showShortCenter(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showShortBottom:function(r){var o=e.defer();return n.plugins.toast.showShortBottom(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongTop:function(r){var o=e.defer();return n.plugins.toast.showLongTop(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongCenter:function(r){var o=e.defer();return n.plugins.toast.showLongCenter(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},showLongBottom:function(r){var o=e.defer();return n.plugins.toast.showLongBottom(r,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise},show:function(r,o,t){var i=e.defer();return n.plugins.toast.show(r,o,t,function(e){i.resolve(e)},function(e){i.reject(e)}),i.promise},hide:function(){var r=e.defer();try{n.plugins.toast.hide(),r.resolve()}catch(o){r.reject(o&&o.message)}return r.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 r=e.defer();return window.cordova?touchid.authenticate(function(e){r.resolve(e)},function(e){r.reject(e)},n):r.reject("Not supported without cordova.js"),r.promise}}}]),angular.module("ngCordova.plugins.upsPush",[]).factory("$cordovaUpsPush",["$q","$window","$rootScope","$timeout",function(e,n,r,o){return{register:function(t){var i=e.defer();return n.push.register(function(e){o(function(){r.$broadcast("$cordovaUpsPush:notificationReceived",e)})},function(){i.resolve()},function(e){i.reject(e)},t),i.promise},unregister:function(r){var o=e.defer();return n.push.unregister(function(){o.resolve()},function(e){o.reject(e)},r),o.promise},setBadgeNumber:function(r){var o=e.defer();return n.push.setApplicationIconBadgeNumber(function(){o.resolve()},r),o.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,r){return{captureVideo:function(o){var t=n.defer();return r.plugins.videocaptureplus?(r.plugins.videocaptureplus.captureVideo(t.resolve,t.reject,angular.extend({},e,o)),t.promise):(t.resolve(null),t.promise)}}}]}]),angular.module("ngCordova.plugins.zip",[]).factory("$cordovaZip",["$q","$window",function(e,n){return{unzip:function(r,o){var t=e.defer();return n.zip.unzip(r,o,function(e){0===e?t.resolve():t.reject()},function(e){t.notify(e)}),t.promise}}}])}();
\ No newline at end of file diff --git a/www/lib/ngCordova/package.json b/www/lib/ngCordova/package.json new file mode 100644 index 00000000..cd4a5421 --- /dev/null +++ b/www/lib/ngCordova/package.json @@ -0,0 +1,44 @@ +{ + "name": "ng-cordova", + "private": false, + "main": "dist/ng-cordova", + "version": "0.1.26-alpha", + "repository": { + "url": "git://github.com/driftyco/ng-cordova.git" + }, + "devDependencies": { + "gulp": "^3.7.0", + "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", + "gulp-shell": "^0.2.10", + "gulp-uglify": "^0.2.1", + "jasmine-core": "^2.4.1", + "jshint-stylish": "^0.4.0", + "karma": "^0.13.21", + "karma-chrome-launcher": "~0.2.2", + "karma-coverage": "~0.5.3", + "karma-jasmine": "~0.3.7", + "karma-phantomjs-launcher": "~1.0.0", + "minimist": "^0.1.0", + "phantomjs-prebuilt": "^2.1.4" + }, + "licenses": [ + { + "type": "MIT" + } + ], + "scripts": { + "test": "gulp lint && gulp karma --browsers=PhantomJS --reporters=progress" + }, + "dependencies": { + "conventional-changelog": "0.0.11", + "fs": "0.0.2", + "gulp-git": "^1.2.4", + "q": "^1.1.2" + } +} |
