11/*!
22 * ngCordova
3- * v0.1.23 -alpha
3+ * v0.1.24 -alpha
44 * Copyright 2015 Drifty Co. http://drifty.com/
55 * See LICENSE in this repository for license information
66 */
@@ -240,8 +240,8 @@ angular.module('ngCordova.plugins.appVersion', [])
240240
241241 getPackageName : function ( ) {
242242 var q = $q . defer ( ) ;
243- cordova . getAppVersion . getPackageName ( function ( package ) {
244- q . resolve ( package ) ;
243+ cordova . getAppVersion . getPackageName ( function ( pack ) {
244+ q . resolve ( pack ) ;
245245 } ) ;
246246
247247 return q . promise ;
@@ -1784,7 +1784,7 @@ angular.module('ngCordova.plugins.datePicker', [])
17841784 options = options || { date : new Date ( ) , mode : 'date' } ;
17851785 $window . datePicker . show ( options , function ( date ) {
17861786 q . resolve ( date ) ;
1787- } , function ( error ) {
1787+ } , function ( error ) {
17881788 q . reject ( error ) ;
17891789 } ) ;
17901790 return q . promise ;
@@ -1886,6 +1886,7 @@ angular.module('ngCordova.plugins.deviceMotion', [])
18861886 if ( angular . isUndefined ( navigator . accelerometer ) ||
18871887 ! angular . isFunction ( navigator . accelerometer . getCurrentAcceleration ) ) {
18881888 q . reject ( 'Device do not support watchAcceleration' ) ;
1889+ return q . promise ;
18891890 }
18901891
18911892 navigator . accelerometer . getCurrentAcceleration ( function ( result ) {
@@ -1903,6 +1904,7 @@ angular.module('ngCordova.plugins.deviceMotion', [])
19031904 if ( angular . isUndefined ( navigator . accelerometer ) ||
19041905 ! angular . isFunction ( navigator . accelerometer . watchAcceleration ) ) {
19051906 q . reject ( 'Device do not support watchAcceleration' ) ;
1907+ return q . promise ;
19061908 }
19071909
19081910 var watchID = navigator . accelerometer . watchAcceleration ( function ( result ) {
@@ -2054,6 +2056,71 @@ angular.module('ngCordova.plugins.dialogs', [])
20542056
20552057 beep : function ( times ) {
20562058 return navigator . notification . beep ( times ) ;
2059+ } ,
2060+
2061+ activityStart : function ( message , title ) {
2062+ var q = $q . defer ( ) ;
2063+
2064+ if ( cordova . platformId === 'android' ) {
2065+ navigator . notification . activityStart ( title , message ) ;
2066+ q . resolve ( ) ;
2067+ } else {
2068+ q . reject ( message , title ) ;
2069+ }
2070+
2071+ return q . promise ;
2072+ } ,
2073+
2074+ activityStop : function ( ) {
2075+ var q = $q . defer ( ) ;
2076+
2077+ if ( cordova . platformId === 'android' ) {
2078+ navigator . notification . activityStop ( ) ;
2079+ q . resolve ( ) ;
2080+ } else {
2081+ q . reject ( ) ;
2082+ }
2083+
2084+ return q . promise ;
2085+ } ,
2086+
2087+ progressStart : function ( message , title ) {
2088+ var q = $q . defer ( ) ;
2089+
2090+ if ( cordova . platformId === 'android' ) {
2091+ navigator . notification . progressStart ( title , message ) ;
2092+ q . resolve ( ) ;
2093+ } else {
2094+ q . reject ( message , title ) ;
2095+ }
2096+
2097+ return q . promise ;
2098+ } ,
2099+
2100+ progressStop : function ( ) {
2101+ var q = $q . defer ( ) ;
2102+
2103+ if ( cordova . platformId === 'android' ) {
2104+ navigator . notification . progressStop ( ) ;
2105+ q . resolve ( ) ;
2106+ } else {
2107+ q . reject ( ) ;
2108+ }
2109+
2110+ return q . promise ;
2111+ } ,
2112+
2113+ progressValue : function ( value ) {
2114+ var q = $q . defer ( ) ;
2115+
2116+ if ( cordova . platformId === 'android' ) {
2117+ navigator . notification . progressValue ( value ) ;
2118+ q . resolve ( ) ;
2119+ } else {
2120+ q . reject ( value ) ;
2121+ }
2122+
2123+ return q . promise ;
20572124 }
20582125 } ;
20592126 } ] ) ;
@@ -2936,6 +3003,34 @@ angular.module('ngCordova.plugins.file', [])
29363003 e . message = $cordovaFileError [ e . code ] ;
29373004 q . reject ( e ) ;
29383005 }
3006+ return q . promise ;
3007+ } ,
3008+
3009+ readFileMetadata : function ( path , file ) {
3010+ var q = $q . defer ( ) ;
3011+
3012+ if ( ( / ^ \/ / . test ( file ) ) ) {
3013+ q . reject ( 'directory cannot start with \/' ) ;
3014+ }
3015+
3016+ try {
3017+ var directory = path + file ;
3018+ $window . resolveLocalFileSystemURL ( directory , function ( fileEntry ) {
3019+ fileEntry . file ( function ( result ) {
3020+ q . resolve ( result ) ;
3021+ } , function ( error ) {
3022+ error . message = $cordovaFileError [ error . code ] ;
3023+ q . reject ( error ) ;
3024+ } ) ;
3025+ } , function ( err ) {
3026+ err . message = $cordovaFileError [ err . code ] ;
3027+ q . reject ( err ) ;
3028+ } ) ;
3029+ } catch ( e ) {
3030+ e . message = $cordovaFileError [ e . code ] ;
3031+ q . reject ( e ) ;
3032+ }
3033+
29393034 return q . promise ;
29403035 }
29413036
@@ -2972,9 +3067,6 @@ angular.module('ngCordova.plugins.file', [])
29723067 return q.promise;
29733068 },
29743069
2975- readFileMetadata: function (filePath) {
2976- //return getFile(filePath, {create: false});
2977- }
29783070 */
29793071 } ;
29803072
@@ -5625,9 +5717,9 @@ angular.module('ngCordova.plugins.nativeAudio', [])
56255717 return q . promise ;
56265718 } ,
56275719
5628- preloadComplex : function ( id , assetPath , volume , voices ) {
5720+ preloadComplex : function ( id , assetPath , volume , voices , delay ) {
56295721 var q = $q . defer ( ) ;
5630- $window . plugins . NativeAudio . preloadComplex ( id , assetPath , volume , voices , function ( result ) {
5722+ $window . plugins . NativeAudio . preloadComplex ( id , assetPath , volume , voices , delay , function ( result ) {
56315723 q . resolve ( result ) ;
56325724 } , function ( err ) {
56335725 q . reject ( err ) ;
@@ -5638,11 +5730,11 @@ angular.module('ngCordova.plugins.nativeAudio', [])
56385730
56395731 play : function ( id , completeCallback ) {
56405732 var q = $q . defer ( ) ;
5641- $window . plugins . NativeAudio . play ( id , completeCallback , function ( err ) {
5642- q . reject ( err ) ;
5643- } , function ( result ) {
5733+ $window . plugins . NativeAudio . play ( id , function ( result ) {
56445734 q . resolve ( result ) ;
5645- } ) ;
5735+ } , function ( err ) {
5736+ q . reject ( err ) ;
5737+ } , completeCallback ) ;
56465738
56475739 return q . promise ;
56485740 } ,
@@ -5792,13 +5884,13 @@ angular.module('ngCordova.plugins.preferences', [])
57925884 * Decorate the promise object.
57935885 * @param promise The promise object.
57945886 */
5795- decoratePromise : function ( promise ) {
5796- promise . success = function ( fn ) {
5887+ decoratePromise : function ( promise ) {
5888+ promise . success = function ( fn ) {
57975889 promise . then ( fn ) ;
57985890 return promise ;
57995891 } ;
58005892
5801- promise . error = function ( fn ) {
5893+ promise . error = function ( fn ) {
58025894 promise . then ( null , fn ) ;
58035895 return promise ;
58045896 } ;
@@ -5811,7 +5903,7 @@ angular.module('ngCordova.plugins.preferences', [])
58115903 * @param dict The dictionary. It's optional.
58125904 * @returns Returns a promise.
58135905 */
5814- store : function ( key , value , dict ) {
5906+ store : function ( key , value , dict ) {
58155907 var deferred = $q . defer ( ) ;
58165908 var promise = deferred . promise ;
58175909
@@ -5846,7 +5938,7 @@ angular.module('ngCordova.plugins.preferences', [])
58465938 * @param dict The dictionary. It's optional.
58475939 * @returns Returns a promise.
58485940 */
5849- fetch : function ( key , dict ) {
5941+ fetch : function ( key , dict ) {
58505942 var deferred = $q . defer ( ) ;
58515943 var promise = deferred . promise ;
58525944
@@ -5880,7 +5972,7 @@ angular.module('ngCordova.plugins.preferences', [])
58805972 * @param dict The dictionary. It's optional.
58815973 * @returns Returns a promise.
58825974 */
5883- remove : function ( key , dict ) {
5975+ remove : function ( key , dict ) {
58845976 var deferred = $q . defer ( ) ;
58855977 var promise = deferred . promise ;
58865978
@@ -5912,7 +6004,7 @@ angular.module('ngCordova.plugins.preferences', [])
59126004 * Show the application preferences.
59136005 * @returns Returns a promise.
59146006 */
5915- show : function ( ) {
6007+ show : function ( ) {
59166008 var deferred = $q . defer ( ) ;
59176009 var promise = deferred . promise ;
59186010
@@ -6170,6 +6262,19 @@ angular.module('ngCordova.plugins.push_v5', [])
61706262 }
61716263 return q . promise ;
61726264 } ,
6265+ getBadgeNumber : function ( ) {
6266+ var q = $q . defer ( ) ;
6267+ if ( push === undefined ) {
6268+ q . reject ( new Error ( 'init must be called before any other operation' ) ) ;
6269+ } else {
6270+ push . getApplicationIconBadgeNumber ( function ( success ) {
6271+ q . resolve ( success ) ;
6272+ } , function ( error ) {
6273+ q . reject ( error ) ;
6274+ } ) ;
6275+ }
6276+ return q . promise ;
6277+ } ,
61736278 setBadgeNumber : function ( number ) {
61746279 var q = $q . defer ( ) ;
61756280 if ( push === undefined ) {
@@ -6182,6 +6287,19 @@ angular.module('ngCordova.plugins.push_v5', [])
61826287 } , number ) ;
61836288 }
61846289 return q . promise ;
6290+ } ,
6291+ finish : function ( ) {
6292+ var q = $q . defer ( ) ;
6293+ if ( push === undefined ) {
6294+ q . reject ( new Error ( 'init must be called before any other operation' ) ) ;
6295+ } else {
6296+ push . finish ( function ( success ) {
6297+ q . resolve ( success ) ;
6298+ } , function ( error ) {
6299+ q . reject ( error ) ;
6300+ } ) ;
6301+ }
6302+ return q . promise ;
61856303 }
61866304 } ;
61876305 } ] ) ;
0 commit comments