├── demo ├── hooks │ ├── .gitignore │ ├── after_plugin_add │ │ └── 010_register_plugin.js │ ├── after_plugin_rm │ │ └── 010_deregister_plugin.js │ ├── before_platform_add │ │ └── init_directories.js │ ├── after_platform_add │ │ └── 010_install_plugins.js │ └── after_prepare │ │ └── 020_remove_sass_from_platforms.js ├── www │ ├── .gitignore │ ├── splash.png │ ├── img │ │ ├── demo.png │ │ ├── ionic.png │ │ ├── compass.png │ │ └── spinglobe.gif │ ├── app │ │ ├── media │ │ │ ├── sample.mp3 │ │ │ └── media.html │ │ ├── adMob │ │ │ ├── adMob.html │ │ │ └── adMob.ctrl.js │ │ ├── printer │ │ │ ├── printer.html │ │ │ └── printer.ctrl.js │ │ ├── sqlite │ │ │ ├── sqlite.html │ │ │ └── sqlite.ctrl.js │ │ ├── emailComposer │ │ │ ├── emailComposer.html │ │ │ └── emailComposer.ctrl.js │ │ ├── socialSharing │ │ │ ├── socialSharing.html │ │ │ └── socialSharing.ctrl.js │ │ ├── appAvailability │ │ │ ├── appAvailability.html │ │ │ └── appAvailability.ctrl.js │ │ ├── googleAnalytics │ │ │ ├── googleAnalytics.html │ │ │ └── googleAnalytics.ctrl.js │ │ ├── pushNotifications │ │ │ ├── pushNotifications.html │ │ │ └── pushNotifications.ctrl.js │ │ ├── clipboard │ │ │ ├── clipboard.ctrl.js │ │ │ └── clipboard.html │ │ ├── about.html │ │ ├── statusbar │ │ │ ├── statusbar.html │ │ │ └── statusbar.ctrl.js │ │ ├── inAppBrowser │ │ │ ├── inAppBrowser.html │ │ │ └── inAppBrowser.ctrl.js │ │ ├── localNotification │ │ │ ├── localNotification.html │ │ │ └── localNotification.ctrl.js │ │ ├── insomnia │ │ │ └── insomnia.ctrl.js │ │ ├── touchid │ │ │ ├── touchid.html │ │ │ └── touchid.ctrl.js │ │ ├── vibration │ │ │ ├── vibration.html │ │ │ └── vibration.ctrl.js │ │ ├── flashlight │ │ │ ├── flashlight.ctrl.js │ │ │ └── flashlight.html │ │ ├── fileTransfer │ │ │ ├── fileTransfer.html │ │ │ └── fileTransfer.ctrl.js │ │ ├── appRate │ │ │ ├── appRate.ctrl.js │ │ │ └── appRate.html │ │ ├── barcodeScanner │ │ │ ├── barcodeScanner.ctrl.js │ │ │ └── barcodeScanner.html │ │ ├── camera │ │ │ ├── camera.html │ │ │ └── camera.ctrl.js │ │ ├── network │ │ │ ├── network.html │ │ │ └── network.ctrl.js │ │ ├── datePicker │ │ │ ├── datePicker.html │ │ │ └── datePicker.ctrl.js │ │ ├── fileOpener2 │ │ │ ├── fileOpener2.html │ │ │ └── fileOpener2.ctrl.js │ │ ├── batteryStatus │ │ │ ├── batteryStatus.html │ │ │ └── batteryStatus.ctrl.js │ │ ├── globalization │ │ │ ├── globalization.html │ │ │ └── globalization.ctrl.js │ │ ├── geolocation │ │ │ ├── geolocation.ctrl.js │ │ │ └── geolocation.html │ │ ├── upsPushNotifications │ │ │ ├── pushNotifications.ctrl.js │ │ │ └── pushNotifications.html │ │ ├── toast │ │ │ ├── toast.html │ │ │ └── toast.ctrl.js │ │ ├── dialogs │ │ │ ├── dialogs.html │ │ │ └── dialogs.ctrl.js │ │ ├── healthkit │ │ │ ├── healthkit.html │ │ │ └── healthkit.ctrl.js │ │ ├── device │ │ │ ├── device.html │ │ │ └── device.ctrl.js │ │ ├── preferences │ │ │ ├── preferences.html │ │ │ └── preferences.ctrl.js │ │ ├── contacts │ │ │ ├── contacts.ctrl.js │ │ │ └── contacts.html │ │ ├── deviceMotion │ │ │ ├── deviceMotion.ctrl.js │ │ │ └── deviceMotion.html │ │ ├── deviceOrientation │ │ │ ├── deviceOrientation.html │ │ │ └── deviceOrientation.ctrl.js │ │ └── facebook │ │ │ ├── facebook.html │ │ │ └── facebook.ctrl.js │ ├── css │ │ └── style.css │ ├── lib │ │ ├── ionic │ │ │ ├── fonts │ │ │ │ ├── ionicons.eot │ │ │ │ ├── ionicons.ttf │ │ │ │ └── ionicons.woff │ │ │ ├── scss │ │ │ │ ├── _progress.scss │ │ │ │ ├── ionicons │ │ │ │ │ ├── ionicons.scss │ │ │ │ │ └── _ionicons-font.scss │ │ │ │ ├── _backdrop.scss │ │ │ │ ├── _split-pane.scss │ │ │ │ ├── ionic.scss │ │ │ │ ├── _loading.scss │ │ │ │ ├── _slide-box.scss │ │ │ │ ├── _button-bar.scss │ │ │ │ ├── _menu.scss │ │ │ │ ├── _animations.scss │ │ │ │ ├── _radio.scss │ │ │ │ ├── _badge.scss │ │ │ │ └── _platform.scss │ │ │ ├── README.md │ │ │ ├── bower.json │ │ │ └── .bower.json │ │ ├── angular │ │ │ ├── angular.min.js.gzip │ │ │ ├── bower.json │ │ │ ├── angular-csp.css │ │ │ ├── .bower.json │ │ │ └── package.json │ │ ├── angular-animate │ │ │ ├── bower.json │ │ │ ├── .bower.json │ │ │ └── package.json │ │ ├── angular-sanitize │ │ │ ├── bower.json │ │ │ ├── .bower.json │ │ │ └── package.json │ │ ├── angular-ui-router │ │ │ ├── bower.json │ │ │ ├── .bower.json │ │ │ ├── LICENSE │ │ │ └── src │ │ │ │ ├── stateFilters.js │ │ │ │ └── viewScroll.js │ │ └── ngCordova │ │ │ ├── package.json │ │ │ ├── bower.json │ │ │ ├── LICENSE │ │ │ └── .bower.json │ ├── config.xml │ └── README.md ├── .bowerrc ├── ngCordova-icon.sketch ├── resources │ └── ios │ │ ├── icon.png │ │ ├── splash.png │ │ ├── icon │ │ ├── icon.png │ │ ├── icon-40.png │ │ ├── icon-50.png │ │ ├── icon-60.png │ │ ├── icon-72.png │ │ ├── icon-76.png │ │ ├── icon@2x.png │ │ ├── icon-40@2x.png │ │ ├── icon-50@2x.png │ │ ├── icon-60@2x.png │ │ ├── icon-60@3x.png │ │ ├── icon-72@2x.png │ │ ├── icon-76@2x.png │ │ ├── icon-small.png │ │ └── icon-small@2x.png │ │ └── splash │ │ ├── Default-667h.png │ │ ├── Default-736h.png │ │ ├── Default~iphone.png │ │ ├── Default@2x~iphone.png │ │ ├── Default-568h@2x~iphone.png │ │ ├── Default-Landscape-736h.png │ │ ├── Default-Landscape~ipad.png │ │ ├── Default-Portrait~ipad.png │ │ ├── Default-Landscape@2x~ipad.png │ │ └── Default-Portrait@2x~ipad.png ├── ionic.project ├── bower.json ├── README.md ├── gulpfile.js └── init.sh ├── test ├── plugins │ ├── compass.spec.js │ ├── device.spec.js │ ├── file.spec.js │ ├── geolocation.spec.js │ ├── accelerometer.spec.js │ ├── splashscreen.spec.js │ ├── vibration.spec.js │ ├── batteryStatus.spec.js │ ├── barcodeScanner.spec.js │ ├── pinDialog.spec.js │ ├── network.spec.js │ ├── dialogs.spec.js │ ├── screenshot.spec.js │ ├── spinnerDialog.spec.js │ ├── printer.spec.js │ ├── keyboard.spec.js │ ├── datePicker.spec.js │ ├── appAvailability.js │ ├── sms.spec.js │ └── devices.spec.js └── mocks │ ├── capture.spec.js │ ├── splashscreen.spec.js │ ├── statusbar.spec.js │ ├── brightness.spec.js │ ├── actionSheet.spec.js │ ├── datePicker.spec.js │ ├── fileOpener2.spec.js │ ├── dialogs.spec.js │ ├── vibration.spec.js │ ├── toast.spec.js │ ├── network.spec.js │ └── appVersion.spec.js ├── .bowerrc ├── src ├── module-mocks.js ├── module.js ├── plugins │ ├── tts.js │ ├── splashscreen.js │ ├── insomnia.js │ ├── pinDialog.js │ ├── spinnerDialog.js │ ├── sms.js │ ├── imagePicker.js │ ├── vibration.js │ ├── appAvailability.js │ ├── recentsControl.js │ ├── actionSheet.js │ ├── datepicker.js │ ├── zip.js │ ├── launchNavigator.js │ ├── printer.js │ ├── clipboard.js │ ├── camera.js │ ├── barcodeScanner.js │ ├── emailComposer.js │ ├── keychain.js │ ├── touchid.js │ ├── appVersion.js │ ├── fileOpener2.js │ ├── instagram.js │ ├── geolocation.js │ ├── upsPush.js │ ├── httpd.js │ ├── flashlight.js │ ├── googleMap.js │ ├── screenshot.js │ ├── batteryStatus.js │ ├── capture.js │ ├── brightness.js │ ├── backgroundGeolocation.js │ └── deviceOrientation.js └── mocks │ ├── datePicker.js │ ├── brightness.js │ ├── keyboard.js │ ├── appVersion.js │ ├── actionSheet.js │ ├── splashscreen.js │ ├── googleAnalytics.js │ ├── fileTransfer.js │ ├── camera.js │ ├── capture.js │ ├── keychain.js │ ├── network.js │ ├── sqlite.js │ ├── statusbar.js │ └── fileOpener2.js ├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── .travis.yml ├── .jshintrc ├── config ├── build.config.js └── karma.conf.js ├── bower.json ├── LICENSE └── package.json /demo/hooks/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/www/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/plugins/compass.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/plugins/device.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/plugins/file.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/plugins/geolocation.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/plugins/accelerometer.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "www/lib" 3 | } 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "./bower_components" 3 | } 4 | -------------------------------------------------------------------------------- /src/module-mocks.js: -------------------------------------------------------------------------------- 1 | var ngCordovaMocks = angular.module('ngCordovaMocks', []); -------------------------------------------------------------------------------- /src/module.js: -------------------------------------------------------------------------------- 1 | 2 | angular.module('ngCordova', [ 3 | 'ngCordova.plugins' 4 | ]); 5 | -------------------------------------------------------------------------------- /demo/www/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/splash.png -------------------------------------------------------------------------------- /demo/www/img/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/img/demo.png -------------------------------------------------------------------------------- /demo/www/img/ionic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/img/ionic.png -------------------------------------------------------------------------------- /demo/www/img/compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/img/compass.png -------------------------------------------------------------------------------- /demo/ngCordova-icon.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/ngCordova-icon.sketch -------------------------------------------------------------------------------- /demo/resources/ios/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon.png -------------------------------------------------------------------------------- /demo/www/img/spinglobe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/img/spinglobe.gif -------------------------------------------------------------------------------- /demo/ionic.project: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngcordemo", 3 | "email": "", 4 | "app_id": "", 5 | "package_name": "" 6 | } -------------------------------------------------------------------------------- /demo/resources/ios/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash.png -------------------------------------------------------------------------------- /demo/www/app/media/sample.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/app/media/sample.mp3 -------------------------------------------------------------------------------- /demo/www/css/style.css: -------------------------------------------------------------------------------- 1 | /* Empty. Add your own CSS if you like */ 2 | 3 | .ace_content { 4 | padding: 5px; 5 | } 6 | -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /demo/www/lib/ionic/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/lib/ionic/fonts/ionicons.eot -------------------------------------------------------------------------------- /demo/www/lib/ionic/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/lib/ionic/fonts/ionicons.ttf -------------------------------------------------------------------------------- /demo/www/lib/ionic/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/lib/ionic/fonts/ionicons.woff -------------------------------------------------------------------------------- /demo/www/app/adMob/adMob.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/www/lib/angular/angular.min.js.gzip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/www/lib/angular/angular.min.js.gzip -------------------------------------------------------------------------------- /demo/resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /demo/www/app/printer/printer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /demo/www/app/sqlite/sqlite.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /demo/www/app/emailComposer/emailComposer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo/www/app/socialSharing/socialSharing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /demo/resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionic-team/ng-cordova/HEAD/demo/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /demo/www/app/appAvailability/appAvailability.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/www/app/googleAnalytics/googleAnalytics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/www/app/adMob/adMob.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.adMob.ctrl', []) 2 | 3 | .controller('AdMobCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /demo/www/app/pushNotifications/pushNotifications.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/www/app/sqlite/sqlite.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.sqlite.ctrl', []) 2 | 3 | .controller('SqliteCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /demo/www/lib/angular/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.3.6", 4 | "main": "./angular.js", 5 | "ignore": [], 6 | "dependencies": { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /demo/www/app/printer/printer.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.printer.ctrl', []) 2 | 3 | .controller('PrinterCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /demo/www/app/clipboard/clipboard.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.clipboard.ctrl', []) 2 | 3 | .controller('ClipboardCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true -------------------------------------------------------------------------------- /demo/www/app/socialSharing/socialSharing.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.socialSharing.ctrl', []) 2 | 3 | .controller('SocialSharingCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw* 2 | node_modules/ 3 | .idea/* 4 | demo/platforms/* 5 | demo/plugins/* 6 | _site 7 | bower_components 8 | coverage 9 | Gemfile.lock 10 | .DS_Store* 11 | npm-debug.log 12 | .project 13 | -------------------------------------------------------------------------------- /demo/www/app/appAvailability/appAvailability.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.appAvailability.ctrl', []) 2 | 3 | .controller('AppAvailabilityCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /demo/www/app/googleAnalytics/googleAnalytics.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.googleAnalytics.ctrl', []) 2 | 3 | .controller('GoogleAnalyticsCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /demo/www/app/pushNotifications/pushNotifications.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.pushNotifications.ctrl', []) 2 | 3 | .controller('PushNotificationsCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | }); 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 0.1.27-alpha (2016-07-06) 2 | 3 | 4 | ### 0.1.27-alpha (2016-07-06) 5 | 6 | 7 | Please refer to the [Github ngCordova Releases file](https://github.com/driftyco/ng-cordova/releases) for detailed information. 8 | -------------------------------------------------------------------------------- /demo/www/lib/angular-animate/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-animate", 3 | "version": "1.3.6", 4 | "main": "./angular-animate.js", 5 | "ignore": [], 6 | "dependencies": { 7 | "angular": "1.3.6" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /demo/www/lib/angular-sanitize/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-sanitize", 3 | "version": "1.3.6", 4 | "main": "./angular-sanitize.js", 5 | "ignore": [], 6 | "dependencies": { 7 | "angular": "1.3.6" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /demo/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HelloIonic", 3 | "private": "true", 4 | "devDependencies": { 5 | "ionic": "driftyco/ionic-bower#1.0.0-beta.14" 6 | }, 7 | "dependencies": { 8 | "ngCordova": "~0.1.9-alpha" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /demo/www/app/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

ABOUT

5 | 6 |

This is a demo application for ngCordova.

7 |
8 |
9 | -------------------------------------------------------------------------------- /demo/www/app/statusbar/statusbar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_progress.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Progress 4 | * -------------------------------------------------- 5 | */ 6 | 7 | progress { 8 | display: block; 9 | margin: $progress-margin; 10 | width: $progress-width; 11 | } 12 | -------------------------------------------------------------------------------- /demo/www/app/inAppBrowser/inAppBrowser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demo/www/app/localNotification/localNotification.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /demo/www/app/insomnia/insomnia.ctrl.js: -------------------------------------------------------------------------------- 1 | module.controller('MyCtrl', function($cordovaInsomnia) { 2 | 3 | //Keep Screen on | prevent screen sleep 4 | $cordovaInsomnia.keepAwake(); 5 | 6 | //return to standard. Aloow Sleep Again 7 | $cordovaInsomnia.allowSleepAgain(); 8 | 9 | }); -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | ngCordova Demo App 2 | ===================== 3 | 4 | This is a demo app for ngCordova to show how to use each plugin. Still a WIP 5 | 6 | ## Using this app: 7 | 8 | Start off by adding a cordova platform: 9 | 10 | ``` 11 | cordova platform add ios / android 12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /demo/www/app/media/media.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
Play
6 | 7 | 8 |

{{media}}

9 |
Stop
10 |
11 |
12 | -------------------------------------------------------------------------------- /demo/www/app/touchid/touchid.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Touch ID

5 |
6 | 9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /demo/www/app/vibration/vibration.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Vibration

5 |
6 | 9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /demo/www/app/vibration/vibration.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.vibration.ctrl', []) 2 | 3 | .controller('VibrationCtrl', function($scope, $cordovaVibration) { 4 | 5 | $scope.duration = 100; 6 | 7 | $scope.vibrate = function(){ 8 | console.log("vibrating"); 9 | $cordovaVibration.vibrate($scope.duration); 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /demo/www/lib/angular/angular-csp.css: -------------------------------------------------------------------------------- 1 | /* Include this file in your html if you are using the CSP mode. */ 2 | 3 | @charset "UTF-8"; 4 | 5 | [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], 6 | .ng-cloak, .x-ng-cloak, 7 | .ng-hide:not(.ng-hide-animate) { 8 | display: none !important; 9 | } 10 | 11 | ng\:form { 12 | display: block; 13 | } 14 | -------------------------------------------------------------------------------- /demo/www/app/flashlight/flashlight.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.flashlight.ctrl', []) 2 | 3 | .controller('FlashlightCtrl', function ($scope, $cordovaFlashlight) { 4 | $scope.on = function () { 5 | $cordovaFlashlight.switchOn(); 6 | }; 7 | $scope.off = function () { 8 | $cordovaFlashlight.switchOff(); 9 | }; 10 | 11 | }); 12 | -------------------------------------------------------------------------------- /demo/www/app/flashlight/flashlight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo/www/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | ngCordovaDemo 8 | Demo app for ngCordova plugins 9 | 10 | -------------------------------------------------------------------------------- /demo/www/app/statusbar/statusbar.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.statusbar.ctrl', []) 2 | 3 | 4 | .controller('StatusbarCtrl', function ($scope, $cordovaStatusbar) { 5 | $scope.toggleBar = function () { 6 | if ($cordovaStatusbar.isVisible()) { 7 | $cordovaStatusbar.hide(); 8 | } else { 9 | $cordovaStatusbar.show(); 10 | } 11 | }; 12 | }); -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/ionicons/ionicons.scss: -------------------------------------------------------------------------------- 1 | @import "ionicons-variables"; 2 | /*! 3 | Ionicons, v1.5.2 4 | Created by Ben Sperry for the Ionic Framework, http://ionicons.com/ 5 | https://twitter.com/benjsperry https://twitter.com/ionicframework 6 | MIT License: https://github.com/driftyco/ionicons 7 | */ 8 | 9 | @import "ionicons-font"; 10 | @import "ionicons-animation"; 11 | @import "ionicons-icons"; 12 | -------------------------------------------------------------------------------- /demo/www/app/fileTransfer/fileTransfer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 | Progress : {{downloadProgress}}% 9 |
10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /src/plugins/tts.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-tts 2 | // link : https://github.com/smcpjames/cordova-plugin-tts 3 | 4 | /* globals TTS: true */ 5 | angular.module('ngCordova.plugins.tts', []) 6 | 7 | .factory('$cordovaTTS', function () { 8 | return { 9 | speak: function (text, onfulfilled, onrejected) { 10 | return TTS.speak(text, onfulfilled, onrejected); 11 | } 12 | }; 13 | }); -------------------------------------------------------------------------------- /demo/www/app/appRate/appRate.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.appRate.ctrl', []) 2 | 3 | .controller('AppRateCtrl', function ($scope, $log, $cordovaAppRate) { 4 | 5 | $scope.promptRating = function () { 6 | $cordovaAppRate.promptForRating(true).then(function (result) { 7 | console.log("result: " + result); 8 | }, function (error) { 9 | console.log("ERROR: " + error); 10 | }) 11 | }; 12 | }); 13 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_backdrop.scss: -------------------------------------------------------------------------------- 1 | 2 | .backdrop { 3 | position: fixed; 4 | top: 0; 5 | left: 0; 6 | z-index: $z-index-backdrop; 7 | 8 | width: 100%; 9 | height: 100%; 10 | 11 | background-color: $loading-backdrop-bg-color; 12 | 13 | visibility: hidden; 14 | opacity: 0; 15 | 16 | &.visible { 17 | visibility: visible; 18 | } 19 | &.active { 20 | opacity: 1; 21 | } 22 | 23 | @include transition($loading-backdrop-fadein-duration opacity linear); 24 | } 25 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | before_install: 5 | - npm install -g gulp bower 6 | - bower install 7 | notifications: 8 | email: false 9 | deploy: 10 | provider: npm 11 | email: paolo.enrico.bernasconi@gmail.com 12 | api_key: 13 | secure: dBjQuYwAMqzziqwKKzntnQGKT3LLK+U/ZUuAHvemuuMYHlXcJSwO6gqBcGynGVjzUbq6ONJ4orDqSdicjJXgOXzjJ6PeP5KQzcQ4MHW2ZEnaEr/Wyu81GbwgivOmvF6kJj+7o/oLHSmrSVVXPTxxKNH+5K3CpLlzxaJmCO1UpyI= 14 | on: 15 | tags: true 16 | branch: master 17 | -------------------------------------------------------------------------------- /demo/www/lib/angular/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.3.6", 4 | "main": "./angular.js", 5 | "ignore": [], 6 | "dependencies": {}, 7 | "homepage": "https://github.com/angular/bower-angular", 8 | "_release": "1.3.6", 9 | "_resolution": { 10 | "type": "version", 11 | "tag": "v1.3.6", 12 | "commit": "a525f1199d44c2aa6d69b1900d4a2e950adc5752" 13 | }, 14 | "_source": "git://github.com/angular/bower-angular.git", 15 | "_target": "1.3.6", 16 | "_originalSource": "angular" 17 | } -------------------------------------------------------------------------------- /demo/www/app/barcodeScanner/barcodeScanner.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.barcodeScanner.ctrl', []) 2 | 3 | .controller('BarcodeScannerCtrl', function ($scope, $cordovaBarcodeScanner) { 4 | 5 | $scope.scan = function () { 6 | $cordovaBarcodeScanner 7 | .scan() 8 | .then(function (result) { 9 | $scope.scanResult = result; 10 | }, function (err) { 11 | $scope.scanResult = 'SCAN ERROR (see console)'; 12 | console.error(err); 13 | }); 14 | }; 15 | }); 16 | -------------------------------------------------------------------------------- /demo/www/lib/angular-ui-router/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-ui-router", 3 | "version": "0.2.13", 4 | "main": "./release/angular-ui-router.js", 5 | "dependencies": { 6 | "angular": ">= 1.0.8" 7 | }, 8 | "ignore": [ 9 | "**/.*", 10 | "node_modules", 11 | "bower_components", 12 | "component.json", 13 | "package.json", 14 | "lib", 15 | "config", 16 | "sample", 17 | "test", 18 | "tests", 19 | "ngdoc_assets", 20 | "Gruntfile.js", 21 | "files.js" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/README.md: -------------------------------------------------------------------------------- 1 | # ionic-bower 2 | 3 | Bower repository for [Ionic Framework](http://github.com/driftyco/ionic) 4 | 5 | ### Usage 6 | 7 | Include `js/ionic.bundle.js` to get ionic and all of its dependencies. 8 | 9 | Alternatively, include the individual ionic files with the dependencies separately. 10 | 11 | ### Versions 12 | 13 | To install the latest stable version, `bower install driftyco/ionic-bower#v1.0.0-beta.13` 14 | 15 | To install the latest nightly release, `bower install driftyco/ionic-bower#master` 16 | -------------------------------------------------------------------------------- /src/mocks/datePicker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaDatePicker 4 | * 5 | * @description 6 | * A service for testing datepicker features 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaDatePicker', ['$q', function ($q) { 10 | return { 11 | show: function (options) { 12 | var q = $q.defer(); 13 | options = options || {date: new Date(), mode: 'date'}; 14 | q.resolve(options.date); 15 | return q.promise; 16 | } 17 | }; 18 | }]); 19 | -------------------------------------------------------------------------------- /src/plugins/splashscreen.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-splashscreen 2 | // link : https://github.com/apache/cordova-plugin-splashscreen 3 | 4 | angular.module('ngCordova.plugins.splashscreen', []) 5 | 6 | .factory('$cordovaSplashscreen', [function () { 7 | 8 | return { 9 | hide: function () { 10 | return navigator.splashscreen.hide(); 11 | }, 12 | 13 | show: function () { 14 | return navigator.splashscreen.show(); 15 | } 16 | }; 17 | 18 | }]); 19 | -------------------------------------------------------------------------------- /demo/www/app/camera/camera.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 | Take a picture 8 |
9 |
10 | 11 |
12 |
13 | 14 |
15 | 18 |
19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /demo/www/app/network/network.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | You are currently   {{connectionType}} 7 |
8 |
9 | Network Type   {{networkType}} 10 |
11 |
12 | 13 |
14 | 17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /demo/www/app/barcodeScanner/barcodeScanner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
Barcode Results
7 |
Text: {{scanResult.text}}
8 |
Format: {{scanResult.format}}
9 |
Cancelled: {{scanResult.cancelled}}
10 |
11 |
12 |
13 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": false, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "validthis": true, 22 | "globals": { 23 | "cordova": false, 24 | "angular": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/mocks/capture.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaCapture', function () { 7 | var $cordovaCapture = null; 8 | var $timeout = null; 9 | var $rootScope = null; 10 | 11 | beforeEach(inject(function (_$timeout_, _$rootScope_, _$cordovaCapture_) { 12 | $cordovaCapture = _$cordovaCapture_; 13 | $timeout = _$timeout_; 14 | $rootScope = _$rootScope_; 15 | })); 16 | 17 | it('should do something', function() { 18 | }); 19 | }); 20 | }) -------------------------------------------------------------------------------- /src/mocks/brightness.js: -------------------------------------------------------------------------------- 1 | ngCordovaMocks.factory('$cordovaBrightness', ['$q', function ($q) { 2 | var currentBrightness = 100; 3 | 4 | return { 5 | get: function () { 6 | var q = $q.defer(); 7 | q.resolve(currentBrightness); 8 | return q.promise; 9 | }, 10 | 11 | set: function (data) { 12 | var q = $q.defer(); 13 | currentBrightness = data; 14 | q.resolve('OK'); 15 | return q.promise; 16 | }, 17 | 18 | setKeepScreenOn: function (bool) { 19 | var q = $q.defer(); 20 | q.resolve('OK'); 21 | return q.promise; 22 | } 23 | }; 24 | }]); -------------------------------------------------------------------------------- /demo/hooks/after_plugin_add/010_register_plugin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Push plugins to cordovaPlugins array after_plugin_add 5 | */ 6 | var fs = require('fs'); 7 | var packageJSON = require('../../package.json'); 8 | 9 | packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; 10 | process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { 11 | if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) { 12 | packageJSON.cordovaPlugins.push(plugin); 13 | } 14 | }); 15 | 16 | fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2)); 17 | -------------------------------------------------------------------------------- /demo/www/app/datePicker/datePicker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | {{ data.date }}
9 | 10 | 12 |
13 | 14 |
15 | 16 | {{ data.time }}
17 | 18 | 20 | 21 |
22 | 23 |
24 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /demo/www/app/appRate/appRate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 12 |
13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /src/plugins/insomnia.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git 2 | // link : https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin 3 | angular.module('ngCordova.plugins.insomnia', []) 4 | 5 | .factory('$cordovaInsomnia', ['$window', function ($window) { 6 | 7 | return { 8 | keepAwake: function () { 9 | return $window.plugins.insomnia.keepAwake(); 10 | }, 11 | allowSleepAgain: function () { 12 | return $window.plugins.insomnia.allowSleepAgain(); 13 | } 14 | }; 15 | 16 | }]); 17 | -------------------------------------------------------------------------------- /demo/www/app/fileOpener2/fileOpener2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 8 | 11 | 14 |
15 | 16 | {{ logs }} 17 | 18 |
19 |
20 | -------------------------------------------------------------------------------- /demo/www/lib/angular-animate/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-animate", 3 | "version": "1.3.6", 4 | "main": "./angular-animate.js", 5 | "ignore": [], 6 | "dependencies": { 7 | "angular": "1.3.6" 8 | }, 9 | "homepage": "https://github.com/angular/bower-angular-animate", 10 | "_release": "1.3.6", 11 | "_resolution": { 12 | "type": "version", 13 | "tag": "v1.3.6", 14 | "commit": "d38c9593911d231cce076c1b64f823e572813214" 15 | }, 16 | "_source": "git://github.com/angular/bower-angular-animate.git", 17 | "_target": "1.3.6", 18 | "_originalSource": "angular-animate" 19 | } -------------------------------------------------------------------------------- /demo/www/lib/angular-sanitize/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-sanitize", 3 | "version": "1.3.6", 4 | "main": "./angular-sanitize.js", 5 | "ignore": [], 6 | "dependencies": { 7 | "angular": "1.3.6" 8 | }, 9 | "homepage": "https://github.com/angular/bower-angular-sanitize", 10 | "_release": "1.3.6", 11 | "_resolution": { 12 | "type": "version", 13 | "tag": "v1.3.6", 14 | "commit": "ccd773f961fa1fadc8d728c45a2635c73d34fb2d" 15 | }, 16 | "_source": "git://github.com/angular/bower-angular-sanitize.git", 17 | "_target": "1.3.6", 18 | "_originalSource": "angular-sanitize" 19 | } -------------------------------------------------------------------------------- /demo/hooks/after_plugin_rm/010_deregister_plugin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Remove plugins from cordovaPlugins array after_plugin_rm 5 | */ 6 | var fs = require('fs'); 7 | var packageJSON = require('../../package.json'); 8 | 9 | packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; 10 | 11 | process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) { 12 | var index = packageJSON.cordovaPlugins.indexOf(plugin); 13 | if (index > -1) { 14 | packageJSON.cordovaPlugins.splice(index, 1); 15 | } 16 | }); 17 | 18 | fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2)); 19 | -------------------------------------------------------------------------------- /src/plugins/pinDialog.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/Paldom/PinDialog.git 2 | // link : https://github.com/Paldom/PinDialog 3 | 4 | angular.module('ngCordova.plugins.pinDialog', []) 5 | 6 | .factory('$cordovaPinDialog', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | prompt: function (message, title, buttons) { 10 | var q = $q.defer(); 11 | 12 | $window.plugins.pinDialog.prompt(message, function (res) { 13 | q.resolve(res); 14 | }, title, buttons); 15 | 16 | return q.promise; 17 | } 18 | }; 19 | }]); 20 | -------------------------------------------------------------------------------- /test/mocks/splashscreen.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaSplashscreen', function () { 7 | var $cordovaSplashscreen = null; 8 | 9 | beforeEach(inject(function (_$cordovaSplashscreen_) { 10 | $cordovaSplashscreen = _$cordovaSplashscreen_; 11 | })); 12 | 13 | it('should hide the splash screen', function() { 14 | $cordovaSplashscreen.hide(); 15 | expect(true).toBe(true); 16 | }); 17 | 18 | it('should show the splash screen', function() { 19 | $cordovaSplashscreen.show(); 20 | expect(true).toBe(true); 21 | }); 22 | }); 23 | }) -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_split-pane.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Split Pane 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .split-pane { 8 | @include display-flex(); 9 | @include align-items(stretch); 10 | width: 100%; 11 | height: 100%; 12 | } 13 | 14 | .split-pane-menu { 15 | @include flex(0, 0, $split-pane-menu-width); 16 | 17 | overflow-y: auto; 18 | width: $split-pane-menu-width; 19 | height: 100%; 20 | border-right: 1px solid $split-pane-menu-border-color; 21 | 22 | @media all and (max-width: 568px) { 23 | border-right: none; 24 | } 25 | } 26 | 27 | .split-pane-content { 28 | @include flex(1, 0, auto); 29 | } 30 | -------------------------------------------------------------------------------- /src/plugins/spinnerDialog.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/Paldom/SpinnerDialog.git 2 | // link : https://github.com/Paldom/SpinnerDialog 3 | 4 | angular.module('ngCordova.plugins.spinnerDialog', []) 5 | 6 | .factory('$cordovaSpinnerDialog', ['$window', function ($window) { 7 | 8 | return { 9 | show: function (title, message, fixed, iosOptions) { 10 | fixed = fixed || false; 11 | return $window.plugins.spinnerDialog.show(title, message, fixed, iosOptions); 12 | }, 13 | hide: function () { 14 | return $window.plugins.spinnerDialog.hide(); 15 | } 16 | }; 17 | 18 | }]); 19 | -------------------------------------------------------------------------------- /src/plugins/sms.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git 2 | // link : https://github.com/cordova-sms/cordova-sms-plugin 3 | 4 | /* globals sms: true */ 5 | angular.module('ngCordova.plugins.sms', []) 6 | 7 | .factory('$cordovaSms', ['$q', function ($q) { 8 | 9 | return { 10 | send: function (number, message, options) { 11 | var q = $q.defer(); 12 | sms.send(number, message, options, function (res) { 13 | q.resolve(res); 14 | }, function (err) { 15 | q.reject(err); 16 | }); 17 | return q.promise; 18 | } 19 | }; 20 | 21 | }]); 22 | -------------------------------------------------------------------------------- /test/mocks/statusbar.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaStatusbar', function () { 7 | var $cordovaStatusbar = null; 8 | 9 | beforeEach(inject(function (_$cordovaStatusbar_) { 10 | $cordovaStatusbar = _$cordovaStatusbar_; 11 | })); 12 | 13 | it('should hide the status bar', function() { 14 | $cordovaStatusbar.hide(); 15 | expect($cordovaStatusbar.isVisible()).toBe(false); 16 | }); 17 | 18 | it('should show the status bar', function() { 19 | $cordovaStatusbar.show(); 20 | expect($cordovaStatusbar.isVisible()).toBe(true); 21 | }); 22 | }); 23 | }) -------------------------------------------------------------------------------- /src/plugins/imagePicker.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/wymsee/cordova-imagePicker.git 2 | // link : https://github.com/wymsee/cordova-imagePicker 3 | 4 | angular.module('ngCordova.plugins.imagePicker', []) 5 | 6 | .factory('$cordovaImagePicker', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | getPictures: function (options) { 10 | var q = $q.defer(); 11 | 12 | $window.imagePicker.getPictures(function (results) { 13 | q.resolve(results); 14 | }, function (error) { 15 | q.reject(error); 16 | }, options); 17 | 18 | return q.promise; 19 | } 20 | }; 21 | }]); 22 | -------------------------------------------------------------------------------- /demo/www/app/camera/camera.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.camera.ctrl', []) 2 | 3 | .controller('CameraCtrl', function ($scope, $cordovaCamera) { 4 | $scope.takePicture = function () { 5 | var options = { 6 | quality: 50, 7 | destinationType: Camera.DestinationType.DATA_URL, 8 | sourceType: Camera.PictureSourceType.CAMERA 9 | }; 10 | 11 | // udpate camera image directive 12 | $cordovaCamera.getPicture(options).then(function (imageData) { 13 | $scope.cameraimage = "data:image/jpeg;base64," + imageData; 14 | }, function (err) { 15 | console.log('Failed because: '); 16 | console.log(err); 17 | }); 18 | }; 19 | }); 20 | -------------------------------------------------------------------------------- /src/mocks/keyboard.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaKeyboard 4 | * 5 | * @description 6 | * A service for testing device keyboard features 7 | * in an app build with ngCordova. 8 | **/ 9 | ngCordovaMocks.factory('$cordovaKeyboard', function () { 10 | var isVisible = false; 11 | 12 | return { 13 | hideAccessoryBar: function (bool) { 14 | }, 15 | 16 | close: function () { 17 | isVisible = false; 18 | }, 19 | 20 | show: function () { 21 | isVisible = true; 22 | }, 23 | 24 | disableScroll: function (bool) { 25 | }, 26 | 27 | isVisible: function () { 28 | return isVisible; 29 | } 30 | 31 | }; 32 | }); 33 | -------------------------------------------------------------------------------- /src/plugins/vibration.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-vibration 2 | // link : https://github.com/apache/cordova-plugin-vibration 3 | 4 | angular.module('ngCordova.plugins.vibration', []) 5 | 6 | .factory('$cordovaVibration', [function () { 7 | 8 | return { 9 | vibrate: function (times) { 10 | return navigator.notification.vibrate(times); 11 | }, 12 | vibrateWithPattern: function (pattern, repeat) { 13 | return navigator.notification.vibrateWithPattern(pattern, repeat); 14 | }, 15 | cancelVibration: function () { 16 | return navigator.notification.cancelVibration(); 17 | } 18 | }; 19 | }]); 20 | -------------------------------------------------------------------------------- /demo/www/app/batteryStatus/batteryStatus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 | Battery Level 8 |
9 |
10 | {{batteryLevel}} 11 |
12 |
13 | 14 |
15 |
16 | is Plugged in 17 |
18 |
19 | {{isPluggedIn}} 20 |
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /src/plugins/appAvailability.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/ohh2ahh/AppAvailability.git 2 | // link : https://github.com/ohh2ahh/AppAvailability 3 | 4 | /* globals appAvailability: true */ 5 | angular.module('ngCordova.plugins.appAvailability', []) 6 | 7 | .factory('$cordovaAppAvailability', ['$q', function ($q) { 8 | 9 | return { 10 | check: function (urlScheme) { 11 | var q = $q.defer(); 12 | 13 | appAvailability.check(urlScheme, function (result) { 14 | q.resolve(result); 15 | }, function (err) { 16 | q.reject(err); 17 | }); 18 | 19 | return q.promise; 20 | } 21 | }; 22 | }]); 23 | -------------------------------------------------------------------------------- /demo/www/lib/angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular", 3 | "version": "1.3.6", 4 | "description": "HTML enhanced for web apps", 5 | "main": "angular.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/angular/angular.js.git" 12 | }, 13 | "keywords": [ 14 | "angular", 15 | "framework", 16 | "browser", 17 | "client-side" 18 | ], 19 | "author": "Angular Core Team ", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/angular/angular.js/issues" 23 | }, 24 | "homepage": "http://angularjs.org" 25 | } 26 | -------------------------------------------------------------------------------- /demo/hooks/before_platform_add/init_directories.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * On a fresh clone, the local platforms/ and plugins/ directories will be 5 | * missing, so ensure they get created before the first platform is added. 6 | */ 7 | var fs = require('fs'); 8 | var path = require('path'); 9 | 10 | var platformsDir = path.resolve(__dirname, '../../platforms'); 11 | var pluginsDir = path.resolve(__dirname, '../../plugins'); 12 | 13 | try { 14 | fs.mkdirSync(platformsDir, function (err) { 15 | if (err) { console.error(err); } 16 | }); 17 | } catch(ex) {} 18 | 19 | try { 20 | fs.mkdirSync(pluginsDir, function (err) { 21 | if (err) { console.error(err); } 22 | }); 23 | } catch(ex) {} 24 | -------------------------------------------------------------------------------- /demo/www/app/globalization/globalization.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | Globalization Values 6 |
7 |
8 | Language   {{language}} 9 |
10 |
11 | Locale   {{locale}} 12 |
13 |
14 | First Day of Week   {{fdow}} 15 |
16 |
17 | 18 | 19 |
20 | 23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /demo/www/app/network/network.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.network.ctrl', []) 2 | 3 | .controller('NetworkCtrl', function ($scope, $cordovaNetwork) { 4 | $scope.networkType = null; 5 | $scope.connectionType = null; 6 | 7 | document.addEventListener("deviceready", function () { 8 | $scope.networkType = $cordovaNetwork.getNetwork(); 9 | 10 | if ($cordovaNetwork.isOnline()) { 11 | $scope.connectionType = 'Online'; 12 | } 13 | else if ($cordovaNetwork.isOffline()) { 14 | $scope.connectionType = 'Offline'; 15 | } 16 | else { 17 | $scope.errorMsg = 'Error getting isOffline / isOnline methods'; 18 | } 19 | }, false); 20 | 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /demo/www/app/datePicker/datePicker.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.datePicker.ctrl', []) 2 | 3 | .controller('DatePickerCtrl', function ($scope, $cordovaDatePicker) { 4 | 5 | var options, 6 | dateType, 7 | msg = 'not picked yet', 8 | handleDatePicker = function (date) { 9 | $scope.data[dateType] = date; 10 | $scope.$apply(); 11 | }; 12 | 13 | $scope.data = { 14 | date: msg, 15 | time: msg 16 | }; 17 | 18 | $scope.pick = function (type) { 19 | options = { 20 | date: new Date(), 21 | mode: type 22 | }; 23 | dateType = type; 24 | $cordovaDatePicker.show(options, handleDatePicker); 25 | }; 26 | 27 | }); 28 | -------------------------------------------------------------------------------- /demo/www/app/geolocation/geolocation.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.geolocation.ctrl', []) 2 | 3 | .controller('GeolocationCtrl', function ($scope, $cordovaGeolocation) { 4 | 5 | $scope.getLocation = function () { 6 | 7 | $cordovaGeolocation 8 | .getCurrentPosition({timeout: 10000, enableHighAccuracy: false}) 9 | .then(function (position) { 10 | console.log("position found"); 11 | $scope.position = position; 12 | // long = position.coords.longitude 13 | // lat = position.coords.latitude 14 | }, function (err) { 15 | console.log("unable to find location"); 16 | $scope.errorMsg = "Error : " + err.message; 17 | }); 18 | }; 19 | 20 | }); 21 | -------------------------------------------------------------------------------- /src/plugins/recentsControl.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-recentscontrol 2 | // link : https://github.com/smcpjames/cordova-plugin-recentscontrol 3 | 4 | /* globals RecentsControl: true */ 5 | angular.module('ngCordova.plugins.recentsControl', []) 6 | 7 | .factory('$cordovaRecents', function () { 8 | return { 9 | setColor: function (color) { 10 | return RecentsControl.setColor(color); 11 | }, 12 | 13 | setDescription: function (desc) { 14 | return RecentsControl.setDescription(desc); 15 | }, 16 | 17 | setOptions: function (colorStr, desc) { 18 | return RecentsControl.setOptions(colorStr, desc); 19 | } 20 | }; 21 | }); -------------------------------------------------------------------------------- /demo/www/app/fileOpener2/fileOpener2.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.fileOpener2.ctrl', []) 2 | 3 | .controller('FileOpener2Ctrl', function ($scope, $log, $cordovaFileOpener2) { 4 | 5 | $scope.packageId = ''; 6 | $scope.type = ''; 7 | 8 | $scope.logs = ''; 9 | 10 | $scope.open = function() { 11 | $cordovaFileOpener2.open( 12 | $scope.packageId, 13 | $scope.type 14 | ).then( 15 | function(){ 16 | $scope.logs = 'Success'; 17 | }, 18 | function(error) { 19 | alert('error code: '+error.code+' , message: '+error.message); 20 | $scope.logs = 'error code: '+error.code+' , message: '+error.message; 21 | } 22 | ); 23 | }; 24 | 25 | }); 26 | -------------------------------------------------------------------------------- /demo/www/app/geolocation/geolocation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | Get My Current Location 7 |
8 |
9 | Longitude   {{position.coords.longitude}} 10 |
11 |
12 | 13 | Latitude   {{position.coords.latitude}} 14 |
15 |
16 |

