Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(remote-config)!: API update to match web SDK #3537

Merged
merged 65 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
470870a
feat(remote-config): API update to match web SDK
russellwheatley Apr 24, 2020
8aa3d81
feat(remote-config): reset API for android
russellwheatley Apr 24, 2020
75c4d99
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Apr 24, 2020
fedbf14
tests(remote-config): update assertions
russellwheatley Apr 24, 2020
2ad7383
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Apr 27, 2020
a20d200
tests(remote-config): update to match api
russellwheatley Apr 30, 2020
3bded19
chore(remote-config): update
russellwheatley Apr 30, 2020
6782f6b
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Apr 30, 2020
7b9b3a1
chore(remote-config): update tests/API
russellwheatley Apr 30, 2020
a5293e3
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Apr 30, 2020
7e0543d
tests(remote-config): update tests
russellwheatley Apr 30, 2020
7dce603
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Apr 30, 2020
702df0a
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Apr 30, 2020
6370a5b
Merge branch 'master' into @russell/remote-config-rework
Salakar May 5, 2020
4b6491d
feat(remtoe-config): PR comment updates
russellwheatley May 6, 2020
827377f
Apply suggestions from code review
russellwheatley May 6, 2020
2859040
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley May 6, 2020
2f5de8f
chore(remote-config): Pr comment updates
russellwheatley May 6, 2020
b9facbd
fix(remote-config): revert back mocha config
russellwheatley May 6, 2020
eb320fc
Merge branch 'master' into @russell/remote-config-rework
russellwheatley May 18, 2020
cf50cb5
Merge branch 'master' into @russell/remote-config-rework
russellwheatley May 22, 2020
2adb489
Merge branch 'master' into @russell/remote-config-rework
russellwheatley May 26, 2020
a67a822
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jun 17, 2020
80f46a5
Apply suggestions from code review
russellwheatley Jun 22, 2020
beeb213
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Jun 22, 2020
40acc49
chore(remote-config): rename array
russellwheatley Jun 22, 2020
c876f63
chore(remote-config): PR updates
russellwheatley Jun 22, 2020
5b08c6b
chore(remote-config): lint disable
russellwheatley Jun 22, 2020
311766e
chore(remote-config): update types
russellwheatley Jun 23, 2020
93a3531
docs(remote-config): update docs
russellwheatley Jun 23, 2020
94294d8
docs(remote-config): note
russellwheatley Jun 23, 2020
afcb048
Merge branch 'master'
russellwheatley Jun 23, 2020
7e59896
docs(remote-config): update
russellwheatley Jun 23, 2020
37f6ac3
docs(remote-config): further updates
russellwheatley Jun 23, 2020
4744126
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jun 26, 2020
08eb71a
fix(ml-vision): cancel tests
russellwheatley Jun 26, 2020
d2568bb
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jun 29, 2020
ff8fa1f
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jun 29, 2020
b36ef94
docs(*): RNFB not part of spelling list
russellwheatley Jun 29, 2020
a05b09b
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Jun 29, 2020
08bc6af
Merge branch 'master' into remote-config-rework
russellwheatley Jun 29, 2020
8c182cd
chore(*) update spelling list
russellwheatley Jun 29, 2020
cb928eb
Merge branch 'master' into remote-config-rework
russellwheatley Jun 30, 2020
815fe70
docs(*): update ts.json docs
russellwheatley Jul 1, 2020
01667ac
Merge branch 'master' into remote-config-rework
russellwheatley Jul 1, 2020
0ad5a54
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 1, 2020
a6ec685
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 6, 2020
eaaeaa6
Merge branch 'master' /remote-config-rework
russellwheatley Jul 9, 2020
85a2bcc
docs(*): update ts docs
russellwheatley Jul 9, 2020
2fe2484
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Jul 9, 2020
b5bd023
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 10, 2020
36e9e24
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 13, 2020
74b16b9
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 13, 2020
479cb82
Merge branch 'master' into @russell/remote-config-rework
Salakar Jul 14, 2020
904ee65
Apply suggestions from code review
russellwheatley Jul 14, 2020
ff5cd66
chore(remote-config): release updates
russellwheatley Jul 14, 2020
25c2ac9
chore(remote-config): types
russellwheatley Jul 14, 2020
d2c3c14
chore(remote-config): 'fetchTimeMillis' api
russellwheatley Jul 14, 2020
aed05ee
docs(remote-config): update docs
russellwheatley Jul 14, 2020
0d8e879
chore(remote-config): api update
russellwheatley Jul 14, 2020
7999aec
Update packages/remote-config/type-test.ts
Salakar Jul 14, 2020
b997c38
Merge branch 'master' into @russell/remote-config-rework
Salakar Jul 15, 2020
f2b4ee6
chore(remote-config): further changes
russellwheatley Jul 15, 2020
f614f44
Merge branch '@russell/remote-config-rework' of github.com:invertase/…
russellwheatley Jul 15, 2020
439fb30
Merge branch 'master' into @russell/remote-config-rework
russellwheatley Jul 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions docs/remote-config/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,24 @@ remoteConfig()
## Reading values

