Skip to content

Commit c4ade00

Browse files
committed
[Android] Ensure functions which return a boolean result return an actual boolean type rather than a binary integer.
Fixes arnesson#153.
1 parent fa12cb6 commit c4ade00

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

www/firebase.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
var exec = require('cordova/exec');
22

3+
var ensureBoolean = function (callback){
4+
return function(result){
5+
callback(!!result);
6+
}
7+
};
8+
39
exports.getVerificationID = function (number, success, error) {
410
exec(success, error, "FirebasePlugin", "getVerificationID", [number]);
511
};
@@ -59,11 +65,11 @@ exports.getBadgeNumber = function (success, error) {
5965
};
6066

6167
exports.grantPermission = function (success, error) {
62-
exec(success, error, "FirebasePlugin", "grantPermission", []);
68+
exec(ensureBoolean(success), error, "FirebasePlugin", "grantPermission", []);
6369
};
6470

6571
exports.hasPermission = function (success, error) {
66-
exec(success, error, "FirebasePlugin", "hasPermission", []);
72+
exec(ensureBoolean(success), error, "FirebasePlugin", "hasPermission", []);
6773
};
6874

6975
// Notifications - Android-only
@@ -105,7 +111,7 @@ exports.setUserProperty = function (name, value, success, error) {
105111
};
106112

107113
exports.activateFetched = function (success, error) {
108-
exec(success, error, "FirebasePlugin", "activateFetched", []);
114+
exec(ensureBoolean(success), error, "FirebasePlugin", "activateFetched", []);
109115
};
110116

111117
exports.fetch = function (cacheExpirationSeconds, success, error) {

0 commit comments

Comments
 (0)