Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Fixed name
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Jun 3, 2014
1 parent 03e10d4 commit 632b385
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 61 deletions.
2 changes: 1 addition & 1 deletion demo/app/www/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ angular.module('starter.controllers', [])
$scope.plugins = [
{ name: 'Camera', slug: 'camera' },
{ name: 'Geolocation', slug: 'geolocation' },
{ name: 'Accelerometer', slug: 'accelerometer' }
{ name: 'Device Motion', slug: 'device-motion' }
];
})

Expand Down
174 changes: 116 additions & 58 deletions dist/ng-cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,6 @@ angular.module('ngCordova', [
'ngCordova.plugins'
]);

angular.module('ngCordova.plugins.accelerometer', [])

.factory('$cordovaAccelerometer', ['$q', function($q) {

return {
getCurrentAcceleration: function() {
var q = $q.defer();

navigator.accelerometer.getCurrentAcceleration(function(result) {
// Do any magic you need
q.resolve(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
},
watchAcceleration: function(options) {
var q = $q.defer();

navigator.accelerometer.watchAcceleration(function(result) {
// Do any magic you need
q.notify(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
},
clearWatch: function(watchID) {
return navigator.accelerometer.clearWatch(watchID);
}
}
}]);

angular.module('ngCordova.plugins.barcodeScanner', [])

.factory('$cordovaBarcodeScanner', ['$q', function ($q) {
Expand Down Expand Up @@ -118,25 +83,6 @@ angular.module('ngCordova.plugins.camera', [])
}
}]);

angular.module('ngCordova.plugins.compass', [])

.factory('$cordovaCompass', ['$q', function($q) {

return {
watchHeading: function(options) {
var q = $q.defer();

navigator.compass.watchHeading(function(result) {
q.resolve(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
}
}
}]);

angular.module('ngCordova.plugins.contacts', [])

.factory('Contacts', ['$q', function ($q) {
Expand Down Expand Up @@ -246,6 +192,60 @@ angular.module('ngCordova.plugins.device', [])
}
}]);

angular.module('ngCordova.plugins.deviceMotion', [])

.factory('$cordovaDeviceMotion', ['$q', function($q) {

return {
getCurrentAcceleration: function() {
var q = $q.defer();

navigator.accelerometer.getCurrentAcceleration(function(result) {
// Do any magic you need
q.resolve(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
},
watchAcceleration: function(options) {
var q = $q.defer();

navigator.accelerometer.watchAcceleration(function(result) {
// Do any magic you need
q.notify(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
},
clearWatch: function(watchID) {
return navigator.accelerometer.clearWatch(watchID);
}
}
}]);

angular.module('ngCordova.plugins.deviceOrientation', [])

.factory('$cordovaDeviceOrientation', ['$q', function($q) {

return {
watchHeading: function(options) {
var q = $q.defer();

navigator.compass.watchHeading(function(result) {
q.resolve(result);
}, function(err) {
q.reject(err);
}, options);

return q.promise;
}
}
}]);

angular.module('ngCordova.plugins.geolocation', [])

.factory('$cordovaGeolocation', ['$q', function($q) {
Expand Down Expand Up @@ -309,18 +309,19 @@ angular.module('ngCordova.plugins.keyboard', [])
}]);

angular.module('ngCordova.plugins', [
'ngCordova.plugins.accelerometer',
'ngCordova.plugins.deviceMotion',
'ngCordova.plugins.camera',
'ngCordova.plugins.geolocation',
'ngCordova.plugins.compass',
'ngCordova.plugins.deviceOrientation',
'ngCordova.plugins.notification',
'ngCordova.plugins.vibration',
'ngCordova.plugins.network',
'ngCordova.plugins.device',
'ngCordova.plugins.barcodeScanner',
'ngCordova.plugins.splashscreen',
'ngCordova.plugins.keyboard',
'ngCordova.plugins.contacts'
'ngCordova.plugins.contacts',
'ngCordova.plugins.statusbar'
]);

angular.module('ngCordova.plugins.network', [])
Expand Down Expand Up @@ -384,13 +385,70 @@ angular.module('ngCordova.plugins.splashscreen', [])

}]);

angular.module('ngCordova.plugins.statusbar', [])

.factory('$cordovaStatusbar', [function() {

return {
overlaysWebView: function(bool) {
return StatusBar.overlaysWebView(true);
},

// styles: Default, LightContent, BlackTranslucent, BlackOpaque
style: function (style) {
switch (style) {
case 0: // Default
return StatusBar.styleDefault();
break;

case 1: // LightContent
return StatusBar.styleLightContent();
break;

case 2: // BlackTranslucent
return StatusBar.styleBlackTranslucent();
break;

case 3: // BlackOpaque
return StatusBar.styleBlackOpaque();
break;

default: // Default
return StatusBar.styleDefault();
}
},


// supported names: black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown
styleColor: function (color) {
return StatusBar.backgroundColorByName(color);
},

styleHex: function (colorHex) {
return StatusBar.backgroundColorByHexString(colorHex);
},

hide: function () {
return StatusBar.hide();
},

show: function () {
return StatusBar.show()
},

isVisible: function () {
return StatusBar.isVisible();
}
}
}]);

angular.module('ngCordova.plugins.vibration', [])

.factory('$cordovaVibration', [function() {

return {
vibrate: function(times) {
return navigator.notification.vibrate(time);
return navigator.notification.vibrate(times);
}
}
}]);
Expand Down
2 changes: 1 addition & 1 deletion dist/ng-cordova.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/plugins/deviceMotion.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('ngCordova.plugins.deviceMotion', [])

.factory('$cordovadeviceMotion', ['$q', function($q) {
.factory('$cordovaDeviceMotion', ['$q', function($q) {

return {
getCurrentAcceleration: function() {
Expand Down

0 comments on commit 632b385

Please sign in to comment.