With the defaults set and the remote values fetched from Firebase, we can now use the `getValue` method to get the
value by it's key. For example...
value and use a number of methods to retrieve the value (same API as Firebase Remote Config web SDK)

```js
const awesomeNewFeature = remoteConfig().getValue('awesome_new_feature');

if (awesomeNewFeature.value === 'enabled') {
// resolves value to string
if (awesomeNewFeature.asString() === 'enabled') {
enableAwesomeNewFeature();
}
// resolves value to number
// if it is not a number or source is 'static', the value will be 0
if (awesomeNewFeature.asNumber() === 5) {
enableAwesomeNewFeature();
}
// resolves value to boolean
// if value is any of the following: '1', 'true', 't', 'yes', 'y', 'on', it will resolve to true
// if source is 'static', value will be false
if (awesomeNewFeature.asNumber() === true) {
enableAwesomeNewFeature();
}
```
Expand All @@ -119,14 +131,14 @@ Object.entries(parameters).forEach(([key, parameter]) => {

When a value is read, it contains source data about the parameter. As explained above, if a value is read before it has
been fetched & activated then the value will fallback to the default value set. If you need to validate whether the value
returned from the module was local or remote, the `source` property can be conditionally checked:
returned from the module was local or remote, the `getSource()` method can be conditionally checked:

```js
const awesomeNewFeature = remoteConfig().getValue('awesome_new_feature');

if (awesomeNewFeature.source === 'remote') {
if (awesomeNewFeature.getSource() === 'remote') {
console.log('Parameter value was from the Firebase servers.');
} else if (awesomeNewFeature.source === 'default') {
} else if (awesomeNewFeature.getSource() === 'default') {
console.log('Parameter value was from a default value.');
} else {
console.log('Parameter value was from a locally cached value.');
Expand All @@ -150,23 +162,10 @@ await remoteConfig().fetch(300);
To bypass caching fully, you can pass a value of `0`. Be warned Firebase may start to reject your requests
if values are requested too frequently.

You can also apply a global cache frequency by calling the `setConfigSettings` method with the `minimumFetchInterval` property:
You can also apply a global cache frequency by calling the `setConfigSettings` method with the `minimumFetchIntervalMillis` property:

```js
await remoteConfig().setConfigSettings({
minimumFetchInterval: 300,
minimumFetchIntervalMillis: 30000,
});
```

## Developer Mode

Whilst developing your application, you may wish to frequently test how changing parameters impacts your application.
The API provides a way to enable developer mode which bypasses caching all together.

Set the `isDeveloperModeEnabled` flag to `true`:

```js
await remoteConfig().setConfigSettings({
isDeveloperModeEnabled: true,
});
```
```
Loading