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

Commit 04cc665

Browse files
AllenConquestgortok
authored andcommitted
Add new method getBadgeNumber() to push_v5 (#1216)
* Add new method getBadgeNumber() that wraps the method getApplicationIconBadgeNumber() from the plugin into a promise object. * missing comma
1 parent b0e915e commit 04cc665

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/plugins/push_v5.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ angular.module('ngCordova.plugins.push_v5', [])
5050
}
5151
return q.promise;
5252
},
53+
getBadgeNumber : function () {
54+
var q = $q.defer();
55+
if (push === undefined) {
56+
q.reject(new Error('init must be called before any other operation'));
57+
} else {
58+
push.getApplicationIconBadgeNumber(function (success) {
59+
q.resolve(success);
60+
}, function (error) {
61+
q.reject(error);
62+
});
63+
}
64+
return q.promise;
65+
},
5366
setBadgeNumber : function (number) {
5467
var q = $q.defer();
5568
if (push === undefined) {

0 commit comments

Comments
 (0)