Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 99ef14b

Browse files
author
Denny Beulen
committed
fixed crash when invites is not enabled in build.gradle
1 parent 1f0397c commit 99ef14b

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

firebase.android.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ firebase.query = function (updateCallback, path, options) {
15491549
} else if (options.orderBy.type === firebase.QueryOrderByType.PRIORITY) {
15501550
query = firebase.instance.child(path).orderByPriority();
15511551
} else if (options.orderBy.type === firebase.QueryOrderByType.CHILD) {
1552-
if (options.orderBy.value === undefined || options.orderBy.value === null) {
1552+
if (!options.orderBy.value) {
15531553
reject("When orderBy.type is 'child' you must set orderBy.value as well.");
15541554
return;
15551555
}
@@ -1561,7 +1561,7 @@ firebase.query = function (updateCallback, path, options) {
15611561

15621562
// range
15631563
if (options.range && options.range.type) {
1564-
if (options.range.value === undefined || options.range.value === null) {
1564+
if (!options.range.value) {
15651565
reject("Please set range.value");
15661566
return;
15671567
}
@@ -1581,7 +1581,7 @@ firebase.query = function (updateCallback, path, options) {
15811581
if (options.ranges) {
15821582
for (var i=0; i < options.ranges.length; i++) {
15831583
var range = options.ranges[i];
1584-
if (range.value === undefined || range.value === null) {
1584+
if (!range.value) {
15851585
reject("Please set ranges["+i+"].value");
15861586
return;
15871587
}
@@ -1600,7 +1600,7 @@ firebase.query = function (updateCallback, path, options) {
16001600

16011601
// limit
16021602
if (options.limit && options.limit.type) {
1603-
if (options.limit.value === undefined || options.limit.value === null) {
1603+
if (!options.limit.value) {
16041604
reject("Please set limit.value");
16051605
return;
16061606
}
@@ -2121,29 +2121,36 @@ firebase.addOnDynamicLinkReceivedCallback = function (callback) {
21212121
});
21222122
};
21232123

2124+
var dynamicLinksEnabled = new lazy(function () {
2125+
return typeof(com.google.android.gms.appinvite) !== "undefined"
2126+
});
21242127

21252128
(function() {
21262129
appModule.on("launch", function(args) {
2127-
var intent = args.android;
2130+
if (!dynamicLinksEnabled()) {
2131+
return;
2132+
}
2133+
2134+
var intent = args.android;
21282135

21292136
var getDynamicLinksCallback = new com.google.android.gms.tasks.OnCompleteListener({
21302137
onComplete: function(task) {
21312138

2132-
if (task.isSuccessful() && task.getResult() != null) {
2133-
result = task.getResult().getLink();
2134-
result = firebase.toJsObject(result);
2135-
if(firebase._DynamicLinkCallback === null){
2136-
console.log("No callback is provided for a dynamic link");
2137-
}
2138-
else{
2139-
setTimeout(function() {
2140-
firebase._DynamicLinkCallback(result);
2141-
});
2142-
}
2143-
2144-
}
2145-
}
2146-
});
2139+
if (task.isSuccessful() && task.getResult() != null) {
2140+
result = task.getResult().getLink();
2141+
result = firebase.toJsObject(result);
2142+
if(firebase._DynamicLinkCallback === null){
2143+
console.log("No callback is provided for a dynamic link");
2144+
}
2145+
else{
2146+
setTimeout(function() {
2147+
firebase._DynamicLinkCallback(result);
2148+
});
2149+
}
2150+
2151+
}
2152+
}
2153+
});
21472154

21482155
firebaseDynamicLinks = com.google.firebase.dynamiclinks.FirebaseDynamicLinks.getInstance();
21492156
DynamicLinks = firebaseDynamicLinks.getDynamicLink(intent).addOnCompleteListener(getDynamicLinksCallback);

0 commit comments

Comments
 (0)