|
1 | 1 | var exec = require('cordova/exec'); |
2 | 2 |
|
| 3 | +var ensureBoolean = function (callback){ |
| 4 | + return function(result){ |
| 5 | + callback(!!result); |
| 6 | + } |
| 7 | +}; |
| 8 | + |
3 | 9 | exports.getVerificationID = function (number, success, error) { |
4 | 10 | exec(success, error, "FirebasePlugin", "getVerificationID", [number]); |
5 | 11 | }; |
@@ -59,11 +65,11 @@ exports.getBadgeNumber = function (success, error) { |
59 | 65 | }; |
60 | 66 |
|
61 | 67 | exports.grantPermission = function (success, error) { |
62 | | - exec(success, error, "FirebasePlugin", "grantPermission", []); |
| 68 | + exec(ensureBoolean(success), error, "FirebasePlugin", "grantPermission", []); |
63 | 69 | }; |
64 | 70 |
|
65 | 71 | exports.hasPermission = function (success, error) { |
66 | | - exec(success, error, "FirebasePlugin", "hasPermission", []); |
| 72 | + exec(ensureBoolean(success), error, "FirebasePlugin", "hasPermission", []); |
67 | 73 | }; |
68 | 74 |
|
69 | 75 | // Notifications - Android-only |
@@ -105,7 +111,7 @@ exports.setUserProperty = function (name, value, success, error) { |
105 | 111 | }; |
106 | 112 |
|
107 | 113 | exports.activateFetched = function (success, error) { |
108 | | - exec(success, error, "FirebasePlugin", "activateFetched", []); |
| 114 | + exec(ensureBoolean(success), error, "FirebasePlugin", "activateFetched", []); |
109 | 115 | }; |
110 | 116 |
|
111 | 117 | exports.fetch = function (cacheExpirationSeconds, success, error) { |
|
0 commit comments