From bf1d4e6df0f3b746ea4b008e8a1500eb10bcf2ec Mon Sep 17 00:00:00 2001 From: ehesp Date: Thu, 18 Apr 2019 13:58:27 +0100 Subject: [PATCH] [skip ci] docs --- docs/config/android.md | 11 +++++ docs/config/index.md | 52 +++++++++++++++++++++++ docs/config/ios.md | 11 +++++ docs/config/quick-start.md | 84 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+) create mode 100644 docs/config/android.md create mode 100644 docs/config/index.md create mode 100644 docs/config/ios.md create mode 100644 docs/config/quick-start.md diff --git a/docs/config/android.md b/docs/config/android.md new file mode 100644 index 00000000..b29f54e9 --- /dev/null +++ b/docs/config/android.md @@ -0,0 +1,11 @@ +--- +title: Android Setup +description: Manually integrate Remote Config into your Android application. +--- + +# Android Setup + +> The following steps are only required if your environment does not have access to React Native +auto-linking. + +## TODO diff --git a/docs/config/index.md b/docs/config/index.md new file mode 100644 index 00000000..bf11c564 --- /dev/null +++ b/docs/config/index.md @@ -0,0 +1,52 @@ +--- +title: Remote Config +description: Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update. +--- + +# Performance Monitoring + +React Native Firebase provides native integration with Remote Config, allowing you to change the appearance +and/or functionality of your app without requiring an app update. Remote Config values added into the Firebase +console are accessible via a JavaScript API, giving you full control over when and how these are applied and take +effect within your application. + + + +## Getting Started + + + + Install & begin integrating your Remote Config settings into your application. + + + Remote Config has a wide range of use-cases. Our guides cover various scenarios on how to integrate it into your + application with real-world application. + + + The API reference covers everything required to successfully intgerate Remote Config into your apps. + + + +## Learn more + +Our documentation is a great place to start, however if you're looking for more help or want to help others, +check out the resources below: + +- [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native-firebase-config) +- [Github Issues](https://github.com/invertase/react-native-firebase/issues?utf8=%E2%9C%93&q=is%3Aissue+sort%3Aupdated-desc+label%3Aconfig+) +- [Firebase Documentation](https://firebase.google.com/docs/perf-mon?utm_source=invertase&utm_medium=react-native-firebase&utm_campaign=config) diff --git a/docs/config/ios.md b/docs/config/ios.md new file mode 100644 index 00000000..b49069e8 --- /dev/null +++ b/docs/config/ios.md @@ -0,0 +1,11 @@ +--- +title: iOS Setup +description: Manually integrate Remote Config into your iOS application. +--- + +# iOS Setup + +> The following steps are only required if your environment does not have access to React Native +auto-linking. + +## TODO diff --git a/docs/config/quick-start.md b/docs/config/quick-start.md new file mode 100644 index 00000000..31a325a9 --- /dev/null +++ b/docs/config/quick-start.md @@ -0,0 +1,84 @@ +--- +title: Quick Start +description: Get to grips with the basics of Remote Config in React Native Firebase +--- + +# Remote Config Quick Start + +## Installation + +Install this module with Yarn: + +```bash +yarn add @react-native-firebase/config +``` + +> Integrating manually and not via React Native auto-linking? Check the setup instructions for Android & iOS. + +## Module usage + +Import the Performance Monitoring package into your project: + +```js +import config from '@react-native-firebase/config'; +``` + +The package also provides access to the firebase instance: + +```js +import { firebase } from '@react-native-firebase/config'; +``` + +### Fetching, activating and getting values + +Before the values from the Firebase console can be used, they need to be fetched and activated. This can be done using +the `fetchAndActivate` method: + +```js +import config from '@react-native-firebase/config'; + +async function getValues() { + try { + const activated = await config().fetchAndActivate(); + + if (activated) { + const experimentalFeatureEnabled = await config().getValue('experiment'); + console.log('Experimental source: ', experimentalFeatureEnabled.source); + console.log('Experimental value: ', experimentalFeatureEnabled.value); + } + } catch (e) { + console.error(e); + } +} +``` + +### Setting default values + +In some cases you may want to fetch values from the console in the background without the process visibly impacting +your application. To prevent any race conditions where values are being requested (i.e. via `getValue`) before they +have been fetched and activated, it is recommended you set default values using `setDefaults`: + +```js +import config from '@react-native-firebase/config'; + +async function bootstrap() { + await config().setDefaults({ + experiment: false, + }); +} +``` + +### Developer mode + +Whilst developing, setting the developer mode to `true` allows config to bypass internal checks such as caching +which are applied in a production application. This can be done with the `setConfigSettings` method: + +```js +import config from '@react-native-firebase/config'; + +async function bootstrap() { + await config().setConfigSettings({ + isDeveloperModeEnabled: __DEV__, + }); +} +```