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

Commit 5578524

Browse files
Holy Hot Push! "Firebase Remote Config" support please! #56
1 parent 6abcf85 commit 5578524

File tree

9 files changed

+307
-72
lines changed

9 files changed

+307
-72
lines changed

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,27 @@ And here's the comprehensive list of supported functions:
8585
All further examples assume `firebase` has been required.
8686
Also, all functions support promises, but we're leaving out the `.then()` stuff for brevity where it doesn't add value.
8787

88+
### getRemoteConfig
89+
Since plugin version 3.2.0 you can retrieve 'Remote Config' properties.
90+
This feature lets you configure parameters in your Firebase instance like these:
91+
92+
<img src="screenshots/remote-config" width="500px" height="482px" alt="Remote Config"/>
93+
94+
Using this function you can retrieve the current values of the remote properties
95+
so you can change app behavior on the fly easily (feature toggles for instance).
96+
97+
```js
98+
firebase.getRemoteConfig({
99+
cacheExpirationSeconds: 600, // 10 minutes, default is 12 hours.. set to a lower value during dev
100+
keys: ["holiday_promo_enabled", "coupons_left", "foo", "double_test", "int_test"]
101+
}).then(
102+
function (result) {
103+
console.log("Remote Config last fetched at " + result.lastFetch);
104+
console.log("Remote Config: " + JSON.stringify(result.properties));
105+
}
106+
);
107+
```
108+
88109
### setValue
89110
Data is stored as JSON data at a specific path (which is appended to the URL you passed to `init`).
90111
If you want to add data to a known path use this, otherwise use `push` (see below).
@@ -401,9 +422,11 @@ Shouldn't be more complicated than:
401422
firebase.logout();
402423
```
403424

404-
## Known issues
405-
On Android you could run into an error like this:
425+
## Known issues (all Android)
426+
On Android you could run into an errors like these:
427+
406428

429+
#### DexIndexOverflowException
407430
```
408431
com.android.dex.DexIndexOverflowException: method ID not in..
409432
```
@@ -425,10 +448,18 @@ android {
425448
}
426449
```
427450

451+
#### FirebaseApp with name [DEFAULT] doesn't exist
428452
Another possible error is "FirebaseApp with name [DEFAULT] doesn't exist." which will be solved by
429453
placing `google-services.json` to `platforms/android/google-services.json` (see above), and making
430454
the changes to `build.gradle` which are mentioned above as well.
431455

456+
#### Could not find com.google...
457+
And there's this one: "Could not find com.google.firebase:firebase-auth:9.0.2". That means
458+
making sure you have the latest Google Repository bits installed.
459+
Just run `android` from a command prompt and install any pending updates.
460+
461+
#### Found play-services:9.0.0, but version 9.0.2 is needed..
462+
Update your Android bits like the issue above and reinstall the android platform in your project.
432463

433464
## Pro tips
434465

firebase-common.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ firebase.QueryRangeType = {
2727

2828
firebase.instance = null;
2929

30+
firebase.firebaseRemoteConfig = null;
31+
3032
firebase.authStateListeners = [];
3133

3234
firebase.addAuthStateListener = function(listener) {
@@ -63,4 +65,17 @@ firebase.notifyAuthStateListeners = function(data) {
6365
});
6466
};
6567

68+
firebase.strongTypeify = function (value) {
69+
if (value === "true") {
70+
value = true;
71+
} else if (value === "false") {
72+
value = false;
73+
} else if (parseFloat(value) == value) {
74+
value = parseFloat(value);
75+
} else if (parseInt(value) == value) {
76+
value = parseInt(value);
77+
}
78+
return value;
79+
};
80+
6681
module.exports = firebase;

0 commit comments

Comments
 (0)