{{errorMsg}}

17 |
18 |
19 | 20 |
21 | 24 | 25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /demo/www/app/upsPushNotifications/pushNotifications.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.upsPushNotifications.ctrl', []) 2 | 3 | .controller('UpsPushNotificationsCtrl', function ($scope, $rootScope, $cordovaUpsPush) { 4 | $scope.config = {}; 5 | 6 | $scope.register = function () { 7 | $cordovaUpsPush.register($scope.config).then(function () { 8 | console.log("successful registered"); 9 | }, function (err) { 10 | alert("Registration error: " + err); 11 | }); 12 | 13 | $rootScope.$on('$cordovaUpsPush:notificationReceived', function (event, notification) { 14 | if (notification.alert) { 15 | navigator.notification.alert(notification.alert); 16 | } 17 | }); 18 | }; 19 | }); 20 | -------------------------------------------------------------------------------- /src/plugins/actionSheet.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git 2 | // link : https://github.com/EddyVerbruggen/cordova-plugin-actionsheet 3 | 4 | angular.module('ngCordova.plugins.actionSheet', []) 5 | 6 | .factory('$cordovaActionSheet', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | show: function (options) { 10 | var q = $q.defer(); 11 | 12 | $window.plugins.actionsheet.show(options, function (result) { 13 | q.resolve(result); 14 | }); 15 | 16 | return q.promise; 17 | }, 18 | 19 | hide: function () { 20 | return $window.plugins.actionsheet.hide(); 21 | } 22 | }; 23 | }]); 24 | -------------------------------------------------------------------------------- /src/plugins/datepicker.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git 2 | // link : https://github.com/VitaliiBlagodir/cordova-plugin-datepicker 3 | 4 | angular.module('ngCordova.plugins.datePicker', []) 5 | 6 | .factory('$cordovaDatePicker', ['$window', '$q', function ($window, $q) { 7 | 8 | return { 9 | show: function (options) { 10 | var q = $q.defer(); 11 | options = options || {date: new Date(), mode: 'date'}; 12 | $window.datePicker.show(options, function (date) { 13 | q.resolve(date); 14 | }, function (error){ 15 | q.reject(error); 16 | }); 17 | return q.promise; 18 | } 19 | }; 20 | }]); -------------------------------------------------------------------------------- /demo/www/app/touchid/touchid.ctrl.js: -------------------------------------------------------------------------------- 1 | 2 | angular.module('demo.touchid.ctrl', []) 3 | 4 | 5 | .controller('TouchIDCtrl', function ($scope, $cordovaTouchID) { 6 | var supported = false; 7 | $cordovaTouchID.checkSupport().then(function(val) { 8 | supported = true; 9 | }, function(err) { 10 | supported = false; 11 | }); 12 | 13 | $scope.prompt = function() { 14 | if(!supported) { 15 | alert('TouchID is not supported on your device.'); 16 | } else { 17 | $cordovaTouchID.authenticate('Please authenticate').then(function(authVal) { 18 | alert('Success!'); 19 | console.log(authVal); 20 | }, function(err) { 21 | alert(err); 22 | console.log(err); 23 | }); 24 | } 25 | }; 26 | }); 27 | -------------------------------------------------------------------------------- /demo/www/lib/angular-animate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-animate", 3 | "version": "1.3.6", 4 | "description": "AngularJS module for animations", 5 | "main": "angular-animate.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/angular/angular.js.git" 12 | }, 13 | "keywords": [ 14 | "angular", 15 | "framework", 16 | "browser", 17 | "animation", 18 | "client-side" 19 | ], 20 | "author": "Angular Core Team ", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/angular/angular.js/issues" 24 | }, 25 | "homepage": "http://angularjs.org" 26 | } 27 | -------------------------------------------------------------------------------- /demo/www/lib/angular-sanitize/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-sanitize", 3 | "version": "1.3.6", 4 | "description": "AngularJS module for sanitizing HTML", 5 | "main": "angular-sanitize.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/angular/angular.js.git" 12 | }, 13 | "keywords": [ 14 | "angular", 15 | "framework", 16 | "browser", 17 | "html", 18 | "client-side" 19 | ], 20 | "author": "Angular Core Team ", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/angular/angular.js/issues" 24 | }, 25 | "homepage": "http://angularjs.org" 26 | } 27 | -------------------------------------------------------------------------------- /src/plugins/zip.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/MobileChromeApps/zip.git 2 | // link : https://github.com/MobileChromeApps/zip 3 | 4 | angular.module('ngCordova.plugins.zip', []) 5 | 6 | .factory('$cordovaZip', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | unzip: function (source, destination) { 10 | var q = $q.defer(); 11 | 12 | $window.zip.unzip(source, destination, function (isError) { 13 | if (isError === 0) { 14 | q.resolve(); 15 | } else { 16 | q.reject(); 17 | } 18 | }, function (progressEvent) { 19 | q.notify(progressEvent); 20 | }); 21 | 22 | return q.promise; 23 | } 24 | }; 25 | }]); 26 | -------------------------------------------------------------------------------- /demo/www/app/clipboard/clipboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |

This is some text to be copied

6 |
7 |
8 | 9 |
10 | 13 |
14 | 15 | 16 |
17 | 22 |
23 | 24 |
25 | 28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /src/mocks/appVersion.js: -------------------------------------------------------------------------------- 1 | ngCordovaMocks.factory('$cordovaAppVersion', ['$q', function ($q) { 2 | var throwsError = false; 3 | return { 4 | throwsError: throwsError, 5 | 6 | getAppName: function () { 7 | var q = $q.defer(); 8 | q.resolve('mock app name'); 9 | return q.promise; 10 | }, 11 | 12 | getPackageName: function () { 13 | var q = $q.defer(); 14 | q.resolve('com.package.mock'); 15 | return q.promise; 16 | }, 17 | 18 | getVersionNumber: function () { 19 | var q = $q.defer(); 20 | q.resolve('1.2.3'); 21 | return q.promise; 22 | }, 23 | 24 | getVersionCode: function () { 25 | var q = $q.defer(); 26 | q.resolve('4.5.6'); 27 | return q.promise; 28 | } 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /test/plugins/splashscreen.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaSplashscreen', function() { 2 | 3 | var $cordovaSplashscreen; 4 | 5 | beforeEach(module('ngCordova.plugins.splashscreen')); 6 | 7 | beforeEach(inject(function (_$cordovaSplashscreen_) { 8 | $cordovaSplashscreen = _$cordovaSplashscreen_; 9 | 10 | navigator.splashscreen = jasmine.createSpyObj('splashscreen', ['hide', 'show']); 11 | })); 12 | 13 | it('should call navigator\'s splashscreen.hide', function() { 14 | $cordovaSplashscreen.hide(); 15 | expect(navigator.splashscreen.hide).toHaveBeenCalled(); 16 | }); 17 | 18 | it('should call navigator\'s splashscreen.show', function() { 19 | $cordovaSplashscreen.show(); 20 | expect(navigator.splashscreen.show).toHaveBeenCalled(); 21 | }); 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /demo/www/app/toast/toast.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Toast

5 | 6 |
7 | 11 |
12 | 13 | 14 |
15 | 18 | 19 | 22 | 23 | 26 |
27 | 28 |
29 |
30 | -------------------------------------------------------------------------------- /src/plugins/launchNavigator.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator 2 | // link : https://github.com/dpa99c/phonegap-launch-navigator 3 | 4 | /* globals launchnavigator: true */ 5 | angular.module('ngCordova.plugins.launchNavigator', []) 6 | 7 | .factory('$cordovaLaunchNavigator', ['$q', function ($q) { 8 | 9 | return { 10 | navigate: function (destination, start, options) { 11 | var q = $q.defer(); 12 | launchnavigator.navigate( 13 | destination, 14 | start, 15 | function (){ 16 | q.resolve(); 17 | }, 18 | function (error){ 19 | q.reject(error); 20 | }, 21 | options); 22 | return q.promise; 23 | } 24 | }; 25 | 26 | }]); 27 | -------------------------------------------------------------------------------- /demo/www/app/dialogs/dialogs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | {{action}} 7 |
8 |
9 | 12 | 13 |
14 | 15 | 18 | 19 | 20 |
21 | 24 |
25 | 26 | 29 |
30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /demo/www/app/healthkit/healthkit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

HealthKit

4 |

5 | Authorization: GrantedNot granted 6 |

7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/ionic.scss: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | @import 4 | // Ionicons 5 | "ionicons/ionicons.scss", 6 | 7 | // Variables 8 | "mixins", 9 | "variables", 10 | 11 | // Base 12 | "reset", 13 | "scaffolding", 14 | "type", 15 | 16 | // Components 17 | "action-sheet", 18 | "backdrop", 19 | "bar", 20 | "tabs", 21 | "menu", 22 | "modal", 23 | "popover", 24 | "popup", 25 | "loading", 26 | "items", 27 | "list", 28 | "badge", 29 | "slide-box", 30 | 31 | // Forms 32 | "form", 33 | "checkbox", 34 | "toggle", 35 | "radio", 36 | "range", 37 | "select", 38 | "progress", 39 | 40 | // Buttons 41 | "button", 42 | "button-bar", 43 | 44 | // Util 45 | "grid", 46 | "util", 47 | "platform", 48 | 49 | // Animations 50 | "animations", 51 | "transitions"; 52 | -------------------------------------------------------------------------------- /test/mocks/brightness.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaBrightness', function () { 7 | var $cordovaBrightness = null; 8 | 9 | beforeEach(inject(function (_$cordovaBrightness_) { 10 | $cordovaBrightness = _$cordovaBrightness_; 11 | })); 12 | 13 | it('should get the current brightness', function () { 14 | $cordovaBrightness.get().then(function (result) { 15 | expect(result.value).toEqual(100); 16 | }); 17 | }); 18 | 19 | it('should set the current brightness', function () { 20 | $cordovaBrightness.set(50); 21 | 22 | var currentBrightness = $cordovaBrightness.get(); 23 | $cordovaBrightness.get().then(function (result) { 24 | expect(result.value).toEqual(50); 25 | }); 26 | }); 27 | }); 28 | }) -------------------------------------------------------------------------------- /config/build.config.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var pkg = require('../package.json'); 3 | 4 | module.exports = { 5 | banner: '/*!\n' + 6 | ' * ngCordova\n' + 7 | ' * v' + pkg.version +'\n' + 8 | ' * Copyright 2015 Drifty Co. http://drifty.com/\n' + 9 | ' * See LICENSE in this repository for license information\n' + 10 | ' */\n', 11 | 12 | closureStart: '(function(){\n', 13 | closureEnd: '\n})();', 14 | 15 | dist: 'dist', 16 | demo : { 17 | ngCordova : 'demo/www/lib/ngCordova/dist', 18 | lib : 'demo/www/lib', 19 | www : 'demo/www' 20 | }, 21 | 22 | pluginFiles: [ 23 | 'src/module.js', 24 | 'src/plugins/*.js', 25 | ], 26 | 27 | mockFiles: [ 28 | 'src/module-mocks.js', 29 | 'src/mocks/*.js' 30 | ], 31 | 32 | versionData: { 33 | version: pkg.version 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /demo/hooks/after_platform_add/010_install_plugins.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Install all plugins listed in package.json 5 | * https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js 6 | */ 7 | var exec = require('child_process').exec; 8 | var path = require('path'); 9 | var sys = require('sys'); 10 | 11 | var packageJSON = require('../../package.json'); 12 | var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova'; 13 | // var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd); 14 | 15 | packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || []; 16 | packageJSON.cordovaPlugins.forEach(function (plugin) { 17 | exec('cordova plugin add ' + plugin, function (error, stdout, stderr) { 18 | sys.puts(stdout); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /src/plugins/printer.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/katzer/cordova-plugin-printer.git 2 | // link : https://github.com/katzer/cordova-plugin-printer 3 | 4 | angular.module('ngCordova.plugins.printer', []) 5 | 6 | .factory('$cordovaPrinter', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | isAvailable: function () { 10 | var q = $q.defer(); 11 | 12 | $window.plugin.printer.isAvailable(function (isAvailable) { 13 | q.resolve(isAvailable); 14 | }); 15 | 16 | return q.promise; 17 | }, 18 | 19 | print: function (doc, options) { 20 | var q = $q.defer(); 21 | $window.plugin.printer.print(doc, options, function () { 22 | q.resolve(); 23 | }); 24 | return q.promise; 25 | } 26 | }; 27 | }]); 28 | -------------------------------------------------------------------------------- /demo/www/app/device/device.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 |

Available

7 | 8 |

{{available}}

9 |
10 | 11 |
12 |

Model

13 | 14 |

{{model}}

15 |
16 |
17 |

Platform

18 | 19 |

{{platform}}

20 |
21 |
22 |

Version

23 | 24 |

{{version}}

25 |
26 |
27 |

UUID

28 | 29 |

{{uuid}}

30 |
31 |
32 |

Cordova Version

33 | 34 |

{{cordova}}

35 |
36 |
37 |
38 |
39 | -------------------------------------------------------------------------------- /demo/www/lib/angular-ui-router/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-ui-router", 3 | "version": "0.2.13", 4 | "main": "./release/angular-ui-router.js", 5 | "dependencies": { 6 | "angular": ">= 1.0.8" 7 | }, 8 | "ignore": [ 9 | "**/.*", 10 | "node_modules", 11 | "bower_components", 12 | "component.json", 13 | "package.json", 14 | "lib", 15 | "config", 16 | "sample", 17 | "test", 18 | "tests", 19 | "ngdoc_assets", 20 | "Gruntfile.js", 21 | "files.js" 22 | ], 23 | "homepage": "https://github.com/angular-ui/ui-router", 24 | "_release": "0.2.13", 25 | "_resolution": { 26 | "type": "version", 27 | "tag": "0.2.13", 28 | "commit": "c3d543aae43d4600512520a0d70723ac31f2cb62" 29 | }, 30 | "_source": "git://github.com/angular-ui/ui-router.git", 31 | "_target": "0.2.13", 32 | "_originalSource": "angular-ui-router" 33 | } -------------------------------------------------------------------------------- /demo/www/app/device/device.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.device.ctrl', []) 2 | 3 | .controller('DeviceCtrl', function ($scope, $state, $cordovaDevice) { 4 | 5 | var init = function () { 6 | console.log("initializing device"); 7 | try { 8 | document.addEventListener("deviceready", function () { 9 | $scope.available = $cordovaDevice.getDevice().available; 10 | $scope.cordova = $cordovaDevice.getCordova(); 11 | $scope.model = $cordovaDevice.getModel(); 12 | $scope.platform = $cordovaDevice.getPlatform(); 13 | $scope.uuid = $cordovaDevice.getUUID(); 14 | $scope.version = $cordovaDevice.getVersion(); 15 | }, false); 16 | } 17 | catch (err) { 18 | console.log("Error " + err.message); 19 | alert("error " + err.$$failure.message); 20 | } 21 | }; 22 | 23 | init(); 24 | }); 25 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionic", 3 | "version": "1.0.0-beta.14", 4 | "codename": "magnesium-mongoose", 5 | "homepage": "https://github.com/driftyco/ionic", 6 | "authors": [ 7 | "Max Lynch ", 8 | "Adam Bradley ", 9 | "Ben Sperry " 10 | ], 11 | "description": "Advanced HTML5 hybrid mobile app development framework.", 12 | "main": [ 13 | "css/ionic.css", 14 | "fonts/*", 15 | "js/ionic.js", 16 | "js/ionic-angular.js" 17 | ], 18 | "keywords": [ 19 | "mobile", 20 | "html5", 21 | "ionic", 22 | "cordova", 23 | "phonegap", 24 | "trigger", 25 | "triggerio", 26 | "angularjs", 27 | "angular" 28 | ], 29 | "license": "MIT", 30 | "private": false, 31 | "dependencies": { 32 | "angular": "1.3.6", 33 | "angular-animate": "1.3.6", 34 | "angular-sanitize": "1.3.6", 35 | "angular-ui-router": "0.2.13" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/mocks/actionSheet.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaActionSheet 4 | * 5 | * @description 6 | * A service for testing action sheet 7 | * in an app build with ngCordova. 8 | **/ 9 | ngCordovaMocks.factory('$cordovaActionSheet', ['$q', function ($q) { 10 | var throwsError = false; 11 | 12 | return { 13 | /** 14 | * @ngdoc property 15 | * @name throwsError 16 | * @propertyOf ngCordovaMocks.cordovaActionSheet 17 | * @type Boolean 18 | * 19 | * @description 20 | * A flag that signals whether a promise should be rejected. 21 | * This property should only be used in automated tests 22 | */ 23 | throwsError: throwsError, 24 | 25 | show: function () { 26 | var defer = $q.defer(); 27 | 28 | if (this.throwsError) { 29 | defer.reject('There was an error on showing action sheet'); 30 | } else { 31 | defer.resolve(); 32 | } 33 | 34 | return defer.promise; 35 | } 36 | }; 37 | }]); 38 | -------------------------------------------------------------------------------- /src/plugins/clipboard.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git 2 | // link : https://github.com/VersoSolutions/CordovaClipboard 3 | 4 | angular.module('ngCordova.plugins.clipboard', []) 5 | 6 | .factory('$cordovaClipboard', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | copy: function (text) { 10 | var q = $q.defer(); 11 | 12 | $window.cordova.plugins.clipboard.copy(text, 13 | function () { 14 | q.resolve(); 15 | }, function () { 16 | q.reject(); 17 | }); 18 | 19 | return q.promise; 20 | }, 21 | 22 | paste: function () { 23 | var q = $q.defer(); 24 | 25 | $window.cordova.plugins.clipboard.paste(function (text) { 26 | q.resolve(text); 27 | }, function () { 28 | q.reject(); 29 | }); 30 | 31 | return q.promise; 32 | } 33 | }; 34 | }]); 35 | -------------------------------------------------------------------------------- /demo/www/lib/ngCordova/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-cordova", 3 | "private": false, 4 | "main": "dist/ng-cordova", 5 | "version": "0.1.9-alpha", 6 | "repository": { 7 | "url": "git://github.com/driftyco/ng-cordova.git" 8 | }, 9 | "devDependencies": { 10 | "gulp": "^3.7.0", 11 | "gulp-concat": "^2.2.0", 12 | "gulp-footer": "^1.0.4", 13 | "gulp-header": "^1.0.2", 14 | "gulp-jshint": "^1.6.1", 15 | "gulp-prettify": "^0.3.0", 16 | "gulp-rename": "^1.2.0", 17 | "gulp-shell": "^0.2.10", 18 | "gulp-uglify": "^0.2.1", 19 | "jshint-stylish": "^0.4.0", 20 | "karma": "^0.12.16", 21 | "karma-chrome-launcher": "~0.1.2", 22 | "karma-coverage": "~0.2.6", 23 | "karma-jasmine": "~0.1.5", 24 | "karma-phantomjs-launcher": "~0.1.2", 25 | "minimist": "^0.1.0" 26 | }, 27 | "licenses": [ 28 | { 29 | "type": "MIT" 30 | } 31 | ], 32 | "scripts": { 33 | "test": "gulp karma --browsers=PhantomJS --reporters=progress" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/plugins/camera.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-camera 2 | // link : https://github.com/apache/cordova-plugin-camera 3 | 4 | angular.module('ngCordova.plugins.camera', []) 5 | 6 | .factory('$cordovaCamera', ['$q', function ($q) { 7 | 8 | return { 9 | getPicture: function (options) { 10 | var q = $q.defer(); 11 | 12 | if (!navigator.camera) { 13 | q.resolve(null); 14 | return q.promise; 15 | } 16 | 17 | navigator.camera.getPicture(function (imageData) { 18 | q.resolve(imageData); 19 | }, function (err) { 20 | q.reject(err); 21 | }, options); 22 | 23 | return q.promise; 24 | }, 25 | 26 | cleanup: function () { 27 | var q = $q.defer(); 28 | 29 | navigator.camera.cleanup(function () { 30 | q.resolve(); 31 | }, function (err) { 32 | q.reject(err); 33 | }); 34 | 35 | return q.promise; 36 | } 37 | }; 38 | }]); 39 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/ionicons/_ionicons-font.scss: -------------------------------------------------------------------------------- 1 | // Ionicons Font Path 2 | // -------------------------- 3 | 4 | @font-face { 5 | font-family: $ionicons-font-family; 6 | src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}"); 7 | src:url("#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}#iefix") format("embedded-opentype"), 8 | url("#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}") format("truetype"), 9 | url("#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}") format("woff"), 10 | url("#{$ionicons-font-path}/ionicons.svg?v=#{$ionicons-version}#Ionicons") format("svg"); 11 | font-weight: normal; 12 | font-style: normal; 13 | } 14 | 15 | .ion { 16 | display: inline-block; 17 | font-family: $ionicons-font-family; 18 | speak: none; 19 | font-style: normal; 20 | font-weight: normal; 21 | font-variant: normal; 22 | text-transform: none; 23 | text-rendering: auto; 24 | line-height: 1; 25 | -webkit-font-smoothing: antialiased; 26 | -moz-osx-font-smoothing: grayscale; 27 | } -------------------------------------------------------------------------------- /demo/www/app/dialogs/dialogs.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.dialogs.ctrl', []) 2 | 3 | .controller('DialogsCtrl', function ($scope, $cordovaDialogs) { 4 | 5 | $scope.action = "Press any button"; 6 | 7 | $scope.alert = function () { 8 | $scope.action = "Alert"; 9 | $cordovaDialogs.alert('Wow!'); 10 | }; 11 | 12 | $scope.confirm = function () { 13 | $scope.action = "Confirm"; 14 | $cordovaDialogs.confirm('Are you sure?', "Custom title").then(function (buttonIndex) { 15 | $cordovaDialogs.alert("Button index : " + buttonIndex); 16 | }); 17 | }; 18 | 19 | $scope.prompt = function () { 20 | $scope.action = "Prompt"; 21 | $cordovaDialogs.prompt('Please Login', "Custom title").then(function (result) { 22 | $cordovaDialogs.alert("Input: " + result.input1 + "\n Button index : " + result.buttonIndex); 23 | }); 24 | }; 25 | 26 | $scope.beep = function () { 27 | $scope.action = "Beep"; 28 | $cordovaDialogs.beep(3); 29 | }; 30 | 31 | 32 | }); 33 | 34 | -------------------------------------------------------------------------------- /src/plugins/barcodeScanner.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git 2 | // link : https://github.com/phonegap/phonegap-plugin-barcodescanner 3 | 4 | angular.module('ngCordova.plugins.barcodeScanner', []) 5 | 6 | .factory('$cordovaBarcodeScanner', ['$q', function ($q) { 7 | 8 | return { 9 | scan: function (config) { 10 | var q = $q.defer(); 11 | 12 | cordova.plugins.barcodeScanner.scan(function (result) { 13 | q.resolve(result); 14 | }, function (err) { 15 | q.reject(err); 16 | }, config); 17 | 18 | return q.promise; 19 | }, 20 | 21 | encode: function (type, data) { 22 | var q = $q.defer(); 23 | type = type || 'TEXT_TYPE'; 24 | 25 | cordova.plugins.barcodeScanner.encode(type, data, function (result) { 26 | q.resolve(result); 27 | }, function (err) { 28 | q.reject(err); 29 | }); 30 | 31 | return q.promise; 32 | } 33 | }; 34 | }]); 35 | -------------------------------------------------------------------------------- /demo/www/app/preferences/preferences.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 13 | 14 | 19 |
20 |
21 | 22 |
23 | 24 |
25 | {{ data.pref }} 26 |
27 | 28 |
29 | 34 |
35 |
36 | 37 |
38 |
39 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_loading.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Loading 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .loading-container { 8 | position: absolute; 9 | left: 0; 10 | top: 0; 11 | right: 0; 12 | bottom: 0; 13 | 14 | z-index: $z-index-loading; 15 | 16 | @include display-flex(); 17 | @include justify-content(center); 18 | @include align-items(center); 19 | 20 | @include transition(0.2s opacity linear); 21 | visibility: hidden; 22 | opacity: 0; 23 | 24 | &:not(.visible) .icon { 25 | display: none; 26 | } 27 | &.visible { 28 | visibility: visible; 29 | } 30 | &.active { 31 | opacity: 1; 32 | } 33 | 34 | .loading { 35 | padding: $loading-padding; 36 | 37 | border-radius: $loading-border-radius; 38 | background-color: $loading-bg-color; 39 | 40 | color: $loading-text-color; 41 | 42 | text-align: center; 43 | text-overflow: ellipsis; 44 | font-size: $loading-font-size; 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | color: $loading-text-color; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo/www/app/contacts/contacts.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.contacts.ctrl', []) 2 | 3 | .controller('ContactsCtrl', function ($scope, $log, $cordovaContacts) { 4 | 5 | $scope.pickContact = function () { 6 | document.addEventListener("deviceready", function () { 7 | $cordovaContacts.pickContact().then(function (result) { 8 | console.log(JSON.stringify(result)); 9 | $scope.selectedContact = result; 10 | }) 11 | }, false); 12 | }; 13 | 14 | $scope.saveContact = function (contact) { 15 | document.addEventListener("deviceready", function () { 16 | $cordovaContacts.save(contact).then(function (result) { 17 | console.log(JSON.stringify(result)); 18 | }) 19 | }, false); 20 | }; 21 | 22 | 23 | $scope.removeContact = function (contact) { 24 | document.addEventListener("deviceready", function () { 25 | $cordovaContacts.remove(contact).then(function (result) { 26 | console.log(JSON.stringify(result)); 27 | }) 28 | }, false); 29 | }; 30 | 31 | }); 32 | -------------------------------------------------------------------------------- /demo/hooks/after_prepare/020_remove_sass_from_platforms.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * After prepare, files are copied to the platforms/ios and platforms/android folders. 5 | * Lets clean up some of those files that arent needed with this hook. 6 | */ 7 | var fs = require('fs'); 8 | var path = require('path'); 9 | 10 | var deleteFolderRecursive = function(removePath) { 11 | if( fs.existsSync(removePath) ) { 12 | fs.readdirSync(removePath).forEach(function(file,index){ 13 | var curPath = path.join(removePath, file); 14 | if(fs.lstatSync(curPath).isDirectory()) { // recurse 15 | deleteFolderRecursive(curPath); 16 | } else { // delete file 17 | fs.unlinkSync(curPath); 18 | } 19 | }); 20 | fs.rmdirSync(removePath); 21 | } 22 | }; 23 | 24 | var iosPlatformsDir = path.resolve(__dirname, '../../platforms/ios/www/lib/ionic/scss'); 25 | var androidPlatformsDir = path.resolve(__dirname, '../../platforms/android/assets/www/lib/ionic/scss'); 26 | 27 | deleteFolderRecursive(iosPlatformsDir); 28 | deleteFolderRecursive(androidPlatformsDir); 29 | -------------------------------------------------------------------------------- /demo/www/app/localNotification/localNotification.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.localNotification.ctrl', []) 2 | 3 | .controller('LocalNotificationCtrl', function ($scope, $rootScope, $cordovaLocalNotification) { 4 | 5 | $scope.addNotification = function () { 6 | var now = new Date().getTime(); 7 | var _60_seconds_from_now = new Date(now + 60 * 1000); 8 | var event = { 9 | id: 1, 10 | at: _60_seconds_from_now, 11 | title: "Test Event", 12 | text: "this is a message about the event" 13 | }; 14 | 15 | document.addEventListener("deviceready", function () { 16 | $cordovaLocalNotification.schedule(event).then(function () { 17 | console.log("local add : success"); 18 | }); 19 | 20 | }, false); 21 | 22 | }; 23 | 24 | document.addEventListener("deviceready", function () { 25 | $rootScope.$on("$cordovaLocalNotification:trigger", function (event, notification, state) { 26 | console.log("notification id:" + notification.id + " state: " + state); 27 | }); 28 | }, false); 29 | }); 30 | 31 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_slide-box.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Slide Box 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .slider { 8 | position: relative; 9 | visibility: hidden; 10 | // Make sure items don't scroll over ever 11 | overflow: hidden; 12 | } 13 | 14 | .slider-slides { 15 | position: relative; 16 | height: 100%; 17 | } 18 | 19 | .slider-slide { 20 | position: relative; 21 | display: block; 22 | float: left; 23 | width: 100%; 24 | height: 100%; 25 | vertical-align: top; 26 | } 27 | 28 | .slider-slide-image { 29 | > img { 30 | width: 100%; 31 | } 32 | } 33 | 34 | .slider-pager { 35 | position: absolute; 36 | bottom: 20px; 37 | z-index: $z-index-slider-pager; 38 | width: 100%; 39 | height: 15px; 40 | text-align: center; 41 | 42 | .slider-pager-page { 43 | display: inline-block; 44 | margin: 0px 3px; 45 | width: 15px; 46 | color: #000; 47 | text-decoration: none; 48 | 49 | opacity: 0.3; 50 | 51 | &.active { 52 | @include transition(opacity 0.4s ease-in); 53 | opacity: 1; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /demo/www/lib/ngCordova/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngCordova", 3 | "version": "0.1.9-alpha", 4 | "homepage": "http://ngCordova.com/", 5 | "authors": [ 6 | "Max Lynch ", 7 | "Paolo Bernasconi ", 8 | "Chad Campbell " 9 | ], 10 | "description": "AngularJS Cordova wrappers for common Cordova plugins.", 11 | "main": [ 12 | "./dist/ng-cordova.js" 13 | ], 14 | "ignore": [ 15 | "**/.*", 16 | "gulpfile.js", 17 | "test", 18 | "src", 19 | "config", 20 | "demo", 21 | "CONTRIBUTING.md" 22 | ], 23 | "dependencies": { 24 | "angular": ">= 1.2.23" 25 | }, 26 | "keywords": [ 27 | "ngCordova", 28 | "ng-cordova", 29 | "ngcordova", 30 | "ng cordova", 31 | "cordova", 32 | "phonegap", 33 | "angular", 34 | "angularjs", 35 | "ionic", 36 | "cordova plugin" 37 | ], 38 | "license": "MIT", 39 | "private": false, 40 | "devDependencies": { 41 | "angular": ">= 1.2.23", 42 | "angular-mocks": ">= 1.2.23", 43 | "jquery": "~2.1.1" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/plugins/emailComposer.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git 2 | // link : https://github.com/katzer/cordova-plugin-email-composer 3 | 4 | angular.module('ngCordova.plugins.emailComposer', []) 5 | 6 | .factory('$cordovaEmailComposer', ['$q', function ($q) { 7 | 8 | return { 9 | isAvailable: function () { 10 | var q = $q.defer(); 11 | 12 | cordova.plugins.email.isAvailable(function (isAvailable) { 13 | if (isAvailable) { 14 | q.resolve(); 15 | } else { 16 | q.reject(); 17 | } 18 | }); 19 | 20 | return q.promise; 21 | }, 22 | 23 | open: function (properties) { 24 | var q = $q.defer(); 25 | 26 | cordova.plugins.email.open(properties, function () { 27 | q.reject(); // user closed email composer 28 | }); 29 | 30 | return q.promise; 31 | }, 32 | 33 | addAlias: function (app, schema) { 34 | cordova.plugins.email.addAlias(app, schema); 35 | } 36 | }; 37 | }]); 38 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngCordova", 3 | "version": "0.1.27-alpha", 4 | "homepage": "http://ngCordova.com/", 5 | "authors": [ 6 | "Max Lynch ", 7 | "Paolo Bernasconi ", 8 | "Chad Campbell " 9 | ], 10 | "description": "AngularJS Cordova wrappers for common Cordova plugins.", 11 | "main": [ 12 | "./dist/ng-cordova.js" 13 | ], 14 | "ignore": [ 15 | "**/.*", 16 | "gulpfile.js", 17 | "test", 18 | "src", 19 | "config", 20 | "demo", 21 | "CONTRIBUTING.md", 22 | "CODE_OF_CONDUCT.md" 23 | ], 24 | "dependencies": { 25 | "angular": ">= 1.2.23" 26 | }, 27 | "keywords": [ 28 | "ngCordova", 29 | "ng-cordova", 30 | "ngcordova", 31 | "ng cordova", 32 | "cordova", 33 | "phonegap", 34 | "angular", 35 | "angularjs", 36 | "ionic", 37 | "cordova plugin" 38 | ], 39 | "license": "MIT", 40 | "private": false, 41 | "devDependencies": { 42 | "angular": ">= 1.2.23", 43 | "angular-mocks": ">= 1.2.23", 44 | "jquery": "~2.1.1" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /demo/www/app/toast/toast.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.toast.ctrl', []) 2 | 3 | 4 | .controller('ToastCtrl', function ($scope, $cordovaToast) { 5 | 6 | $scope.toastMessage = 'enter a message'; 7 | 8 | $scope.center = function (message) { 9 | $cordovaToast.show(message, 'long', 'center') 10 | .then(function (success) { 11 | console.log("center msg displayed"); 12 | }, function (error) { 13 | $scope.msg = error.message; 14 | }); 15 | }; 16 | 17 | $scope.top = function (message) { 18 | 19 | $cordovaToast 20 | .showShortTop(message) 21 | .then(function (success) { 22 | console.log("short top displayed "); 23 | }, function (error) { 24 | $scope.msg = error.message; 25 | }); 26 | }; 27 | 28 | 29 | $scope.bottom = function (message) { 30 | $cordovaToast 31 | .showLongBottom(message) 32 | .then(function (success) { 33 | console.log("long bottom displayed"); 34 | }, function (error) { 35 | $scope.msg = error.message; 36 | }); 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_button-bar.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Button Bar 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .button-bar { 8 | @include display-flex(); 9 | @include flex(1); 10 | width: 100%; 11 | 12 | &.button-bar-inline { 13 | display: block; 14 | width: auto; 15 | 16 | @include clearfix(); 17 | 18 | > .button { 19 | width: auto; 20 | display: inline-block; 21 | float: left; 22 | } 23 | } 24 | } 25 | 26 | .button-bar > .button { 27 | @include flex(1); 28 | display: block; 29 | 30 | overflow: hidden; 31 | 32 | padding: 0 16px; 33 | 34 | width: 0; 35 | 36 | border-width: 1px 0px 1px 1px; 37 | border-radius: 0; 38 | text-align: center; 39 | text-overflow: ellipsis; 40 | white-space: nowrap; 41 | 42 | &:before, 43 | .icon:before { 44 | line-height: 44px; 45 | } 46 | 47 | &:first-child { 48 | border-radius: $button-border-radius 0px 0px $button-border-radius; 49 | } 50 | &:last-child { 51 | border-right-width: 1px; 52 | border-radius: 0px $button-border-radius $button-border-radius 0px; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Drifty 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /test/plugins/vibration.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaVibration', function() { 2 | 3 | var $cordovaVibration; 4 | 5 | beforeEach(module('ngCordova.plugins.vibration')); 6 | 7 | beforeEach(inject(function (_$cordovaVibration_) { 8 | $cordovaVibration = _$cordovaVibration_; 9 | 10 | navigator.notification = jasmine.createSpyObj('notification', ['vibrate', 'vibrateWithPattern', 'cancelVibration']); 11 | })); 12 | 13 | it('should call navigator\'s notification.vibrate method', function() { 14 | $cordovaVibration.vibrate(10); 15 | expect(navigator.notification.vibrate).toHaveBeenCalledWith(10); 16 | }); 17 | 18 | it('should call navigator\'s notification.vibrateWithPattern method', function() { 19 | var pattern = [1, 5, 8]; 20 | $cordovaVibration.vibrateWithPattern(pattern, true); 21 | expect(navigator.notification.vibrateWithPattern).toHaveBeenCalledWith(pattern, true); 22 | }); 23 | 24 | it('should call navigator\'s notification.cancelVibration method', function() { 25 | $cordovaVibration.cancelVibration(); 26 | expect(navigator.notification.cancelVibration).toHaveBeenCalled(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /demo/www/lib/ngCordova/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Drifty 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/mocks/splashscreen.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaSplashscreen 4 | * 5 | * @description 6 | * A service for testing the splash screen 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaSplashscreen', function () { 10 | var isVisible = false; 11 | 12 | return { 13 | /** 14 | * @ngdoc property 15 | * @name isVisible 16 | * @propertyOf ngCordovaMocks.cordovaSplashscreen 17 | * 18 | * @description 19 | * A flag that signals whether the splash screen is visible or not. 20 | * This property should only be used in automated tests. 21 | **/ 22 | isVisible: isVisible, 23 | 24 | hide: function () { 25 | // do nothing. everything happens behind the scenes in this case. 26 | // its a stub that is present for completeness. 27 | this.isVisible = false; 28 | return true; 29 | }, 30 | show: function () { 31 | // do nothing. everything happens behind the scenes in this case. 32 | // its a stub that is present for completeness. 33 | this.isVisible = true; 34 | return true; 35 | } 36 | }; 37 | }); 38 | -------------------------------------------------------------------------------- /src/plugins/keychain.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/shazron/KeychainPlugin.git 2 | // link : https://github.com/shazron/KeychainPlugin 3 | 4 | /* globals Keychain: true */ 5 | angular.module('ngCordova.plugins.keychain', []) 6 | 7 | .factory('$cordovaKeychain', ['$q', function ($q) { 8 | 9 | return { 10 | getForKey: function (key, serviceName) { 11 | var defer = $q.defer(), 12 | kc = new Keychain(); 13 | 14 | kc.getForKey(defer.resolve, defer.reject, key, serviceName); 15 | 16 | return defer.promise; 17 | }, 18 | 19 | setForKey: function (key, serviceName, value) { 20 | var defer = $q.defer(), 21 | kc = new Keychain(); 22 | 23 | kc.setForKey(defer.resolve, defer.reject, key, serviceName, value); 24 | 25 | return defer.promise; 26 | }, 27 | 28 | removeForKey: function (key, serviceName) { 29 | var defer = $q.defer(), 30 | kc = new Keychain(); 31 | 32 | kc.removeForKey(defer.resolve, defer.reject, key, serviceName); 33 | 34 | return defer.promise; 35 | } 36 | }; 37 | }]); 38 | -------------------------------------------------------------------------------- /test/plugins/batteryStatus.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaBatteryStatus', function () { 2 | 3 | var $cordovaBatteryStatus, $rootScope; 4 | 5 | var eventNames = ['batterystatus', 'batterycritical', 'batterylow']; 6 | 7 | beforeEach(module('ngCordova.plugins.batteryStatus')); 8 | 9 | beforeEach(inject(function (_$cordovaBatteryStatus_, _$q_, _$rootScope_) { 10 | $cordovaBatteryStatus = _$cordovaBatteryStatus_; 11 | $rootScope = _$rootScope_; 12 | })); 13 | 14 | for (var i = 0; i < eventNames.length; i++) { 15 | (function (eventName) { 16 | it('should broadcast the `' + eventName + '` event the right way', function () { 17 | 18 | spyOn($rootScope, '$broadcast').and.callThrough(); 19 | 20 | var result = {'isPlugged': true, 'level': 1}; 21 | 22 | var event = document.createEvent("CustomEvent"); 23 | event.initCustomEvent(eventName, false, false, result); 24 | 25 | window.dispatchEvent(event); 26 | 27 | // expect($cordovaBatteryStatus.$broadcast).toHaveBeenCalledWith(eventName, result); // refractor out -- cannot test events in jasmine 28 | }); 29 | })(eventNames[i]); 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /demo/www/app/deviceMotion/deviceMotion.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.deviceMotion.ctrl', []) 2 | 3 | .controller('DeviceMotionCtrl', function ($scope, $cordovaDeviceMotion) { 4 | var watchID; 5 | 6 | $cordovaDeviceMotion 7 | .getCurrentAcceleration() 8 | .then(function (motion) { 9 | $scope.motion = motion; 10 | console.log(motion); 11 | }, function (err) { 12 | $scope.msg = err.message; 13 | console.log(err); 14 | }); 15 | 16 | 17 | $scope.watchAcceleration = function () { 18 | var options = { frequency: 3000 }; // Update every 3 seconds 19 | 20 | $scope.this_watch = $cordovaDeviceMotion.watchAcceleration(options); 21 | 22 | $scope.this_watch.promise.then( 23 | function () { /* unused */ 24 | }, 25 | function (err) { 26 | $scope.msg = err.message; 27 | }, 28 | function (motion) { 29 | $scope.motion = motion; 30 | }); 31 | }; 32 | 33 | $scope.clearWatch = function () { 34 | // use watchID from watchAccelaration() 35 | $cordovaDeviceMotion.clearWatch($scope.this_watch.watchId); 36 | }; 37 | }); 38 | 39 | -------------------------------------------------------------------------------- /demo/www/app/inAppBrowser/inAppBrowser.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.inAppBrowser.ctrl', []) 2 | 3 | .controller('InAppBrowserCtrl', function ($scope, $rootScope, $cordovaInAppBrowser) { 4 | $scope.openBrowser = function () { 5 | document.addEventListener('deviceready', function () { 6 | 7 | var options = { 8 | location: "no" 9 | }; 10 | 11 | $cordovaInAppBrowser.open('http://ngcordova.com', '_blank', options).then(function () { 12 | console.log("InAppBrowser opened http://ngcordova.com successfully"); 13 | }, function (error) { 14 | console.log("Error: " + error); 15 | }); 16 | 17 | }, false); 18 | }; 19 | 20 | document.addEventListener('deviceready', function () { 21 | 22 | $rootScope.$on("$cordovaInAppBrowser:exit", function (event, result) { 23 | alert("Exited Browser"); 24 | console.log(JSON.stringify(result)); 25 | }); 26 | 27 | 28 | $rootScope.$on("$cordovaInAppBrowser:loadstop", function (event, result) { 29 | alert("Load Stop event"); 30 | console.log(JSON.stringify(result)); 31 | }) 32 | }, false); 33 | 34 | }); 35 | -------------------------------------------------------------------------------- /demo/www/app/fileTransfer/fileTransfer.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.fileTransfer.ctrl', []) 2 | 3 | .controller('FileTransferCtrl', function ($scope, $rootScope, $cordovaFileTransfer, $timeout) { 4 | 5 | $scope.downloadFile = function () { 6 | document.addEventListener('deviceready', function () { 7 | var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg"; 8 | var fileDir = cordova.file.documentsDirectory + "testImage.png"; 9 | 10 | var download = $cordovaFileTransfer.download(url, fileDir).then(function (success) { 11 | console.log("success " + JSON.stringify(success)); 12 | $timeout(function () { 13 | $scope.downloadProgress = 100 14 | }, 1000); 15 | }, function (error) { 16 | console.log("Error " + JSON.stringify(error)); 17 | }, function (progress) { 18 | $timeout(function () { 19 | $scope.downloadProgress = (progress.loaded / progress.total) * 100; 20 | 21 | }); 22 | }); 23 | 24 | 25 | if ($scope.downloadProgress > 0.1) { 26 | download.abort(); 27 | } 28 | }) 29 | }; 30 | 31 | 32 | }); 33 | -------------------------------------------------------------------------------- /demo/www/app/upsPushNotifications/pushNotifications.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 8 | 12 | 16 | 20 |
21 | 24 |
25 |
26 | -------------------------------------------------------------------------------- /test/mocks/actionSheet.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaActionSheet', function() { 7 | var $rootScope = null; 8 | var $cordovaActionSheet = null; 9 | var options = {}; 10 | 11 | beforeEach(inject(function (_$cordovaActionSheet_, _$rootScope_) { 12 | $cordovaActionSheet = _$cordovaActionSheet_; 13 | $rootScope = _$rootScope_; 14 | })); 15 | 16 | it('should be able to show', function(done) { 17 | $cordovaActionSheet 18 | .show(options) 19 | .then( 20 | function() { expect(true).toBe(true) }, 21 | function() { expect(false).toBe(true) } 22 | ) 23 | .finally(function() { done(); }); 24 | 25 | $rootScope.$digest(); 26 | }); 27 | 28 | it('should throws error when trying to show action sheet', function(done) { 29 | $cordovaActionSheet.throwsError = true; 30 | $cordovaActionSheet 31 | .show(options) 32 | .then( 33 | function() { expect(false).toBe(true) }, 34 | function() { expect(true).toBe(true) } 35 | ) 36 | .finally(function() { done(); }); 37 | 38 | $rootScope.$digest(); 39 | }); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /demo/www/app/deviceOrientation/deviceOrientation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | Compass Tool 7 |
8 | 9 |
10 | Magnetic Heading   {{heading.magneticHeading}} 11 |
12 |
13 | True Heading   {{heading.trueHeading}} 14 |
15 |
16 | Accuracy   {{heading.headingAccuracy}} 17 |
18 |
19 | Timestamp   {{heading.timestamp}} 20 |
21 |
22 | 23 | 24 |
25 | 28 | 29 |
30 | 33 | 34 | 37 |
38 |
39 |
40 |
41 | -------------------------------------------------------------------------------- /demo/www/lib/angular-ui-router/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 The AngularUI Team, Karsten Sperling 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /demo/www/lib/angular-ui-router/src/stateFilters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc filter 3 | * @name ui.router.state.filter:isState 4 | * 5 | * @requires ui.router.state.$state 6 | * 7 | * @description 8 | * Translates to {@link ui.router.state.$state#methods_is $state.is("stateName")}. 9 | */ 10 | $IsStateFilter.$inject = ['$state']; 11 | function $IsStateFilter($state) { 12 | var isFilter = function (state) { 13 | return $state.is(state); 14 | }; 15 | isFilter.$stateful = true; 16 | return isFilter; 17 | } 18 | 19 | /** 20 | * @ngdoc filter 21 | * @name ui.router.state.filter:includedByState 22 | * 23 | * @requires ui.router.state.$state 24 | * 25 | * @description 26 | * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}. 27 | */ 28 | $IncludedByStateFilter.$inject = ['$state']; 29 | function $IncludedByStateFilter($state) { 30 | var includesFilter = function (state) { 31 | return $state.includes(state); 32 | }; 33 | includesFilter.$stateful = true; 34 | return includesFilter; 35 | } 36 | 37 | angular.module('ui.router.state') 38 | .filter('isState', $IsStateFilter) 39 | .filter('includedByState', $IncludedByStateFilter); 40 | -------------------------------------------------------------------------------- /test/plugins/barcodeScanner.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaBarcodeScanner', function () { 2 | 3 | var $cordovaBarcodeScanner, $rootScope; 4 | window.cordova = { 5 | plugins: { 6 | barcodeScanner : {} 7 | } 8 | }; 9 | 10 | beforeEach(module('ngCordova.plugins.barcodeScanner')); 11 | 12 | beforeEach(inject(function (_$cordovaBarcodeScanner_, _$q_, _$rootScope_) { 13 | $cordovaBarcodeScanner = _$cordovaBarcodeScanner_; 14 | $rootScope = _$rootScope_; 15 | 16 | cordova.plugins.barcodeScanner = { 17 | scan: angular.noop, 18 | encode: angular.noop 19 | }; 20 | 21 | })); 22 | 23 | 24 | it('should call cordova.plugins.barcodeScanner scan method', function () { 25 | 26 | var result; 27 | var imageData = {data: '123456789'}; 28 | 29 | spyOn(cordova.plugins.barcodeScanner, 'scan') 30 | .and.callFake(function (successCb, errorCb) { 31 | successCb(imageData); 32 | }); 33 | 34 | $cordovaBarcodeScanner 35 | .scan() 36 | .then(function (response) { 37 | result = response; 38 | }); 39 | 40 | $rootScope.$digest(); 41 | 42 | expect(result).toBe(imageData); 43 | }); 44 | 45 | 46 | }); 47 | -------------------------------------------------------------------------------- /demo/www/app/batteryStatus/batteryStatus.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.batteryStatus.ctrl', []) 2 | 3 | .controller('BatteryStatusCtrl', function ($scope, $timeout, $cordovaBatteryStatus) { 4 | 5 | console.log("battery status init"); 6 | 7 | document.addEventListener("deviceready", function () { 8 | $scope.watch = function () { 9 | console.log("watching battery"); 10 | $cordovaBatteryStatus.$on('batterystatus', function (result, info) { 11 | $timeout(function () { 12 | $scope.batteryLevel = info.level; // (0 - 100) 13 | $scope.isPluggedIn = info.isPlugged; // bool 14 | }); 15 | alert("Info " + info.level + " " + info.isPlugged); 16 | }); 17 | }; 18 | }, false); 19 | 20 | 21 | /* 22 | $cordovaBatteryStatus.$on('batterycritical', function (result) { 23 | $scope.batteryLevel = result.level; // (0 - 100) 24 | $scope.isPluggedIn = result.isPlugged; // bool 25 | }); 26 | 27 | $cordovaBatteryStatus.$on('batterylow', function (result) { 28 | $scope.batteryLevel = result.level; // (0 - 100) 29 | $scope.isPluggedIn = result.isPlugged; // bool 30 | }); 31 | */ 32 | }); 33 | -------------------------------------------------------------------------------- /demo/www/app/deviceOrientation/deviceOrientation.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.deviceOrientation.ctrl', []) 2 | 3 | .controller('DeviceOrientationCtrl', function ($scope, $timeout, $cordovaDeviceOrientation) { 4 | 5 | var options = {frequency: 1000}; // Update every 1 seconds 6 | 7 | $scope.getHeading = function () { 8 | $cordovaDeviceOrientation 9 | .getCurrentHeading() 10 | .then(function (position) { 11 | $scope.heading = position; 12 | }, function (err) { 13 | $scope.msg = err.message; 14 | }); 15 | }; 16 | 17 | 18 | $scope.watchHeading = function () { 19 | $scope.this_watch = $cordovaDeviceOrientation.watchHeading(options); 20 | 21 | $scope.this_watch.then( 22 | function () { 23 | /* unused */ 24 | }, 25 | function (err) { 26 | $scope.msg = err.message; 27 | }, 28 | function (position) { 29 | $timeout(function () { 30 | $scope.heading = position; 31 | }); 32 | } 33 | ); 34 | 35 | }; 36 | 37 | $scope.clearWatch = function () { 38 | $cordovaDeviceOrientation.clearWatch($scope.this_watch.watchID); 39 | }; 40 | 41 | }); 42 | -------------------------------------------------------------------------------- /demo/www/app/facebook/facebook.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
Login info
7 | 8 |
{{info}}
9 | 10 | 11 |
12 |
Login Info
13 |
{{info}}
14 |
15 | 16 | 17 | 18 |
19 |
Login Status
20 |
{{info}}
21 |
22 | 23 | 24 | 25 |
Api Me info
26 | 27 |
28 |
Api Me info
29 |
{{info}}
30 |
31 | 32 | 33 | 34 | 35 |
36 |
37 | -------------------------------------------------------------------------------- /demo/www/app/facebook/facebook.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.facebook.ctrl', []) 2 | 3 | .controller('FacebookCtrl', function ($scope, $log, $cordovaFacebook) { 4 | 5 | 6 | $scope.getLoginStatus = function () { 7 | $cordovaFacebook.getLoginStatus().then(function (status) { 8 | $scope.status = status; 9 | }, function (error) { 10 | $scope.status = error; 11 | }) 12 | }; 13 | 14 | $scope.login = function () { 15 | $cordovaFacebook.login(["public_profile"]).then(function (success) { 16 | $scope.loginInfo = success; 17 | }, function (error) { 18 | $scope.error = error; 19 | alert(error); 20 | }) 21 | }; 22 | 23 | 24 | $scope.logout = function () { 25 | $cordovaFacebook.logout().then(function (success) { 26 | console.log(success); 27 | }, function (error) { 28 | $scope.error = error; 29 | alert(error); 30 | }) 31 | }; 32 | 33 | $scope.getMe = function () { 34 | $scope.me = ["refreshing..."]; 35 | $cordovaFacebook.api("me", null).then(function (success) { 36 | $scope.me = success; 37 | }, function (error) { 38 | $scope.error = error; 39 | }) 40 | }; 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/plugins/pinDialog.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaPinDialog', function() { 2 | 3 | var $cordovaPinDialog, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.pinDialog')); 6 | 7 | beforeEach(inject(function (_$cordovaPinDialog_, _$q_, _$rootScope_) { 8 | $cordovaPinDialog = _$cordovaPinDialog_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.plugins = { 12 | pinDialog: { 13 | prompt: angular.noop 14 | } 15 | }; 16 | })); 17 | 18 | it('should call window\'s pinDialog.prompt method', function() { 19 | 20 | var result; 21 | 22 | spyOn(window.plugins.pinDialog, 'prompt') 23 | .and.callFake(function (message, callback, title, buttons) { 24 | callback({ 25 | buttonIndex: 2 26 | }); 27 | }); 28 | 29 | $cordovaPinDialog 30 | .prompt('some message', 'some title', ['OK', 'Cancel']) 31 | .then(function (response) { 32 | result = response; 33 | }); 34 | 35 | $rootScope.$digest(); 36 | 37 | expect(result.buttonIndex === 2).toBe(true); 38 | expect(window.plugins.pinDialog.prompt).toHaveBeenCalledWith( 39 | 'some message', jasmine.any(Function), 'some title', ['OK', 'Cancel'] 40 | ); 41 | }); 42 | 43 | }); 44 | -------------------------------------------------------------------------------- /demo/www/app/emailComposer/emailComposer.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.emailComposer.ctrl', []) 2 | 3 | .controller('EmailComposerCtrl', function ($scope, $cordovaEmailComposer) { 4 | 5 | document.addEventListener("deviceready", function () { 6 | $cordovaEmailComposer.isAvailable().then(function () { 7 | alert("Email composer is available") 8 | }, function () { 9 | alert("Email composer is NOT available") 10 | }); 11 | }, false); 12 | 13 | 14 | 15 | $cordovaEmailComposer.isAvailable().then(function () { 16 | // is available 17 | }, function () { 18 | // not available 19 | }); 20 | 21 | var email = { 22 | to: 'max@mustermann.de', 23 | cc: 'erika@mustermann.de', 24 | bcc: ['john@doe.com', 'jane@doe.com'], 25 | attachments: [ 26 | 'file://img/logo.png', 27 | 'res://icon.png', 28 | 'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...', 29 | 'file://README.pdf' 30 | ], 31 | subject: 'Cordova Icons', 32 | body: 'How are you? Nice greetings from Leipzig', 33 | isHtml: true 34 | }; 35 | 36 | $cordovaEmailComposer.open(email).then(null, function () { 37 | // user cancelled email 38 | }); 39 | 40 | 41 | }); 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng-cordova", 3 | "private": false, 4 | "main": "dist/ng-cordova", 5 | "version": "0.1.27-alpha", 6 | "repository": { 7 | "url": "git://github.com/driftyco/ng-cordova.git" 8 | }, 9 | "devDependencies": { 10 | "gulp": "^3.7.0", 11 | "gulp-concat": "^2.2.0", 12 | "gulp-footer": "^1.0.4", 13 | "gulp-header": "^1.0.2", 14 | "gulp-jscs": "^1.6.0", 15 | "gulp-jshint": "^1.6.1", 16 | "gulp-prettify": "^0.3.0", 17 | "gulp-rename": "^1.2.0", 18 | "gulp-shell": "^0.2.10", 19 | "gulp-uglify": "^0.2.1", 20 | "jasmine-core": "^2.4.1", 21 | "jshint-stylish": "^0.4.0", 22 | "karma": "^0.13.21", 23 | "karma-chrome-launcher": "~0.2.2", 24 | "karma-coverage": "~0.5.3", 25 | "karma-jasmine": "~0.3.7", 26 | "karma-phantomjs-launcher": "~1.0.0", 27 | "minimist": "^0.1.0", 28 | "phantomjs-prebuilt": "^2.1.4" 29 | }, 30 | "licenses": [ 31 | { 32 | "type": "MIT" 33 | } 34 | ], 35 | "scripts": { 36 | "test": "gulp lint && gulp karma --browsers=PhantomJS --reporters=progress" 37 | }, 38 | "dependencies": { 39 | "conventional-changelog": "0.0.11", 40 | "fs": "0.0.2", 41 | "gulp-git": "^1.2.4", 42 | "q": "^1.1.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /demo/www/app/deviceMotion/deviceMotion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 | Acceleration 7 |
8 |
9 | {{msg}} 10 |
11 |
12 | X   {{motion.x}} 13 |
14 |
15 | Y   {{motion.y}} 16 |
17 | 18 |
19 | Z   {{motion.z}} 20 |
21 |
22 | Time   {{motion.timestamp}} 23 |
24 |
25 | 26 |
27 | 30 | 31 |
32 | 35 | 36 | 39 |
40 |
41 | 42 |
43 |
44 | -------------------------------------------------------------------------------- /test/plugins/network.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaNetwork', function() { 2 | 3 | var $cordovaNetwork; 4 | 5 | beforeEach(module('ngCordova.plugins.network')); 6 | 7 | beforeEach(inject(function (_$cordovaNetwork_) { 8 | $cordovaNetwork = _$cordovaNetwork_; 9 | 10 | window.Connection = { 11 | UNKNOWN: 'UNKNOWN', 12 | NONE: 'NONE', 13 | CELL_2G: 'CELL_2G' 14 | }; 15 | 16 | navigator.connection = { 17 | type: window.Connection.NONE 18 | }; 19 | })); 20 | 21 | it('should return the network type', function() { 22 | expect($cordovaNetwork.getNetwork()).toBe(window.Connection.NONE); 23 | }); 24 | 25 | it('should return isOnline as true when it\'s not NONE or UNKNOWN', function() { 26 | navigator.connection.type = window.Connection.CELL_2G; 27 | expect($cordovaNetwork.isOnline()).toBe(true); 28 | navigator.connection.type = window.Connection.UNKNOWN; 29 | expect($cordovaNetwork.isOnline()).toBe(false); 30 | }); 31 | 32 | it('should return ifOffline when it\'s NONE or UNKNOWN', function() { 33 | expect($cordovaNetwork.isOffline()).toBe(true); 34 | navigator.connection.type = window.Connection.UNKNOWN; 35 | expect($cordovaNetwork.isOffline()).toBe(true); 36 | }); 37 | 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /demo/www/app/preferences/preferences.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.preferences.ctrl', []) 2 | 3 | .controller('PreferencesCtrl', function ($scope, $log, $cordovaPreferences) { 4 | 5 | var key = 'exampleKey'; 6 | $scope.data = {}; 7 | $scope.data.showMore = false; 8 | $scope.data.key = key; 9 | 10 | $scope.preferencesSet = function () { 11 | $cordovaPreferences.set(key, $scope.data.value) 12 | .then(function (result) { 13 | if (result) { 14 | $log.log(key + ' was succesfully set to:', $scope.data.value); 15 | $scope.data.showMore = true; 16 | } else { 17 | $log.log(key + ' was not set to: ' + $scope.data.value + ' we got ', result); 18 | } 19 | }, function (err) { 20 | $log.log(key + ' was not set to: ' + $scope.data.value + ' due to', err); 21 | }); 22 | }; 23 | 24 | $scope.preferencesGet = function () { 25 | $cordovaPreferences.get(key) 26 | .then(function (value) { 27 | $log.log(key + ' get was succesfully:', value); 28 | $scope.data.pref = value; 29 | }, function (err) { 30 | $log.log(key + ' get was not succesfully: ' + $scope.data.value + ' due to', err); 31 | }); 32 | }; 33 | }); 34 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ionic", 3 | "version": "1.0.0-beta.14", 4 | "codename": "magnesium-mongoose", 5 | "homepage": "https://github.com/driftyco/ionic", 6 | "authors": [ 7 | "Max Lynch ", 8 | "Adam Bradley ", 9 | "Ben Sperry " 10 | ], 11 | "description": "Advanced HTML5 hybrid mobile app development framework.", 12 | "main": [ 13 | "css/ionic.css", 14 | "fonts/*", 15 | "js/ionic.js", 16 | "js/ionic-angular.js" 17 | ], 18 | "keywords": [ 19 | "mobile", 20 | "html5", 21 | "ionic", 22 | "cordova", 23 | "phonegap", 24 | "trigger", 25 | "triggerio", 26 | "angularjs", 27 | "angular" 28 | ], 29 | "license": "MIT", 30 | "private": false, 31 | "dependencies": { 32 | "angular": "1.3.6", 33 | "angular-animate": "1.3.6", 34 | "angular-sanitize": "1.3.6", 35 | "angular-ui-router": "0.2.13" 36 | }, 37 | "_release": "1.0.0-beta.14", 38 | "_resolution": { 39 | "type": "version", 40 | "tag": "v1.0.0-beta.14", 41 | "commit": "a6aa20bf5361b24bdbaeb34295a5f1c0e6aa609c" 42 | }, 43 | "_source": "git://github.com/driftyco/ionic-bower.git", 44 | "_target": "1.0.0-beta.14", 45 | "_originalSource": "driftyco/ionic-bower" 46 | } -------------------------------------------------------------------------------- /test/plugins/dialogs.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaDialogs', function () { 2 | 3 | var $cordovaDialogs, $rootScope, $window; 4 | 5 | beforeEach(module('ngCordova.plugins.dialogs')); 6 | 7 | beforeEach(inject(function (_$cordovaDialogs_, _$q_, _$rootScope_, _$window_) { 8 | $cordovaDialogs = _$cordovaDialogs_; 9 | $rootScope = _$rootScope_; 10 | $window = _$window_; 11 | 12 | navigator.notification = { 13 | alert: angular.noop, 14 | confirm: angular.noop, 15 | prompt: angular.noop, 16 | beep: angular.noop 17 | }; 18 | 19 | })); 20 | 21 | it('should call navigators\'s navigator.notification.alert method', function () { 22 | 23 | var result; 24 | var message = "Some message"; 25 | var title = "Title"; 26 | var buttonName = "Okay"; 27 | 28 | spyOn(navigator.notification, 'alert') 29 | .and.callFake(function (message, successCb, title, buttonName) { 30 | successCb(); 31 | }); 32 | 33 | $cordovaDialogs 34 | .alert(message, title, buttonName) 35 | .then(function () { 36 | result = "success"; 37 | }); 38 | 39 | $rootScope.$digest(); 40 | 41 | expect(result).toBe("success"); 42 | }); 43 | 44 | 45 | // TODO: Still missing tests for confirm, prompt, beep 46 | }); 47 | -------------------------------------------------------------------------------- /test/plugins/screenshot.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaScreenshot', function() { 2 | 3 | var $cordovaScreenshot, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.screenshot')); 6 | 7 | beforeEach(inject(function (_$cordovaScreenshot_, _$q_, _$rootScope_) { 8 | $cordovaScreenshot = _$cordovaScreenshot_; 9 | $rootScope = _$rootScope_; 10 | 11 | navigator.screenshot = { 12 | save: angular.noop, 13 | URI: angular.noop, 14 | }; 15 | })); 16 | 17 | it('should call return null when navigator.screenshot is undefined when capturing to file', function() { 18 | 19 | navigator.screenshot = undefined; 20 | 21 | $cordovaScreenshot 22 | .captureToFile({}) 23 | .then(function (response) { 24 | result = response; 25 | }); 26 | 27 | $rootScope.$digest(); 28 | 29 | expect(result).toBe(null); 30 | }); 31 | 32 | it('should call return null when navigator.screenshot is undefined when capturing to dataURI', function() { 33 | 34 | navigator.screenshot = undefined; 35 | 36 | $cordovaScreenshot 37 | .captureToUri({}) 38 | .then(function (response) { 39 | result = response; 40 | }); 41 | 42 | $rootScope.$digest(); 43 | 44 | expect(result).toBe(null); 45 | }); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /src/plugins/touchid.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/leecrossley/cordova-plugin-touchid.git 2 | // link : https://github.com/leecrossley/cordova-plugin-touchid 3 | 4 | /* globals touchid: true */ 5 | angular.module('ngCordova.plugins.touchid', []) 6 | 7 | .factory('$cordovaTouchID', ['$q', function ($q) { 8 | 9 | return { 10 | checkSupport: function () { 11 | var defer = $q.defer(); 12 | if (!window.cordova) { 13 | defer.reject('Not supported without cordova.js'); 14 | } else { 15 | touchid.checkSupport(function (value) { 16 | defer.resolve(value); 17 | }, function (err) { 18 | defer.reject(err); 19 | }); 20 | } 21 | 22 | return defer.promise; 23 | }, 24 | 25 | authenticate: function (authReasonText) { 26 | var defer = $q.defer(); 27 | if (!window.cordova) { 28 | defer.reject('Not supported without cordova.js'); 29 | } else { 30 | touchid.authenticate(function (value) { 31 | defer.resolve(value); 32 | }, function (err) { 33 | defer.reject(err); 34 | }, authReasonText); 35 | } 36 | 37 | return defer.promise; 38 | } 39 | }; 40 | }]); 41 | -------------------------------------------------------------------------------- /test/mocks/datePicker.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function () { 2 | beforeEach(function () { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaDatePicker', function () { 7 | var $cordovaDatePicker = null, 8 | $rootScope = null; 9 | 10 | beforeEach(inject(function (_$cordovaDatePicker_, _$rootScope_) { 11 | $cordovaDatePicker = _$cordovaDatePicker_; 12 | $rootScope = _$rootScope_; 13 | })); 14 | 15 | it('should show a date picker', function () { 16 | var result, 17 | dummyDate = new Date(), 18 | options = { 19 | date: dummyDate, 20 | mode: 'date' 21 | }; 22 | 23 | $cordovaDatePicker 24 | .show(options) 25 | .then(function (response) { 26 | result = response; 27 | }); 28 | 29 | $rootScope.$digest(); 30 | 31 | expect(result).toBe(dummyDate); 32 | }); 33 | 34 | it('should have default options if none are passed', function() { 35 | var result; 36 | 37 | $cordovaDatePicker 38 | .show() 39 | .then(function (response) { 40 | result = response; 41 | }); 42 | 43 | $rootScope.$digest(); 44 | 45 | expect(result instanceof Date).toBeTruthy(); 46 | }); 47 | 48 | }); 49 | }) 50 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_menu.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Menus 4 | * -------------------------------------------------- 5 | * Side panel structure 6 | */ 7 | 8 | .menu { 9 | position: absolute; 10 | top: 0; 11 | bottom: 0; 12 | z-index: $z-index-menu; 13 | overflow: hidden; 14 | 15 | min-height: 100%; 16 | max-height: 100%; 17 | width: $menu-width; 18 | 19 | background-color: $menu-bg; 20 | 21 | .scroll-content { 22 | z-index: $z-index-menu-scroll-content; 23 | } 24 | 25 | .bar-header { 26 | z-index: $z-index-menu-bar-header; 27 | } 28 | } 29 | 30 | .menu-content { 31 | @include transform(none); 32 | box-shadow: $menu-side-shadow; 33 | } 34 | 35 | .menu-open .menu-content .pane, 36 | .menu-open .menu-content .scroll-content { 37 | pointer-events: none; 38 | } 39 | 40 | .grade-b .menu-content, 41 | .grade-c .menu-content { 42 | @include box-sizing(content-box); 43 | right: -1px; 44 | left: -1px; 45 | border-right: 1px solid #ccc; 46 | border-left: 1px solid #ccc; 47 | box-shadow: none; 48 | } 49 | 50 | .menu-left { 51 | left: 0; 52 | } 53 | 54 | .menu-right { 55 | right: 0; 56 | } 57 | 58 | .aside-open.aside-resizing .menu-right { 59 | display: none; 60 | } 61 | 62 | .menu-animated { 63 | @include transition-transform($menu-animation-speed ease); 64 | } 65 | -------------------------------------------------------------------------------- /src/mocks/googleAnalytics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaGoogleAnalytics 4 | * 5 | * @description 6 | * A service for testing google analytics services 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaGoogleAnalytics', ['$q', function ($q) { 10 | var throwsError = false; 11 | var methods = {}; 12 | 13 | /** 14 | * @ngdoc property 15 | * @name throwsError 16 | * @propertyOf ngCordovaMocks.cordovaGeolocation 17 | * 18 | * @description 19 | * A flag that signals whether a promise should be rejected or not. 20 | * This property should only be used in automated tests. 21 | **/ 22 | methods.throwsError = throwsError; 23 | 24 | var methodsName = [ 25 | 'startTrackerWithId', 26 | 'setUserId', 27 | 'debugMode', 28 | 'trackView', 29 | 'addCustomDimension', 30 | 'trackEvent', 31 | 'trackException', 32 | 'trackTiming', 33 | 'addTransaction', 34 | 'addTransactionItem' 35 | ]; 36 | 37 | methodsName.forEach(function (funcName) { 38 | methods[funcName] = function () { 39 | var defer = $q.defer(); 40 | 41 | (this.throwsError) ? 42 | defer.reject() : 43 | defer.resolve(); 44 | 45 | return defer.promise; 46 | }; 47 | }); 48 | 49 | return methods; 50 | }]); 51 | -------------------------------------------------------------------------------- /src/plugins/appVersion.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/whiteoctober/cordova-plugin-app-version.git 2 | // link : https://github.com/whiteoctober/cordova-plugin-app-version 3 | 4 | angular.module('ngCordova.plugins.appVersion', []) 5 | 6 | .factory('$cordovaAppVersion', ['$q', function ($q) { 7 | 8 | return { 9 | getAppName: function () { 10 | var q = $q.defer(); 11 | cordova.getAppVersion.getAppName(function (name) { 12 | q.resolve(name); 13 | }); 14 | 15 | return q.promise; 16 | }, 17 | 18 | getPackageName: function () { 19 | var q = $q.defer(); 20 | cordova.getAppVersion.getPackageName(function (pack) { 21 | q.resolve(pack); 22 | }); 23 | 24 | return q.promise; 25 | }, 26 | 27 | getVersionNumber: function () { 28 | var q = $q.defer(); 29 | cordova.getAppVersion.getVersionNumber(function (version) { 30 | q.resolve(version); 31 | }); 32 | 33 | return q.promise; 34 | }, 35 | 36 | getVersionCode: function () { 37 | var q = $q.defer(); 38 | cordova.getAppVersion.getVersionCode(function (code) { 39 | q.resolve(code); 40 | }); 41 | 42 | return q.promise; 43 | } 44 | }; 45 | }]); 46 | -------------------------------------------------------------------------------- /src/plugins/fileOpener2.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2.git 2 | // link : https://github.com/pwlin/cordova-plugin-file-opener2 3 | 4 | angular.module('ngCordova.plugins.fileOpener2', []) 5 | 6 | .factory('$cordovaFileOpener2', ['$q', function ($q) { 7 | 8 | return { 9 | open: function (file, type) { 10 | var q = $q.defer(); 11 | cordova.plugins.fileOpener2.open(file, type, { 12 | error: function (e) { 13 | q.reject(e); 14 | }, success: function () { 15 | q.resolve(); 16 | } 17 | }); 18 | return q.promise; 19 | }, 20 | 21 | uninstall: function (pack) { 22 | var q = $q.defer(); 23 | cordova.plugins.fileOpener2.uninstall(pack, { 24 | error: function (e) { 25 | q.reject(e); 26 | }, success: function () { 27 | q.resolve(); 28 | } 29 | }); 30 | return q.promise; 31 | }, 32 | 33 | appIsInstalled: function (pack) { 34 | var q = $q.defer(); 35 | cordova.plugins.fileOpener2.appIsInstalled(pack, { 36 | success: function (res) { 37 | q.resolve(res); 38 | } 39 | }); 40 | return q.promise; 41 | } 42 | }; 43 | }]); 44 | -------------------------------------------------------------------------------- /demo/www/app/globalization/globalization.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.globalization.ctrl', []) 2 | 3 | .controller('GlobalizationCtrl', function ($scope, $cordovaGlobalization) { 4 | 5 | 6 | function init() { 7 | $cordovaGlobalization.getPreferredLanguage().then( 8 | function (result) { 9 | $scope.language = result.value; 10 | }, 11 | function (error) { 12 | $scope.language = err.message; 13 | }); 14 | 15 | $cordovaGlobalization.getLocaleName().then( 16 | function (result) { 17 | $scope.locale = result.value; 18 | }, 19 | function (error) { 20 | $scope.locale = err.message; 21 | }); 22 | 23 | $cordovaGlobalization.getFirstDayOfWeek().then( 24 | function (result) { 25 | $scope.fdow = result.value; 26 | }, 27 | function (error) { 28 | $scope.fdow = err.message; 29 | }); 30 | } 31 | 32 | $scope.refresh = function () { 33 | init(); 34 | }; 35 | 36 | 37 | init(); 38 | 39 | 40 | // Soon implemented: 41 | // dateToString 42 | // stringToDate 43 | // getDatePattern 44 | // getDateNames 45 | // isDayLightSavingsTime 46 | // numberToString 47 | // stringToNumber 48 | // getNumberPattern 49 | // getCurrencyPattern 50 | }); 51 | -------------------------------------------------------------------------------- /src/mocks/fileTransfer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaFileTransfer 4 | * 5 | * @description 6 | * A service for testing download and upload 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaFileTransfer', ['$q', function ($q) { 10 | var throwsError = false; 11 | 12 | var mockIt = function (errorMessage) { 13 | var defer = $q.defer(); 14 | if (this.throwsError) { 15 | defer.reject(errorMessage); 16 | } else { 17 | defer.resolve(); 18 | } 19 | return defer.promise; 20 | }; 21 | 22 | return { 23 | /** 24 | * @ngdoc property 25 | * @name throwsError 26 | * @propertyOf ngCordovaMocks.cordovaFileTransfer 27 | * 28 | * @description 29 | * A flag that signals whether a promise should be rejected or not. 30 | * This property should only be used in automated tests. 31 | **/ 32 | throwsError: throwsError, 33 | 34 | download: function (source, filePath, options, trust) { 35 | return mockIt.call(this, 'There was an error downloading the file.'); 36 | }, 37 | 38 | upload: function (server, filePath, options) { 39 | return mockIt.call(this, 'There was an error uploading the file.'); 40 | } 41 | }; 42 | }]); 43 | -------------------------------------------------------------------------------- /test/plugins/spinnerDialog.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaSpinnerDialog', function() { 2 | 3 | var $cordovaSpinnerDialog; 4 | 5 | beforeEach(module('ngCordova.plugins.spinnerDialog')); 6 | 7 | beforeEach(inject(function (_$cordovaSpinnerDialog_) { 8 | $cordovaSpinnerDialog = _$cordovaSpinnerDialog_; 9 | 10 | window.plugins = { 11 | spinnerDialog: jasmine.createSpyObj('spinnerDialog', ['hide', 'show']) 12 | } 13 | })); 14 | 15 | it('should call window.plugins\'s spinnerDialog.show method with options', function() { 16 | $cordovaSpinnerDialog.show('hi', 'nice hi message', true, {overlayOpacity: 0.75, textColorRed: 1, textColorGreen: 0, textColorBlue: 0.4}); 17 | expect(window.plugins.spinnerDialog.show).toHaveBeenCalledWith('hi', 'nice hi message', true, {overlayOpacity: 0.75, textColorRed: 1, textColorGreen: 0, textColorBlue: 0.4}); 18 | }); 19 | 20 | it('should call window.plugins\'s spinnerDialog.show method without options', function() { 21 | $cordovaSpinnerDialog.show('hi', 'nice hi message', true); 22 | expect(window.plugins.spinnerDialog.show).toHaveBeenCalledWith('hi', 'nice hi message', true, undefined); 23 | }); 24 | 25 | it('should call window.plugins\'s spinnerDialog.hide', function() { 26 | $cordovaSpinnerDialog.hide(); 27 | expect(window.plugins.spinnerDialog.hide).toHaveBeenCalled(); 28 | }); 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_animations.scss: -------------------------------------------------------------------------------- 1 | 2 | // Slide up from the bottom, used for modals 3 | // ------------------------------- 4 | 5 | .slide-in-up { 6 | @include translate3d(0, 100%, 0); 7 | } 8 | .slide-in-up.ng-enter, 9 | .slide-in-up > .ng-enter { 10 | @include transition(all cubic-bezier(.1, .7, .1, 1) 400ms); 11 | } 12 | .slide-in-up.ng-enter-active, 13 | .slide-in-up > .ng-enter-active { 14 | @include translate3d(0, 0, 0); 15 | } 16 | 17 | .slide-in-up.ng-leave, 18 | .slide-in-up > .ng-leave { 19 | @include transition(all ease-in-out 250ms); 20 | } 21 | 22 | 23 | // Scale Out 24 | // Scale from hero (1 in this case) to zero 25 | // ------------------------------- 26 | 27 | @-webkit-keyframes scaleOut { 28 | from { -webkit-transform: scale(1); opacity: 1; } 29 | to { -webkit-transform: scale(0.8); opacity: 0; } 30 | } 31 | @keyframes scaleOut { 32 | from { transform: scale(1); opacity: 1; } 33 | to { transform: scale(0.8); opacity: 0; } 34 | } 35 | 36 | 37 | // Super Scale In 38 | // Scale from super (1.x) to duper (1 in this case) 39 | // ------------------------------- 40 | 41 | @-webkit-keyframes superScaleIn { 42 | from { -webkit-transform: scale(1.2); opacity: 0; } 43 | to { -webkit-transform: scale(1); opacity: 1 } 44 | } 45 | @keyframes superScaleIn { 46 | from { transform: scale(1.2); opacity: 0; } 47 | to { transform: scale(1); opacity: 1; } 48 | } 49 | -------------------------------------------------------------------------------- /demo/www/lib/ngCordova/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngCordova", 3 | "version": "0.1.9-alpha", 4 | "homepage": "http://ngCordova.com/", 5 | "authors": [ 6 | "Max Lynch ", 7 | "Paolo Bernasconi ", 8 | "Chad Campbell " 9 | ], 10 | "description": "AngularJS Cordova wrappers for common Cordova plugins.", 11 | "main": [ 12 | "./dist/ng-cordova.js" 13 | ], 14 | "ignore": [ 15 | "**/.*", 16 | "gulpfile.js", 17 | "test", 18 | "src", 19 | "config", 20 | "demo", 21 | "CONTRIBUTING.md" 22 | ], 23 | "dependencies": { 24 | "angular": ">= 1.2.23" 25 | }, 26 | "keywords": [ 27 | "ngCordova", 28 | "ng-cordova", 29 | "ngcordova", 30 | "ng cordova", 31 | "cordova", 32 | "phonegap", 33 | "angular", 34 | "angularjs", 35 | "ionic", 36 | "cordova plugin" 37 | ], 38 | "license": "MIT", 39 | "private": false, 40 | "devDependencies": { 41 | "angular": ">= 1.2.23", 42 | "angular-mocks": ">= 1.2.23", 43 | "jquery": "~2.1.1" 44 | }, 45 | "_release": "0.1.9-alpha", 46 | "_resolution": { 47 | "type": "version", 48 | "tag": "v0.1.9-alpha", 49 | "commit": "df1240558924bb48a13c50530832f49e7869ba44" 50 | }, 51 | "_source": "git://github.com/driftyco/ng-cordova.git", 52 | "_target": "~0.1.9-alpha", 53 | "_originalSource": "ngCordova" 54 | } -------------------------------------------------------------------------------- /src/plugins/instagram.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugins add https://github.com/vstirbu/InstagramPlugin.git 2 | // link : https://github.com/vstirbu/InstagramPlugin 3 | 4 | /* globals Instagram: true */ 5 | angular.module('ngCordova.plugins.instagram', []) 6 | 7 | .factory('$cordovaInstagram', ['$q', function ($q) { 8 | 9 | return { 10 | share: function (options) { 11 | var q = $q.defer(); 12 | 13 | if (!window.Instagram) { 14 | console.error('Tried to call Instagram.share but the Instagram plugin isn\'t installed!'); 15 | q.resolve(null); 16 | return q.promise; 17 | } 18 | 19 | Instagram.share(options.image, options.caption, function (err) { 20 | if(err) { 21 | q.reject(err); 22 | } else { 23 | q.resolve(true); 24 | } 25 | }); 26 | return q.promise; 27 | }, 28 | isInstalled: function () { 29 | var q = $q.defer(); 30 | 31 | if (!window.Instagram) { 32 | console.error('Tried to call Instagram.isInstalled but the Instagram plugin isn\'t installed!'); 33 | q.resolve(null); 34 | return q.promise; 35 | } 36 | 37 | Instagram.isInstalled(function (err, installed) { 38 | if (err) { 39 | q.reject(err); 40 | } else { 41 | q.resolve(installed); 42 | } 43 | }); 44 | return q.promise; 45 | } 46 | }; 47 | }]); 48 | -------------------------------------------------------------------------------- /test/mocks/fileOpener2.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaFileOpener2', function(){ 2 | 3 | var $cordovaFileOpener2, $rootScope, $window; 4 | 5 | beforeEach(function() { 6 | module('ngCordovaMocks'); 7 | }); 8 | 9 | beforeEach(inject(function (_$cordovaFileOpener2_, _$q_, _$rootScope_, _$window_) { 10 | $cordovaFileOpener2 = _$cordovaFileOpener2_; 11 | $rootScope = _$rootScope_; 12 | $window = _$window_; 13 | })); 14 | 15 | it('should call window\'s plugins.fileOpener2.open method of success', function(done) { 16 | $cordovaFileOpener2.open( 17 | '/sdcard/Download/gmail.apk', 18 | 'application/vnd.android.package-archive' 19 | ).then( 20 | function () { 21 | expect(true).toBe(true); 22 | }, 23 | function() { 24 | expect(false).toBe(true); 25 | } 26 | ).finally(done); 27 | 28 | $rootScope.$digest(); 29 | }); 30 | 31 | it('should call window\'s plugins.fileOpener2.open method of failure', function(done) { 32 | $cordovaFileOpener2.throwsError = true; 33 | $cordovaFileOpener2.open( 34 | '/sdcard/Download/gmail.apk', 35 | 'application/vnd.android.package-archive' 36 | ).then( 37 | function () { 38 | expect(true).toBe(true); 39 | }, 40 | function() { 41 | expect(false).toBe(true); 42 | } 43 | ).finally(done); 44 | 45 | $rootScope.$digest(); 46 | }); 47 | 48 | }); 49 | -------------------------------------------------------------------------------- /src/plugins/geolocation.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-geolocation 2 | // link : https://github.com/apache/cordova-plugin-geolocation 3 | 4 | angular.module('ngCordova.plugins.geolocation', []) 5 | 6 | .factory('$cordovaGeolocation', ['$q', function ($q) { 7 | 8 | return { 9 | getCurrentPosition: function (options) { 10 | var q = $q.defer(); 11 | 12 | navigator.geolocation.getCurrentPosition(function (result) { 13 | q.resolve(result); 14 | }, function (err) { 15 | q.reject(err); 16 | }, options); 17 | 18 | return q.promise; 19 | }, 20 | 21 | watchPosition: function (options) { 22 | var q = $q.defer(); 23 | 24 | var watchID = navigator.geolocation.watchPosition(function (result) { 25 | q.notify(result); 26 | }, function (err) { 27 | q.reject(err); 28 | }, options); 29 | 30 | q.promise.cancel = function () { 31 | navigator.geolocation.clearWatch(watchID); 32 | }; 33 | 34 | q.promise.clearWatch = function (id) { 35 | navigator.geolocation.clearWatch(id || watchID); 36 | }; 37 | 38 | q.promise.watchID = watchID; 39 | 40 | return q.promise; 41 | }, 42 | 43 | clearWatch: function (watchID) { 44 | return navigator.geolocation.clearWatch(watchID); 45 | } 46 | }; 47 | }]); 48 | -------------------------------------------------------------------------------- /test/plugins/printer.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaPrinter', function () { 2 | 3 | var $cordovaPrinter, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.printer')); 6 | 7 | beforeEach(inject(function (_$cordovaPrinter_, _$q_, _$rootScope_) { 8 | $cordovaPrinter = _$cordovaPrinter_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.plugin = { 12 | printer: { 13 | isAvailable: angular.noop, 14 | print: jasmine.createSpy('print') 15 | } 16 | }; 17 | })); 18 | 19 | it('should return window\'s printer.isAvailable', function () { 20 | 21 | var result; 22 | 23 | spyOn(window.plugin.printer, 'isAvailable') 24 | .and.callFake(function (successCb, errorCb) { 25 | successCb(false); 26 | }); 27 | 28 | $cordovaPrinter 29 | .isAvailable() 30 | .then(function (response) { 31 | result = response; 32 | }); 33 | 34 | $rootScope.$digest(); 35 | 36 | expect(result).toBe(false); 37 | }); 38 | 39 | it('should call window\'s printer.print', function () { 40 | var result; 41 | var someDoc = 'someDocContent'; 42 | var options = {landscape: true}; 43 | 44 | $cordovaPrinter 45 | .print(someDoc, options) 46 | .then(function (response) { 47 | result = response; 48 | }); 49 | 50 | expect(window.plugin.printer.print).toHaveBeenCalledWith(someDoc, options, jasmine.any(Function)); 51 | }); 52 | 53 | }); 54 | -------------------------------------------------------------------------------- /src/plugins/upsPush.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/aerogear/aerogear-cordova-push.git 2 | // link : https://github.com/aerogear/aerogear-cordova-push 3 | 4 | angular.module('ngCordova.plugins.upsPush', []) 5 | 6 | .factory('$cordovaUpsPush', ['$q', '$window', '$rootScope', '$timeout', function ($q, $window, $rootScope, $timeout) { 7 | return { 8 | register: function (config) { 9 | var q = $q.defer(); 10 | 11 | $window.push.register(function (notification) { 12 | $timeout(function () { 13 | $rootScope.$broadcast('$cordovaUpsPush:notificationReceived', notification); 14 | }); 15 | }, function () { 16 | q.resolve(); 17 | }, function (error) { 18 | q.reject(error); 19 | }, config); 20 | 21 | return q.promise; 22 | }, 23 | 24 | unregister: function (options) { 25 | var q = $q.defer(); 26 | $window.push.unregister(function () { 27 | q.resolve(); 28 | }, function (error) { 29 | q.reject(error); 30 | }, options); 31 | 32 | return q.promise; 33 | }, 34 | 35 | // iOS only 36 | setBadgeNumber: function (number) { 37 | var q = $q.defer(); 38 | $window.push.setApplicationIconBadgeNumber(function () { 39 | q.resolve(); 40 | }, number); 41 | return q.promise; 42 | } 43 | }; 44 | }]); 45 | -------------------------------------------------------------------------------- /demo/www/README.md: -------------------------------------------------------------------------------- 1 | This is an addon starter template for the [Ionic Framework](http://ionicframework.com/). 2 | 3 | ## How to use this template 4 | 5 | *This template does not work on its own*. It is missing the Ionic library, and AngularJS. 6 | 7 | To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately. 8 | 9 | ### With the Ionic tool: 10 | 11 | Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below: 12 | 13 | ```bash 14 | $ sudo npm install -g ionic cordova 15 | $ ionic start myApp blank 16 | ``` 17 | 18 | Then, to run it, cd into `myApp` and run: 19 | 20 | ```bash 21 | $ ionic platform add ios 22 | $ ionic build ios 23 | $ ionic emulate ios 24 | ``` 25 | 26 | Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android. 27 | 28 | ## Demo 29 | http://plnkr.co/edit/tpl:IUU30p?p=preview 30 | 31 | ## Issues 32 | Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here! 33 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_radio.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Radio Button Inputs 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .item-radio { 8 | padding: 0; 9 | 10 | &:hover { 11 | cursor: pointer; 12 | } 13 | } 14 | 15 | .item-radio .item-content { 16 | /* give some room to the right for the checkmark icon */ 17 | padding-right: $item-padding * 4; 18 | } 19 | 20 | .item-radio .radio-icon { 21 | /* checkmark icon will be hidden by default */ 22 | position: absolute; 23 | top: 0; 24 | right: 0; 25 | z-index: $z-index-item-radio; 26 | visibility: hidden; 27 | padding: $item-padding - 2; 28 | height: 100%; 29 | font-size: 24px; 30 | } 31 | 32 | .item-radio input { 33 | /* hide any radio button inputs elements (the ugly circles) */ 34 | position: absolute; 35 | left: -9999px; 36 | 37 | &:checked ~ .item-content { 38 | /* style the item content when its checked */ 39 | background: #f7f7f7; 40 | } 41 | 42 | &:checked ~ .radio-icon { 43 | /* show the checkmark icon when its checked */ 44 | visibility: visible; 45 | } 46 | } 47 | 48 | // Hack for Android to correctly display the checked item 49 | // http://timpietrusky.com/advanced-checkbox-hack 50 | .platform-android.grade-b .item-radio, 51 | .platform-android.grade-c .item-radio { 52 | -webkit-animation: androidCheckedbugfix infinite 1s; 53 | } 54 | @-webkit-keyframes androidCheckedbugfix { 55 | from { padding: 0; } 56 | to { padding: 0; } 57 | } 58 | -------------------------------------------------------------------------------- /src/mocks/camera.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaCamera 4 | * 5 | * @description 6 | * A service for testing camera features 7 | * in an app build with ngCordova. 8 | **/ 9 | ngCordovaMocks.factory('$cordovaCamera', ['$q', function ($q) { 10 | var throwsError = false; 11 | var imageData = ''; 12 | 13 | return { 14 | 15 | /** 16 | * @ngdoc property 17 | * @name throwsError 18 | * @propertyOf ngCordovaMocks.cordovaCamera 19 | * 20 | * @description 21 | * A flag that signals whether a promise should be rejected or not. 22 | * This property should only be used in automated tests. 23 | **/ 24 | throwsError: throwsError, 25 | 26 | /** 27 | * @ngdoc property 28 | * @name imageData 29 | * @propertyOf ngCordovaMocks.cordovaCamera 30 | * 31 | * @description 32 | * The imagedata (e.g. an url) which will be returned from the device. 33 | * This property should only be used in automated tests. 34 | **/ 35 | imageData: imageData, 36 | 37 | getPicture: function (options) { 38 | var defer = $q.defer(); 39 | if (this.throwsError) { 40 | defer.reject('There was an error getting the picture.'); 41 | } else { 42 | if (options) { 43 | options = options; // This is just to get by JSHint. 44 | } 45 | 46 | defer.resolve(this.imageData); 47 | } 48 | 49 | return defer.promise; 50 | } 51 | }; 52 | }]); 53 | -------------------------------------------------------------------------------- /src/plugins/httpd.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/floatinghotpot/cordova-httpd.git 2 | // link : https://github.com/floatinghotpot/cordova-httpd 3 | 4 | angular.module('ngCordova.plugins.httpd', []) 5 | 6 | .factory('$cordovaHttpd', ['$q', function ($q) { 7 | 8 | return { 9 | startServer: function (options) { 10 | var d = $q.defer(); 11 | 12 | cordova.plugins.CorHttpd.startServer(options, function () { 13 | d.resolve(); 14 | }, function () { 15 | d.reject(); 16 | }); 17 | 18 | return d.promise; 19 | }, 20 | 21 | stopServer: function () { 22 | var d = $q.defer(); 23 | 24 | cordova.plugins.CorHttpd.stopServer(function () { 25 | d.resolve(); 26 | }, function () { 27 | d.reject(); 28 | }); 29 | 30 | return d.promise; 31 | }, 32 | 33 | getURL: function () { 34 | var d = $q.defer(); 35 | 36 | cordova.plugins.CorHttpd.getURL(function (url) { 37 | d.resolve(url); 38 | }, function () { 39 | d.reject(); 40 | }); 41 | 42 | return d.promise; 43 | }, 44 | 45 | getLocalPath: function () { 46 | var d = $q.defer(); 47 | 48 | cordova.plugins.CorHttpd.getLocalPath(function (path) { 49 | d.resolve(path); 50 | }, function () { 51 | d.reject(); 52 | }); 53 | 54 | return d.promise; 55 | } 56 | 57 | }; 58 | }]); 59 | -------------------------------------------------------------------------------- /src/plugins/flashlight.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git 2 | // link : https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin 3 | 4 | angular.module('ngCordova.plugins.flashlight', []) 5 | 6 | .factory('$cordovaFlashlight', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | available: function () { 10 | var q = $q.defer(); 11 | $window.plugins.flashlight.available(function (isAvailable) { 12 | q.resolve(isAvailable); 13 | }); 14 | return q.promise; 15 | }, 16 | 17 | switchOn: function () { 18 | var q = $q.defer(); 19 | $window.plugins.flashlight.switchOn(function (response) { 20 | q.resolve(response); 21 | }, function (error) { 22 | q.reject(error); 23 | }); 24 | return q.promise; 25 | }, 26 | 27 | switchOff: function () { 28 | var q = $q.defer(); 29 | $window.plugins.flashlight.switchOff(function (response) { 30 | q.resolve(response); 31 | }, function (error) { 32 | q.reject(error); 33 | }); 34 | return q.promise; 35 | }, 36 | 37 | toggle: function () { 38 | var q = $q.defer(); 39 | $window.plugins.flashlight.toggle(function (response) { 40 | q.resolve(response); 41 | }, function (error) { 42 | q.reject(error); 43 | }); 44 | return q.promise; 45 | } 46 | }; 47 | }]); 48 | -------------------------------------------------------------------------------- /test/plugins/keyboard.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaKeyboard', function() { 2 | 3 | var $cordovaKeyboard; 4 | 5 | beforeEach(module('ngCordova.plugins.keyboard')); 6 | 7 | beforeEach(inject(function (_$cordovaKeyboard_) { 8 | $cordovaKeyboard = _$cordovaKeyboard_; 9 | 10 | window.cordova = { 11 | plugins: { 12 | Keyboard: { 13 | hideKeyboardAccessoryBar: jasmine.createSpy('hideAccessoryBar'), 14 | close: jasmine.createSpy('close'), 15 | disableScroll: jasmine.createSpy('disableScroll'), 16 | isVisible: null 17 | } 18 | } 19 | } 20 | })); 21 | 22 | it('should call window.cordova.plugins\'s Keyboard.hideKeyboardAccessoryBar', function() { 23 | $cordovaKeyboard.hideAccessoryBar(true); 24 | expect(window.cordova.plugins.Keyboard.hideKeyboardAccessoryBar).toHaveBeenCalledWith(true); 25 | }); 26 | 27 | it('should call window.cordova.plugins\'s Keyboard.close', function() { 28 | $cordovaKeyboard.close(); 29 | expect(window.cordova.plugins.Keyboard.close).toHaveBeenCalled(); 30 | }); 31 | 32 | it('should call window.cordova.plugins\'s Keyboard.disableScroll', function() { 33 | $cordovaKeyboard.disableScroll(false); 34 | expect(window.cordova.plugins.Keyboard.disableScroll).toHaveBeenCalledWith(false); 35 | }); 36 | 37 | it('should call window.cordova.plugins\'s Keyboard.close', function() { 38 | window.cordova.plugins.Keyboard.isVisible = false; 39 | expect($cordovaKeyboard.isVisible()).toBe(false); 40 | }); 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /demo/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var gutil = require('gulp-util'); 3 | var bower = require('bower'); 4 | var concat = require('gulp-concat'); 5 | var sass = require('gulp-sass'); 6 | var minifyCss = require('gulp-minify-css'); 7 | var rename = require('gulp-rename'); 8 | var sh = require('shelljs'); 9 | 10 | var paths = { 11 | sass: ['./scss/**/*.scss'] 12 | }; 13 | 14 | gulp.task('default', ['sass']); 15 | 16 | gulp.task('sass', function(done) { 17 | gulp.src('./scss/ionic.app.scss') 18 | .pipe(sass()) 19 | .pipe(gulp.dest('./www/css/')) 20 | .pipe(minifyCss({ 21 | keepSpecialComments: 0 22 | })) 23 | .pipe(rename({ extname: '.min.css' })) 24 | .pipe(gulp.dest('./www/css/')) 25 | .on('end', done); 26 | }); 27 | 28 | gulp.task('watch', function() { 29 | gulp.watch(paths.sass, ['sass']); 30 | }); 31 | 32 | gulp.task('install', ['git-check'], function() { 33 | return bower.commands.install() 34 | .on('log', function(data) { 35 | gutil.log('bower', gutil.colors.cyan(data.id), data.message); 36 | }); 37 | }); 38 | 39 | gulp.task('git-check', function(done) { 40 | if (!sh.which('git')) { 41 | console.log( 42 | ' ' + gutil.colors.red('Git is not installed.'), 43 | '\n Git, the version control system, is required to download Ionic.', 44 | '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.', 45 | '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.' 46 | ); 47 | process.exit(1); 48 | } 49 | done(); 50 | }); 51 | -------------------------------------------------------------------------------- /test/mocks/dialogs.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaDialogs', function () { 7 | var $cordovaDialogs = null; 8 | 9 | beforeEach(inject(function (_$cordovaDialogs_) { 10 | $cordovaDialogs = _$cordovaDialogs_; 11 | })); 12 | 13 | it('should alert the user', function() { 14 | var message = 'Hello. World.'; 15 | $cordovaDialogs.useHostAbilities = false; 16 | $cordovaDialogs.alert(message); 17 | 18 | expect($cordovaDialogs.dialogText).toBe(message); 19 | }); 20 | 21 | it('should ask for confirmation', function() { 22 | var confirmation = 'Are you sure?'; 23 | $cordovaDialogs.useHostAbilities = false; 24 | $cordovaDialogs.confirm(confirmation); 25 | 26 | expect($cordovaDialogs.dialogText).toBe(confirmation); 27 | }); 28 | 29 | it('should prompt the user', function() { 30 | // Pretend that user enters '21' 31 | var promptResponse = '21'; 32 | $cordovaDialogs.useHostAbilities = false; 33 | $cordovaDialogs.promptResponse = promptResponse; 34 | 35 | // Simulate the prompt 36 | var prompt = 'Please enter your age:'; 37 | $cordovaDialogs.prompt(prompt, 38 | function(response) { 39 | expect(response).toBe(promptResponse); 40 | }, 41 | 'Age', 42 | ['ok', 'cancel'], 43 | '13' 44 | ); 45 | }); 46 | 47 | it('should beep five times', function() { 48 | var times = 5; 49 | $cordovaDialogs.beep(times); 50 | expect($cordovaDialogs.beepCount).toBe(times); 51 | }) 52 | }); 53 | }) -------------------------------------------------------------------------------- /src/mocks/capture.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaCapture 4 | * 5 | * @description 6 | * A service for testing media capture 7 | * in an app build with ngCordova. 8 | * 9 | * @example 10 | */ 11 | ngCordovaMocks.factory('$cordovaCapture', ['$q', function ($q) { 12 | var throwsError = false; 13 | 14 | return { 15 | /** 16 | * @ngdoc property 17 | * @name throwsError 18 | * @propertyOf ngCordovaMocks.cordovaCapture 19 | * 20 | * @description 21 | * A flag that signals whether a promise should be rejected or not. 22 | * This property should only be used in automated tests. 23 | **/ 24 | throwsError: throwsError, 25 | 26 | captureAudio: function () { 27 | var defer = $q.defer(); 28 | if (this.throwsError) { 29 | defer.reject('There was an error capturing the audio.'); 30 | } else { 31 | defer.resolve(); 32 | } 33 | 34 | return defer.promise; 35 | }, 36 | 37 | captureImage: function () { 38 | var defer = $q.defer(); 39 | if (this.throwsError) { 40 | defer.reject('There was an error capturing the image.'); 41 | } else { 42 | defer.resolve(); 43 | } 44 | 45 | return defer.promise; 46 | }, 47 | 48 | captureVideo: function () { 49 | var defer = $q.defer(); 50 | if (this.throwsError) { 51 | defer.reject('There was an error capturing the video.'); 52 | } else { 53 | defer.resolve(); 54 | } 55 | 56 | return defer.promise; 57 | } 58 | }; 59 | }]); 60 | -------------------------------------------------------------------------------- /config/karma.conf.js: -------------------------------------------------------------------------------- 1 | var buildConfig = require('./build.config.js'); 2 | 3 | module.exports = { 4 | files: [ 5 | // Include jQuery only for testing convenience (lots of DOM checking for unit tests on directives) 6 | 'bower_components/angular/angular.min.js', 7 | 'bower_components/angular-mocks/angular-mocks.js', 8 | 'bower_components/jquery/dist/jquery.js', 9 | ] 10 | .concat(buildConfig.pluginFiles) 11 | .concat('test/plugins/*.js') 12 | 13 | .concat(buildConfig.mockFiles) 14 | .concat('test/mocks/*.js') 15 | , 16 | 17 | frameworks: ['jasmine'], 18 | reporters: ['progress', 'coverage'], 19 | preprocessors: { 20 | 'src/plugins/*.js': ['coverage'] 21 | }, 22 | 23 | plugins: [ 24 | 'karma-jasmine', 25 | 'karma-phantomjs-launcher', 26 | 'karma-chrome-launcher', 27 | 'karma-coverage' 28 | ], 29 | 30 | coverageReporter: { 31 | type : 'html', 32 | dir : 'coverage/' 33 | }, 34 | 35 | port: 9876, 36 | colors: true, 37 | // possible values: 'OFF', 'ERROR', 'WARN', 'INFO', 'DEBUG' 38 | logLevel: 'INFO', 39 | autoWatch: true, 40 | captureTimeout: 60000, 41 | singleRun: false, 42 | 43 | // Start these browsers, currently available: 44 | // - Chrome 45 | // - ChromeCanary 46 | // - Firefox 47 | // - Opera (has to be installed with `npm install karma-opera-launcher`) 48 | // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) 49 | // - PhantomJS 50 | // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) 51 | browsers: ['Chrome'] 52 | }; 53 | -------------------------------------------------------------------------------- /test/mocks/vibration.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaVibration', function () { 7 | var $cordovaVibration = null; 8 | var $timeout = null; 9 | var $rootScope = null; 10 | 11 | beforeEach(inject(function (_$timeout_, _$rootScope_, _$cordovaVibration_) { 12 | $cordovaVibration = _$cordovaVibration_; 13 | $timeout = _$timeout_; 14 | $rootScope = _$rootScope_; 15 | })); 16 | 17 | it('should vibrate for 500 milliseconds', function() { 18 | expect($cordovaVibration.isVibrating).toBe(false); 19 | $cordovaVibration.vibrate(500); 20 | 21 | $timeout.flush(); 22 | $rootScope.$digest(); 23 | 24 | expect($cordovaVibration.isVibrating).toBe(false); 25 | }); 26 | 27 | it('should be vibrating at 250 milliseconds', function() { 28 | expect($cordovaVibration.isVibrating).toBe(false); 29 | $cordovaVibration.vibrate(500); 30 | 31 | $timeout.flush(400); 32 | $rootScope.$digest(); 33 | 34 | expect($cordovaVibration.isVibrating).toBe(true); 35 | }); 36 | 37 | it('should cancel vibration half way through', function() { 38 | expect($cordovaVibration.isVibrating).toBe(false); 39 | $cordovaVibration.vibrate(1000); // Vibrate for 1 second 40 | 41 | $timeout.flush(500); // Fast-forward in time 500 milliseconds 42 | $rootScope.$digest(); 43 | expect($cordovaVibration.isVibrating).toBe(true); 44 | 45 | $cordovaVibration.cancelVibration(); // Stop the vibration 46 | expect($cordovaVibration.isVibrating).toBe(false); 47 | }); 48 | }); 49 | }) -------------------------------------------------------------------------------- /src/mocks/keychain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaKeychain 4 | * 5 | * @description 6 | * A service for testing Keychain features 7 | * in an app built with ngCordova. 8 | **/ 9 | ngCordovaMocks.factory('$cordovaKeychain', ['$q', function ($q) { 10 | var keychains = {}; 11 | 12 | return { 13 | /** 14 | * @ngdoc property 15 | * @name keychains 16 | * @propertyOf ngCordovaMocks.cordovaKeychain 17 | * 18 | * @description 19 | * The collection of 'keychains' that have been saved. 20 | * This property should only be used in automated tests. 21 | **/ 22 | keychains: keychains, 23 | 24 | getForKey: function (key, serviceName) { 25 | var defer = $q.defer(); 26 | 27 | if (this.keychains[serviceName]) { 28 | defer.resolve(this.keychains[serviceName][key]); 29 | } else { 30 | defer.reject(); 31 | } 32 | 33 | return defer.promise; 34 | }, 35 | 36 | setForKey: function (key, serviceName, value) { 37 | var defer = $q.defer(); 38 | 39 | if (!this.keychains[serviceName]) { 40 | this.keychains[serviceName] = {}; 41 | } 42 | 43 | this.keychains[serviceName][key] = value; 44 | 45 | defer.resolve(); 46 | 47 | return defer.promise; 48 | }, 49 | 50 | removeForKey: function (key, serviceName) { 51 | var defer = $q.defer(); 52 | 53 | if (this.keychains[serviceName]) { 54 | delete this.keychains[serviceName][key]; 55 | } 56 | 57 | defer.resolve(); 58 | 59 | return defer.promise; 60 | } 61 | }; 62 | }]); 63 | -------------------------------------------------------------------------------- /test/mocks/toast.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function () { 2 | beforeEach(function () { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaToast', function () { 7 | var $rootScope = null; 8 | var $cordovaToast = null; 9 | var message = 'A message.'; 10 | var functionNames = [ 11 | 'hide', 12 | 'showShortTop', 13 | 'showShortCenter', 14 | 'showShortBottom', 15 | 'showLongTop', 16 | 'showLongCenter', 17 | 'showLongBottom', 18 | 'showWithOptions', 19 | 'show' 20 | ]; 21 | 22 | beforeEach(inject(function (_$cordovaToast_, _$rootScope_) { 23 | $cordovaToast = _$cordovaToast_; 24 | $rootScope = _$rootScope_; 25 | })); 26 | 27 | it('should show a toast', function () { 28 | 29 | functionNames.forEach(function(functionName){ 30 | $cordovaToast[functionName](message) 31 | .then( 32 | function () {expect(true).toBe(true)}, 33 | function () {expect(false).toBe(true)} 34 | ) 35 | .finally(function () {done();}); 36 | $rootScope.$digest(); 37 | }); 38 | }); 39 | 40 | it('should throw an error ', function (done) { 41 | $cordovaToast.throwsError = true; 42 | 43 | functionNames.forEach(function(functionName){ 44 | $cordovaToast[functionName](message) 45 | .then( 46 | function () {expect(true).toBe(false)}, 47 | function () {expect(true).toBe(true)} 48 | ) 49 | .finally(function () {done();}); 50 | $rootScope.$digest(); 51 | }) 52 | }); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /src/plugins/googleMap.js: -------------------------------------------------------------------------------- 1 | // install : 2 | // link : 3 | 4 | // Google Maps needs ALOT of work! 5 | // Not for production use 6 | 7 | angular.module('ngCordova.plugins.googleMap', []) 8 | 9 | .factory('$cordovaGoogleMap', ['$q', '$window', function ($q, $window) { 10 | 11 | var map = null; 12 | 13 | return { 14 | getMap: function (options) { 15 | var q = $q.defer(); 16 | 17 | if (!$window.plugin.google.maps) { 18 | q.reject(null); 19 | } else { 20 | var div = document.getElementById('map_canvas'); 21 | map = $window.plugin.google.maps.Map.getMap(options); 22 | map.setDiv(div); 23 | q.resolve(map); 24 | } 25 | return q.promise; 26 | }, 27 | 28 | isMapLoaded: function () { // check if an instance of the map exists 29 | return !!map; 30 | }, 31 | addMarker: function (markerOptions) { // add a marker to the map with given markerOptions 32 | var q = $q.defer(); 33 | map.addMarker(markerOptions, function (marker) { 34 | q.resolve(marker); 35 | }); 36 | 37 | return q.promise; 38 | }, 39 | getMapTypeIds: function () { 40 | return $window.plugin.google.maps.mapTypeId; 41 | }, 42 | setVisible: function (isVisible) { 43 | var q = $q.defer(); 44 | map.setVisible(isVisible); 45 | return q.promise; 46 | }, 47 | // I don't know how to deallocate te map and the google map plugin. 48 | cleanup: function () { 49 | map = null; 50 | // delete map; 51 | } 52 | }; 53 | }]); 54 | -------------------------------------------------------------------------------- /test/plugins/datePicker.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaDatePicker', function() { 2 | 3 | var $cordovaDatePicker, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.datePicker')); 6 | 7 | beforeEach(inject(function (_$cordovaDatePicker_, _$q_, _$rootScope_) { 8 | $cordovaDatePicker = _$cordovaDatePicker_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.datePicker = { 12 | show: angular.noop 13 | }; 14 | })); 15 | 16 | it('should call window\'s datePicker.show method', function() { 17 | 18 | var result; 19 | var options = { mode: 'date', date: new Date() }; 20 | 21 | spyOn(window.datePicker, 'show') 22 | .and.callFake(function (options, successCb, errorCb) { 23 | successCb(options.date); 24 | }); 25 | 26 | $cordovaDatePicker 27 | .show(options) 28 | .then(function (response) { 29 | result = response; 30 | }); 31 | 32 | $rootScope.$digest(); 33 | 34 | expect(result).toBe(options.date); 35 | expect(window.datePicker.show.calls.argsFor(0)[0]).toBe(options); 36 | }); 37 | 38 | it('should have default options if none are passed', function() { 39 | var result; 40 | 41 | spyOn(window.datePicker, 'show') 42 | .and.callFake(function(options, successCb, errorCb) { 43 | successCb(options.date); 44 | }); 45 | 46 | $cordovaDatePicker 47 | .show() 48 | .then(function (response) { 49 | result = response; 50 | }); 51 | 52 | $rootScope.$digest(); 53 | 54 | console.log(result); 55 | 56 | expect(result instanceof Date).toBeTruthy(); 57 | }); 58 | 59 | }); 60 | -------------------------------------------------------------------------------- /src/plugins/screenshot.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/gitawego/cordova-screenshot.git 2 | // link : https://github.com/gitawego/cordova-screenshot 3 | 4 | angular.module('ngCordova.plugins.screenshot', []) 5 | .factory('$cordovaScreenshot', ['$q', function ($q) { 6 | return { 7 | captureToFile: function (opts) { 8 | 9 | var options = opts || {}; 10 | 11 | var extension = options.extension || 'jpg'; 12 | var quality = options.quality || '100'; 13 | 14 | var defer = $q.defer(); 15 | 16 | if (!navigator.screenshot) { 17 | defer.resolve(null); 18 | return defer.promise; 19 | } 20 | 21 | navigator.screenshot.save(function (error, res) { 22 | if (error) { 23 | defer.reject(error); 24 | } else { 25 | defer.resolve(res.filePath); 26 | } 27 | }, extension, quality, options.filename); 28 | 29 | return defer.promise; 30 | }, 31 | captureToUri: function (opts) { 32 | 33 | var options = opts || {}; 34 | 35 | var extension = options.extension || 'jpg'; 36 | var quality = options.quality || '100'; 37 | 38 | var defer = $q.defer(); 39 | 40 | if (!navigator.screenshot) { 41 | defer.resolve(null); 42 | return defer.promise; 43 | } 44 | 45 | navigator.screenshot.URI(function (error, res) { 46 | if (error) { 47 | defer.reject(error); 48 | } else { 49 | defer.resolve(res.URI); 50 | } 51 | }, extension, quality, options.filename); 52 | 53 | return defer.promise; 54 | } 55 | }; 56 | }]); -------------------------------------------------------------------------------- /test/plugins/appAvailability.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaAppAvailability', function() { 2 | 3 | var $cordovaAppAvailability, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.appAvailability')); 6 | 7 | beforeEach(inject(function (_$cordovaAppAvailability_, _$rootScope_) { 8 | $cordovaAppAvailability = _$cordovaAppAvailability_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.appAvailability = { 12 | check: angular.noop 13 | }; 14 | })); 15 | 16 | it('should call window\'s appAvailability.check method', function() { 17 | 18 | var result; 19 | 20 | spyOn(window.appAvailability, 'check') 21 | .and.callFake(function (urlScheme, successCb, errorCb) { 22 | successCb(true); 23 | }); 24 | 25 | $cordovaAppAvailability 26 | .check('twitter://') 27 | .then(function (response) { 28 | result = response; 29 | }); 30 | 31 | $rootScope.$digest(); 32 | 33 | expect(result).toBe(true); 34 | expect(window.appAvailability.check.calls.argsFor(0)[0]).toBe('twitter://'); 35 | }); 36 | 37 | it('should call errorCb when in window\'s appAvailability.check a error orccurs', function() { 38 | 39 | var result; 40 | var errorObj = { someError: 1 }; 41 | 42 | spyOn(window.appAvailability, 'check') 43 | .and.callFake(function (urlScheme, successCb, errorCb) { 44 | errorCb(errorObj); 45 | }); 46 | 47 | $cordovaAppAvailability.check() 48 | .then(angular.noop, function (response) { 49 | result = response; 50 | }); 51 | 52 | $rootScope.$digest(); 53 | 54 | expect(result).toBe(errorObj); 55 | }); 56 | 57 | }); 58 | -------------------------------------------------------------------------------- /demo/www/app/contacts/contacts.html: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 16 |
17 | 18 |
19 |
20 |

NAME: {{selectedContact.name.givenName}} {{selectedContact.name.familyName}}

21 |
22 |
23 | 24 |
25 | 29 |
30 | 31 |
32 | 35 |
36 |
37 | 38 |
39 | 43 |
44 | 45 |
46 | 49 |
50 | 51 | 52 |
53 |
54 | -------------------------------------------------------------------------------- /test/plugins/sms.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaSms', function() { 2 | 3 | var $cordovaSms, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.sms')); 6 | 7 | beforeEach(inject(function (_$cordovaSms_, _$q_, _$rootScope_) { 8 | $cordovaSms = _$cordovaSms_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.sms = { 12 | send: angular.noop 13 | }; 14 | })); 15 | 16 | it('should call window\'s sms.send with correct parameters', function() { 17 | 18 | var result; 19 | var number = 0555129; 20 | var message = 'Hi, derp'; 21 | var intent = 'INTENT'; 22 | 23 | spyOn(window.sms, 'send') 24 | .and.callFake(function (number, message, intent, successCb, errorCb) { 25 | successCb(true); 26 | }); 27 | 28 | $cordovaSms.send(number, message, intent).then(function (response) { 29 | result = response; 30 | }); 31 | 32 | $rootScope.$digest(); 33 | 34 | expect(result).toBe(true); 35 | expect(window.sms.send).toHaveBeenCalledWith( 36 | number, 37 | message, 38 | intent, 39 | jasmine.any(Function), 40 | jasmine.any(Function) 41 | ); 42 | }); 43 | 44 | it('should reject on error callback', function() { 45 | 46 | var errorResult; 47 | 48 | spyOn(window.sms, 'send') 49 | .and.callFake(function (number, message, intent, successCb, errorCb) { 50 | errorCb(false); 51 | }); 52 | 53 | $cordovaSms.send(666, 'evil').then( 54 | angular.noop, 55 | function (err) { 56 | errorResult = err; 57 | }); 58 | 59 | $rootScope.$digest(); 60 | 61 | expect(errorResult).toBe(false); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /src/plugins/batteryStatus.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-battery-status 2 | // link : https://github.com/apache/cordova-plugin-battery-status 3 | 4 | angular.module('ngCordova.plugins.batteryStatus', []) 5 | 6 | .factory('$cordovaBatteryStatus', ['$rootScope', '$window', '$timeout', function ($rootScope, $window, $timeout) { 7 | 8 | /** 9 | * @param {string} status 10 | */ 11 | var batteryStatus = function (status) { 12 | $timeout(function () { 13 | $rootScope.$broadcast('$cordovaBatteryStatus:status', status); 14 | }); 15 | }; 16 | 17 | /** 18 | * @param {string} status 19 | */ 20 | var batteryCritical = function (status) { 21 | $timeout(function () { 22 | $rootScope.$broadcast('$cordovaBatteryStatus:critical', status); 23 | }); 24 | }; 25 | 26 | /** 27 | * @param {string} status 28 | */ 29 | var batteryLow = function (status) { 30 | $timeout(function () { 31 | $rootScope.$broadcast('$cordovaBatteryStatus:low', status); 32 | }); 33 | }; 34 | 35 | document.addEventListener('deviceready', function () { 36 | if (navigator.battery) { 37 | $window.addEventListener('batterystatus', batteryStatus, false); 38 | $window.addEventListener('batterycritical', batteryCritical, false); 39 | $window.addEventListener('batterylow', batteryLow, false); 40 | 41 | } 42 | }, false); 43 | return true; 44 | }]) 45 | .run(['$injector', function ($injector) { 46 | $injector.get('$cordovaBatteryStatus'); //ensure the factory and subsequent event listeners get initialised 47 | }]); 48 | -------------------------------------------------------------------------------- /src/plugins/capture.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-media-capture 2 | // link : https://github.com/apache/cordova-plugin-media-capture 3 | 4 | angular.module('ngCordova.plugins.capture', []) 5 | 6 | .factory('$cordovaCapture', ['$q', function ($q) { 7 | 8 | return { 9 | captureAudio: function (options) { 10 | var q = $q.defer(); 11 | 12 | if (!navigator.device.capture) { 13 | q.resolve(null); 14 | return q.promise; 15 | } 16 | 17 | navigator.device.capture.captureAudio(function (audioData) { 18 | q.resolve(audioData); 19 | }, function (err) { 20 | q.reject(err); 21 | }, options); 22 | 23 | return q.promise; 24 | }, 25 | captureImage: function (options) { 26 | var q = $q.defer(); 27 | 28 | if (!navigator.device.capture) { 29 | q.resolve(null); 30 | return q.promise; 31 | } 32 | 33 | navigator.device.capture.captureImage(function (imageData) { 34 | q.resolve(imageData); 35 | }, function (err) { 36 | q.reject(err); 37 | }, options); 38 | 39 | return q.promise; 40 | }, 41 | captureVideo: function (options) { 42 | var q = $q.defer(); 43 | 44 | if (!navigator.device.capture) { 45 | q.resolve(null); 46 | return q.promise; 47 | } 48 | 49 | navigator.device.capture.captureVideo(function (videoData) { 50 | q.resolve(videoData); 51 | }, function (err) { 52 | q.reject(err); 53 | }, options); 54 | 55 | return q.promise; 56 | } 57 | }; 58 | }]); 59 | -------------------------------------------------------------------------------- /src/mocks/network.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaNetwork 4 | * 5 | * @description 6 | * A service for testing networked fetures 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaNetwork', ['$rootScope',function ($rootScope) { 10 | var connectionType = 'WiFi connection'; 11 | var isConnected = true; 12 | 13 | return { 14 | /** 15 | * @ngdoc property 16 | * @name connectionType 17 | * @propertyOf ngCordovaMocks.cordovaNetwork 18 | * 19 | * @description 20 | * They type of connection. Values should match those found at 21 | * https://github.com/apache/cordova-plugin-network-information 22 | * This property should only be used in automated tests. 23 | **/ 24 | connectionType: connectionType, 25 | 26 | /** 27 | * @ngdoc property 28 | * @name isConnected 29 | * @propertyOf ngCordovaMocks.cordovaNetwork 30 | * 31 | * @description 32 | * A flag that signals whether the app is connected to a network. 33 | * This property should only be used in automated tests. 34 | **/ 35 | isConnected: isConnected, 36 | 37 | switchToOnline: function (){ 38 | this.isConnected = true; 39 | $rootScope.$broadcast('$cordovaNetwork:online'); 40 | }, 41 | 42 | switchToOffline: function (){ 43 | this.isConnected = false; 44 | $rootScope.$broadcast('$cordovaNetwork:offline'); 45 | }, 46 | 47 | getNetwork: function () { 48 | return this.connectionType; 49 | }, 50 | 51 | isOnline: function () { 52 | return this.isConnected; 53 | }, 54 | 55 | isOffline: function () { 56 | return !this.isConnected; 57 | } 58 | }; 59 | }]); 60 | -------------------------------------------------------------------------------- /demo/www/app/healthkit/healthkit.ctrl.js: -------------------------------------------------------------------------------- 1 | angular.module('demo.healthkit.ctrl', []) 2 | 3 | .controller('HealthKitCtrl', function($scope, $cordovaHealthKit) { 4 | 5 | $cordovaHealthKit.isAvailable().then(function(success) { 6 | alert('HealthKit Available'); 7 | }, function(err) { 8 | alert('HealthKit NOT Available'); 9 | }); 10 | 11 | $scope.request = function() { 12 | $cordovaHealthKit.requestAuthorization().then(function(success) { 13 | $scope.granted = true; 14 | }, function(err) { 15 | $scope.granted = false; 16 | }); 17 | }; 18 | $scope.checkAuth = function() { 19 | $cordovaHealthKit.checkAuthStatus().then(function(success) { 20 | $scope.granted = true; 21 | }, function(err) { 22 | $scope.granted = false; 23 | }); 24 | }; 25 | $scope.readDOB = function() { 26 | $cordovaHealthKit.readDateOfBirth().then(function(dob) { 27 | alert('DOB ' + dob); 28 | }, function(err) { 29 | alert(err); 30 | }); 31 | }; 32 | $scope.readGender = function() { 33 | $cordovaHealthKit.readGender().then(function(gender) { 34 | alert('Gender ' + gender); 35 | }, function(err) { 36 | alert(err); 37 | }); 38 | }; 39 | $scope.readWeight = function() { 40 | $cordovaHealthKit.readWeight().then(function(v) { 41 | alert('Weight ' + JSON.stringify(v)); 42 | }, function(err) { 43 | alert(err); 44 | }); 45 | }; 46 | $scope.readHeight = function() { 47 | $cordovaHealthKit.readHeight().then(function(v) { 48 | alert('Height ' + JSON.stringify(v)); 49 | }, function(err) { 50 | alert(err); 51 | }); 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /demo/www/lib/angular-ui-router/src/viewScroll.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc object 3 | * @name ui.router.state.$uiViewScrollProvider 4 | * 5 | * @description 6 | * Provider that returns the {@link ui.router.state.$uiViewScroll} service function. 7 | */ 8 | function $ViewScrollProvider() { 9 | 10 | var useAnchorScroll = false; 11 | 12 | /** 13 | * @ngdoc function 14 | * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll 15 | * @methodOf ui.router.state.$uiViewScrollProvider 16 | * 17 | * @description 18 | * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for 19 | * scrolling based on the url anchor. 20 | */ 21 | this.useAnchorScroll = function () { 22 | useAnchorScroll = true; 23 | }; 24 | 25 | /** 26 | * @ngdoc object 27 | * @name ui.router.state.$uiViewScroll 28 | * 29 | * @requires $anchorScroll 30 | * @requires $timeout 31 | * 32 | * @description 33 | * When called with a jqLite element, it scrolls the element into view (after a 34 | * `$timeout` so the DOM has time to refresh). 35 | * 36 | * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, 37 | * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}. 38 | */ 39 | this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) { 40 | if (useAnchorScroll) { 41 | return $anchorScroll; 42 | } 43 | 44 | return function ($element) { 45 | $timeout(function () { 46 | $element[0].scrollIntoView(); 47 | }, 0, false); 48 | }; 49 | }]; 50 | } 51 | 52 | angular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); 53 | -------------------------------------------------------------------------------- /src/plugins/brightness.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/fiscal-cliff/phonegap-plugin-brightness.git 2 | // link : https://github.com/fiscal-cliff/phonegap-plugin-brightness 3 | 4 | angular.module('ngCordova.plugins.brightness', []) 5 | 6 | .factory('$cordovaBrightness', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | get: function () { 10 | var q = $q.defer(); 11 | 12 | if (!$window.cordova) { 13 | q.reject('Not supported without cordova.js'); 14 | } else { 15 | $window.cordova.plugins.brightness.getBrightness(function (result) { 16 | q.resolve(result); 17 | }, function (err) { 18 | q.reject(err); 19 | }); 20 | } 21 | 22 | return q.promise; 23 | }, 24 | 25 | set: function (data) { 26 | var q = $q.defer(); 27 | 28 | if (!$window.cordova) { 29 | q.reject('Not supported without cordova.js'); 30 | } else { 31 | $window.cordova.plugins.brightness.setBrightness(data, function (result) { 32 | q.resolve(result); 33 | }, function (err) { 34 | q.reject(err); 35 | }); 36 | } 37 | 38 | return q.promise; 39 | }, 40 | 41 | setKeepScreenOn: function (bool) { 42 | var q = $q.defer(); 43 | 44 | if (!$window.cordova) { 45 | q.reject('Not supported without cordova.js'); 46 | } else { 47 | $window.cordova.plugins.brightness.setKeepScreenOn(bool, function (result) { 48 | q.resolve(result); 49 | }, function (err) { 50 | q.reject(err); 51 | }); 52 | } 53 | 54 | return q.promise; 55 | } 56 | }; 57 | }]); 58 | 59 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_badge.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Badges 4 | * -------------------------------------------------- 5 | */ 6 | 7 | .badge { 8 | @include badge-style($badge-default-bg, $badge-default-text); 9 | z-index: $z-index-badge; 10 | display: inline-block; 11 | padding: 3px 8px; 12 | min-width: 10px; 13 | border-radius: $badge-border-radius; 14 | vertical-align: baseline; 15 | text-align: center; 16 | white-space: nowrap; 17 | font-weight: $badge-font-weight; 18 | font-size: $badge-font-size; 19 | line-height: $badge-line-height; 20 | 21 | &:empty { 22 | display: none; 23 | } 24 | } 25 | 26 | //Be sure to override specificity of rule that 'badge color matches tab color by default' 27 | .tabs .tab-item .badge, 28 | .badge { 29 | &.badge-light { 30 | @include badge-style($badge-light-bg, $badge-light-text); 31 | } 32 | &.badge-stable { 33 | @include badge-style($badge-stable-bg, $badge-stable-text); 34 | } 35 | &.badge-positive { 36 | @include badge-style($badge-positive-bg, $badge-positive-text); 37 | } 38 | &.badge-calm { 39 | @include badge-style($badge-calm-bg, $badge-calm-text); 40 | } 41 | &.badge-assertive { 42 | @include badge-style($badge-assertive-bg, $badge-assertive-text); 43 | } 44 | &.badge-balanced { 45 | @include badge-style($badge-balanced-bg, $badge-balanced-text); 46 | } 47 | &.badge-energized { 48 | @include badge-style($badge-energized-bg, $badge-energized-text); 49 | } 50 | &.badge-royal { 51 | @include badge-style($badge-royal-bg, $badge-royal-text); 52 | } 53 | &.badge-dark { 54 | @include badge-style($badge-dark-bg, $badge-dark-text); 55 | } 56 | } 57 | 58 | // Quick fix for labels/badges in buttons 59 | .button .badge { 60 | position: relative; 61 | top: -1px; 62 | } 63 | -------------------------------------------------------------------------------- /src/mocks/sqlite.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaSQLite 4 | * 5 | * @description 6 | * A service for testing SQLite 7 | * in an app build with ngCordova. 8 | */ 9 | 10 | ngCordovaMocks.factory('$cordovaSQLite', ['$q', function ($q) { 11 | 12 | return { 13 | /** 14 | * These properties are here for the purpose of automated testing only. 15 | **/ 16 | openDBShouldSucceedWith: null, 17 | executeShouldSucceedWith: null, 18 | insertCollectionShouldSucceedWith: null, 19 | nestedExecuteShouldSucceedWith: null, 20 | deleteDBShouldSucceedWith : null, 21 | 22 | openDB: function (options, background) { 23 | if (this.openDBShouldSucceedWith !== null) { 24 | $q.when(this.openDBShouldSucceedWith) 25 | } else { 26 | $q.reject() 27 | } 28 | }, 29 | execute: function (db, query, binding) { 30 | if (this.executeShouldSucceedWith !== null) { 31 | $q.when(this.executeShouldSucceedWith) 32 | } else { 33 | $q.reject() 34 | } 35 | }, 36 | insertCollection: function (db, query, bindings) { 37 | if (this.insertCollectionShouldSucceedWith !== null) { 38 | $q.when(this.insertCollectionShouldSucceedWith) 39 | } else { 40 | $q.reject() 41 | } 42 | }, 43 | nestedExecute: function (db, query1, query2, binding1, binding2) { 44 | if (this.nestedExecuteShouldSucceedWith !== null) { 45 | $q.when(this.nestedExecuteShouldSucceedWith) 46 | } else { 47 | $q.reject() 48 | } 49 | }, 50 | deleteDB: function (dbName) { 51 | if (this.deleteDBShouldSucceedWith !== null) { 52 | $q.when(this.deleteDBShouldSucceedWith) 53 | } else { 54 | $q.reject() 55 | } 56 | } 57 | } 58 | }]); 59 | -------------------------------------------------------------------------------- /test/mocks/network.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaNetwork', function () { 7 | var $cordovaNetwork = null; 8 | var $rootScope = null; 9 | var $cordovaNetwork = null; 10 | 11 | beforeEach(inject(function (_$cordovaNetwork_,_$rootScope_,_$cordovaNetwork_) { 12 | $cordovaNetwork = _$cordovaNetwork_; 13 | $rootScope = _$rootScope_; 14 | $cordovaNetwork = _$cordovaNetwork_; 15 | })); 16 | 17 | it('should get network name', function () { 18 | // TODO: This should integrate with the navigator connection property values. 19 | $cordovaNetwork.connectionType = 'WiFi connection'; 20 | var networkName = $cordovaNetwork.getNetwork(); 21 | expect(networkName).toEqual('WiFi connection'); 22 | }); 23 | 24 | it('should check if online', function() { 25 | var isOnline = $cordovaNetwork.isOnline(); 26 | expect(isOnline).toBe(true); 27 | }); 28 | 29 | it('should check if offline', function() { 30 | var isOffline = $cordovaNetwork.isOffline(); 31 | expect(isOffline).toBe(false); 32 | }); 33 | 34 | it('should launch listeners when switching to online', function() { 35 | var isOnline = false; 36 | 37 | $rootScope.$on('$cordovaNetwork:online',function(){ 38 | isOnline = $cordovaNetwork.isOnline(); 39 | }); 40 | 41 | $cordovaNetwork.switchToOnline(); 42 | 43 | expect(isOnline).toBe(true); 44 | }); 45 | 46 | it('should launch listeners when switching to online', function() { 47 | var isOffline = false; 48 | 49 | $rootScope.$on('$cordovaNetwork:offline',function(){ 50 | isOffline = $cordovaNetwork.isOffline(); 51 | }); 52 | 53 | $cordovaNetwork.switchToOffline(); 54 | 55 | expect(isOffline).toBe(true); 56 | }); 57 | }); 58 | }) -------------------------------------------------------------------------------- /src/mocks/statusbar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaStatusbar 4 | * 5 | * @description 6 | * A service for testing the status bar 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaStatusbar', function () { 10 | var isStatusBarVisible = true; 11 | var canOverlayWebView = true; 12 | 13 | return { 14 | /** 15 | * @ngdoc property 16 | * @name isStatusBarVisible 17 | * @propertyOf ngCordovaMocks.cordovaStatusbar 18 | * 19 | * @description 20 | * A flag that signals whether the status bar is visible or not. 21 | * This property should only be used in automated tests. 22 | **/ 23 | isStatusBarVisible: isStatusBarVisible, 24 | 25 | /** 26 | * @ngdoc property 27 | * @name canOverlayWebView 28 | * @propertyOf ngCordovaMocks.cordovaStatusbar 29 | * 30 | * @description 31 | * A flag that signals whether the status bar can overlay the web view. 32 | * This property should only be used in automated tests. 33 | **/ 34 | canOverlayWebView: canOverlayWebView, 35 | 36 | overlaysWebView: function (bool) { 37 | this.canOverlayWebView = bool; 38 | }, 39 | 40 | style: function (style) { 41 | // TODO: Review 42 | return style; 43 | }, 44 | 45 | styleHex: function (colorHex) { 46 | // TODO: review 47 | return colorHex; 48 | }, 49 | 50 | styleColor: function (color) { 51 | // TODO: review 52 | return color; 53 | }, 54 | 55 | hide: function () { 56 | this.isStatusBarVisible = false; 57 | }, 58 | 59 | show: function () { 60 | this.isStatusBarVisible = true; 61 | }, 62 | 63 | isVisible: function () { 64 | return this.isStatusBarVisible; 65 | } 66 | }; 67 | }); 68 | -------------------------------------------------------------------------------- /src/plugins/backgroundGeolocation.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add https://github.com/christocracy/cordova-plugin-background-geolocation.git 2 | // link : https://github.com/christocracy/cordova-plugin-background-geolocation 3 | 4 | angular.module('ngCordova.plugins.backgroundGeolocation', []) 5 | 6 | .factory('$cordovaBackgroundGeolocation', ['$q', '$window', function ($q, $window) { 7 | 8 | return { 9 | 10 | init: function () { 11 | $window.navigator.geolocation.getCurrentPosition(function (location) { 12 | return location; 13 | }); 14 | }, 15 | 16 | configure: function (options) { 17 | 18 | this.init(); 19 | var q = $q.defer(); 20 | 21 | $window.plugins.backgroundGeoLocation.configure( 22 | function (result) { 23 | q.notify(result); 24 | $window.plugins.backgroundGeoLocation.finish(); 25 | }, 26 | function (err) { 27 | q.reject(err); 28 | }, options); 29 | 30 | this.start(); 31 | 32 | return q.promise; 33 | }, 34 | 35 | start: function () { 36 | var q = $q.defer(); 37 | 38 | $window.plugins.backgroundGeoLocation.start( 39 | function (result) { 40 | q.resolve(result); 41 | }, 42 | function (err) { 43 | q.reject(err); 44 | }); 45 | 46 | return q.promise; 47 | }, 48 | 49 | stop: function () { 50 | var q = $q.defer(); 51 | 52 | $window.plugins.backgroundGeoLocation.stop( 53 | function (result) { 54 | q.resolve(result); 55 | }, 56 | function (err) { 57 | q.reject(err); 58 | }); 59 | 60 | return q.promise; 61 | } 62 | }; 63 | } 64 | 65 | ]); 66 | -------------------------------------------------------------------------------- /demo/www/lib/ionic/scss/_platform.scss: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Platform 4 | * -------------------------------------------------- 5 | * Platform specific tweaks 6 | */ 7 | 8 | .platform-ios.platform-cordova { 9 | // iOS7/8 has a status bar which sits on top of the header. 10 | // Bump down everything to make room for it. However, if 11 | // if its in Cordova, and set to fullscreen, then disregard the bump. 12 | &:not(.fullscreen) { 13 | .bar-header:not(.bar-subheader) { 14 | height: $bar-height + $ios-statusbar-height; 15 | 16 | &.item-input-inset .item-input-wrapper { 17 | margin-top: 19px !important; 18 | } 19 | 20 | > * { 21 | margin-top: $ios-statusbar-height; 22 | } 23 | } 24 | .tabs-top > .tabs, 25 | .tabs.tabs-top { 26 | top: $bar-height + $ios-statusbar-height; 27 | } 28 | 29 | .has-header, 30 | .bar-subheader { 31 | top: $bar-height + $ios-statusbar-height; 32 | } 33 | .has-subheader { 34 | top: $bar-height + $bar-subheader-height + $ios-statusbar-height; 35 | } 36 | .has-tabs-top { 37 | top: $bar-height + $tabs-height + $ios-statusbar-height; 38 | } 39 | .has-header.has-subheader.has-tabs-top { 40 | top: $bar-height + $bar-subheader-height + $tabs-height + $ios-statusbar-height; 41 | } 42 | } 43 | &.status-bar-hide { 44 | // Cordova doesn't adjust the body height correctly, this makes up for it 45 | margin-bottom: 20px; 46 | } 47 | } 48 | 49 | @media (orientation:landscape) { 50 | .platform-ios.platform-browser.platform-ipad { 51 | position: fixed; // required for iPad 7 Safari 52 | } 53 | } 54 | 55 | .platform-c:not(.enable-transitions) * { 56 | // disable transitions on grade-c devices (Android 2) 57 | -webkit-transition: none !important; 58 | transition: none !important; 59 | } 60 | -------------------------------------------------------------------------------- /demo/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function ap { 4 | cordova plugin add org.apache.cordova.$1 5 | } 6 | 7 | ap camera 8 | ap console 9 | ap contacts 10 | ap device 11 | ap dialogs 12 | ap device-motion 13 | ap device-orientation 14 | ap network-information 15 | ap geolocation 16 | ap globalization 17 | ap file 18 | ap file-transfer 19 | ap splashscreen 20 | ap statusbar 21 | ap vibration 22 | ap media 23 | ap inappbrowser 24 | ap battery-status 25 | 26 | cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="12345678" --variable APP_NAME="Name" 27 | cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard # keyboard 28 | cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git # date-picker 29 | cordova plugin add https://github.com/wildabeast/BarcodeScanner.git # barcode scanner 30 | cordova plugin add https://github.com/chrisekelley/AppPreferences # app preferences 31 | cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git # flashlight 32 | cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git # toast 33 | cordova plugin add uk.co.ilee.touchid # touchID 34 | cordova plugin add https://github.com/pushandplay/cordova-plugin-apprate.git # AppRate 35 | cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git 36 | cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git 37 | cordova plugin add https://github.com/phonegap-build/PushPlugin.git 38 | cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git 39 | cordova plugin add https://github.com/Telerik-Verified-Plugins/HealthKit 40 | cordova plugin add de.appplant.cordova.plugin.badge 41 | cordova plugin add aerogear-cordova-push 42 | cordova plugin add com.unarin.cordova.beacon 43 | -------------------------------------------------------------------------------- /src/mocks/fileOpener2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc service 3 | * @name ngCordovaMocks.cordovaFileOpener2 4 | * 5 | * @description 6 | * A service for testing fileOpener2 7 | * in an app build with ngCordova. 8 | */ 9 | ngCordovaMocks.factory('$cordovaFileOpener2', ['$q', function ($q) { 10 | 11 | var throwsError = false; 12 | 13 | return { 14 | 15 | /** 16 | * @ngdoc property 17 | * @name throwsError 18 | * @propertyOf ngCordovaMocks.cordovaFileOpener2 19 | * 20 | * @description 21 | * A flag that signals whether a promise should be rejected or not. 22 | * This property should only be used in automated tests. 23 | **/ 24 | throwsError: throwsError, 25 | 26 | open: function (file, type) { 27 | 28 | var defer = $q.defer(); 29 | 30 | if (this.throwError) { 31 | defer.reject({ 32 | status: 0, 33 | message: 'There was an error capturing the file.' 34 | }); 35 | } else { 36 | defer.resolve(); 37 | } 38 | 39 | return defer.promise; 40 | 41 | }, 42 | 43 | uninstall: function (pack) { 44 | 45 | var defer = $q.defer(); 46 | 47 | if (this.throwError) { 48 | defer.reject({ 49 | status: 0, 50 | message: 'There was an error capturing the packageId.' 51 | }); 52 | } else { 53 | defer.resolve(); 54 | } 55 | 56 | return defer.promise; 57 | 58 | }, 59 | 60 | appIsInstalled: function (pack) { 61 | 62 | var defer = $q.defer(); 63 | 64 | if (this.throwError) { 65 | defer.reject({ 66 | status: 0, 67 | message: 'There was an error capturing the packageId.' 68 | }); 69 | } else { 70 | defer.resolve(); 71 | } 72 | 73 | return defer.promise; 74 | 75 | } 76 | 77 | }; 78 | 79 | }]); 80 | 81 | -------------------------------------------------------------------------------- /src/plugins/deviceOrientation.js: -------------------------------------------------------------------------------- 1 | // install : cordova plugin add cordova-plugin-device-orientation 2 | // link : https://github.com/apache/cordova-plugin-device-orientation 3 | 4 | angular.module('ngCordova.plugins.deviceOrientation', []) 5 | 6 | .factory('$cordovaDeviceOrientation', ['$q', function ($q) { 7 | 8 | var defaultOptions = { 9 | frequency: 3000 // every 3s 10 | }; 11 | 12 | return { 13 | getCurrentHeading: function () { 14 | var q = $q.defer(); 15 | 16 | if(!navigator.compass) { 17 | q.reject('No compass on Device'); 18 | return q.promise; 19 | } 20 | 21 | navigator.compass.getCurrentHeading(function (result) { 22 | q.resolve(result); 23 | }, function (err) { 24 | q.reject(err); 25 | }); 26 | 27 | return q.promise; 28 | }, 29 | 30 | watchHeading: function (options) { 31 | var q = $q.defer(); 32 | 33 | if(!navigator.compass) { 34 | q.reject('No compass on Device'); 35 | return q.promise; 36 | } 37 | 38 | var _options = angular.extend(defaultOptions, options); 39 | var watchID = navigator.compass.watchHeading(function (result) { 40 | q.notify(result); 41 | }, function (err) { 42 | q.reject(err); 43 | }, _options); 44 | 45 | q.promise.cancel = function () { 46 | navigator.compass.clearWatch(watchID); 47 | }; 48 | 49 | q.promise.clearWatch = function (id) { 50 | navigator.compass.clearWatch(id || watchID); 51 | }; 52 | 53 | q.promise.watchID = watchID; 54 | 55 | return q.promise; 56 | }, 57 | 58 | clearWatch: function (watchID) { 59 | return navigator.compass.clearWatch(watchID); 60 | } 61 | }; 62 | }]); 63 | -------------------------------------------------------------------------------- /test/mocks/appVersion.spec.js: -------------------------------------------------------------------------------- 1 | describe('ngCordovaMocks', function() { 2 | beforeEach(function() { 3 | module('ngCordovaMocks'); 4 | }); 5 | 6 | describe('cordovaAppVersion', function() { 7 | var $rootScope = null; 8 | var $cordovaActionSheet = null; 9 | var options = {}; 10 | 11 | beforeEach(inject(function (_$cordovaAppVersion_, _$rootScope_) { 12 | $cordovaAppVersion = _$cordovaAppVersion_; 13 | $rootScope = _$rootScope_; 14 | })); 15 | 16 | it('should be able to retrieve app name', function(done) { 17 | $cordovaAppVersion 18 | .getAppName() 19 | .then( 20 | function(name) { expect(name).toBe("mock app name") }, 21 | function() { expect(false).toBe(true) } 22 | ) 23 | .finally(function() { done(); }); 24 | 25 | $rootScope.$digest(); 26 | }); 27 | 28 | it('should be able to retrieve package name', function(done) { 29 | $cordovaAppVersion 30 | .getPackageName() 31 | .then( 32 | function(name) { expect(name).toBe("com.package.mock") }, 33 | function() { expect(false).toBe(true) } 34 | ) 35 | .finally(function() { done(); }); 36 | 37 | $rootScope.$digest(); 38 | }); 39 | 40 | it('should be able to retrieve version number', function(done) { 41 | $cordovaAppVersion 42 | .getVersionNumber() 43 | .then( 44 | function(name) { expect(name).toBe("1.2.3") }, 45 | function() { expect(false).toBe(true) } 46 | ) 47 | .finally(function() { done(); }); 48 | 49 | $rootScope.$digest(); 50 | }); 51 | 52 | it('should be able to retrieve version code', function(done) { 53 | $cordovaAppVersion 54 | .getVersionCode() 55 | .then( 56 | function(name) { expect(name).toBe("4.5.6") }, 57 | function() { expect(false).toBe(true) } 58 | ) 59 | .finally(function() { done(); }); 60 | 61 | $rootScope.$digest(); 62 | }); 63 | 64 | 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /test/plugins/devices.spec.js: -------------------------------------------------------------------------------- 1 | describe('Service: $cordovaDevice', function() { 2 | 3 | var $cordovaDevice, $rootScope; 4 | 5 | beforeEach(module('ngCordova.plugins.device')); 6 | 7 | beforeEach(inject(function (_$cordovaDevice_, _$q_, _$rootScope_) { 8 | $cordovaDevice = _$cordovaDevice_; 9 | $rootScope = _$rootScope_; 10 | 11 | window.device = { 12 | cordova: false, 13 | model: 'iPhone 5C', 14 | name: 'iPhone 5C', 15 | platform: 'iOS', 16 | uuid: 89749382749823749823, 17 | version: 5, 18 | manufacturer: 'apple' 19 | }; 20 | })); 21 | 22 | it('should return window.device on getDevice', function() { 23 | expect($cordovaDevice.getDevice()).toBe(window.device); 24 | }); 25 | 26 | it('should return window.device.cordova on getCordova', function() { 27 | expect($cordovaDevice.getCordova()).toBe(window.device.cordova); 28 | }); 29 | 30 | it('should return window.device.model on getModel', function() { 31 | expect($cordovaDevice.getModel()).toBe(window.device.model); 32 | }); 33 | 34 | it('should return window.device.name on getName', function() { 35 | expect($cordovaDevice.getName()).toBe(window.device.name); 36 | }); 37 | 38 | it('should return window.device.platform on getPlatform', function() { 39 | expect($cordovaDevice.getPlatform()).toBe(window.device.platform); 40 | }); 41 | 42 | it('should return window.device.uuid on getUUID', function() { 43 | expect($cordovaDevice.getUUID()).toBe(window.device.uuid); 44 | }); 45 | 46 | it('should return window.device.version on getVersion', function() { 47 | expect($cordovaDevice.getVersion()).toBe(window.device.version); 48 | }); 49 | 50 | it('should return window.device.manufacturer on getManufacturer', function() { 51 | expect($cordovaDevice.getManufacturer()).toBe(window.device.manufacturer); 52 | }); 53 | 54 | }); 55 | --------------------------------------------------------------------------------