[docs] ml natural language docs & firebase.json docs

This commit is contained in:
Salakar
2019-06-04 14:20:46 +01:00
parent af2bae0bde
commit f4c1596714
7 changed files with 212 additions and 49 deletions

98
docs/app/firebase-json.md Normal file
View File

@@ -0,0 +1,98 @@
---
title: Configure via firebase.json
description: Configure your Firebase services via a `firebase.json` file.
---
# React Native Firebase JSON Configuration
As part of the many steps we've taken to simplify using Firebase with React Native; React Native Firebase now allows you to configure various options across all its supported Firebase services via a single `firebase.json` file in your project root.
These options are here to replace steps where you'd normally have to make native code changes to your project.
**Supported Platforms:** Android, iOS (via CocoaPods only)
## Structure
All options for React Native Firebase must be placed inside a wrapping `react-native` object.
**Supported Values**: `boolean`, `string`, `number`
> Nested items inside `"react-native"` are not supported.
### Example
```json
{
"react-native": {
"crashlytics_ndk_enabled": true,
"crashlytics_debug_enabled": true,
"crashlytics_auto_collection_enabled": false,
"ml_natural_language_language_id_model" : true,
"ml_natural_language_smart_reply_model" : false,
"ml_vision_face_model" : true,
"ml_vision_image_label_model" : false,
"ml_vision_object_detection_model" : true,
"messaging_auto_init_enabled": false
}
}
```
## Non Firebase Usage
You may find it useful to use it for non-Firebase things in your project, e.g:
- toggling a feature
- injecting values into your Android manifest
- switching Android source sets
- controlling optional dependencies
- controlling native dependency versions
- customising build time logic
- customising runtime logic
- switching which podspec to use based
All config items in a `firebase.json` file can be read at every stage of your app's build/run cycle:
- Android
- Inside Gradle build
- Inside native code (e.g. Java)
- iOS
- Inside Script Phases
- Inside Pod install (e.g. can be read inside pod specs)
- Inside native code (e.g. Objective-C)
- JS
- Inside your app bundle
- RN CLI - Project Config (`react-native.config.js`)
- RN CLI - Dependency Config (`react-native.config.js`)
To help you with this we've documented the internal APIs that are accessible at every location:
#### Android - Runtime (Java)
TODO
#### Android - Build time (Groovy)
TODO
#### iOS - CocoaPods (Ruby)
TODO
#### iOS - Script Phases (Bash)
TODO
#### iOS - Runtime (Objective-C)
TODO
#### RN CLI - Project Config (`react-native.config.js`)
TODO
#### RN CLI - Dependency Config (`react-native.config.js`)
TODO

View File

@@ -1,11 +0,0 @@
---
title: Android Setup
description: Manually integrate ML Kit 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

View File

@@ -1,32 +0,0 @@
---
title: Quick Start
description: Get to grips with the basics of ML Kit in React Native Firebase
---
# ML Kit Quick Start
## Installation
Install this module with Yarn:
```bash
yarn add @react-native-firebase/mlkit@alpha
```
> Integrating manually and not via React Native auto-linking? Check the setup instructions for <Anchor version group href="/android">Android</Anchor> & <Anchor version group href="/ios">iOS</Anchor>.
## Module usage
Import the ML Kit package into your project:
```js
import mlkit from '@react-native-firebase/mlkit';
```
The package also provides access to the firebase instance:
```js
import { firebase } from '@react-native-firebase/mlkit';
```
### TODO

View File

@@ -0,0 +1,48 @@
---
title: Android Setup
description: Manually integrate ML Kit Natural Language into your Android application.
---
# Android Setup
## Manual Android Integration
> The following steps are only required if your environment does not have access to React Native
> auto-linking.
#### Add ML Kit Natural Language to Gradle Settings
**`android/settings.gradle`**:
```groovy
include ':@react-native-firebase_ml-natural-language'
project(':@react-native-firebase_ml-natural-language').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/ml-natural-language/android')
```
#### Add ML Kit Natural Language to App Gradle Dependencies
**`android/app/build.gradle`**:
```groovy{4}
// ..
dependencies {
// ..
implementation project(path: ":@react-native-firebase_ml-natural-language")
}
```
#### Add ML Kit Natural Language to Main Android Application:
**`android/app/src/main/java/**/MainApplication.java`\*\*:
```java{2,8}
// ..
import io.invertase.firebase.ml.naturallanguage.ReactNativeFirebaseMLNaturalLanguagePackage;
// ..
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new ReactNativeFirebaseMLNaturalLanguagePackage(),
// ..
```

View File

@@ -1,14 +1,21 @@
---
title: ML Kit
description: ML Kit lets you bring powerful machine learning features to your React Native app.
title: ML Kit Natural Language
description: ML Kit Natural Language APIs lets you bring powerful Natural Language machine learning features into your React Native app.
---
# ML Kit
# ML Kit - Natural Language
Firebase ML Kit brings the power of machine learning to your React Native application, supporting both Android & iOS.
<Youtube id="ejrn_JHksws" />
ML Kit Natural Language for React Native currently supports the following APIs:
- [Language Identification](https://firebase.google.com/docs/ml-kit/identify-languages)
- [Smart Reply](https://firebase.google.com/docs/ml-kit/generate-smart-replies)
Support for Translate APIs coming in a later release.
## Getting Started
<Grid>
@@ -41,7 +48,7 @@ Firebase ML Kit brings the power of machine learning to your React Native applic
## Learn more
Our documentation is a great place to start, however if you're looking for more help or want to help others,
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-mlkit)

View File

@@ -1,11 +1,11 @@
---
title: iOS Setup
description: Manually integrate ML Kit into your iOS application.
description: Manually integrate ML Kit into your iOS application.
---
# iOS Setup
> The following steps are only required if your environment does not have access to React Native
auto-linking.
> auto-linking.
## TODO

View File

@@ -0,0 +1,53 @@
---
title: Quick Start
description: Get to grips with the basics of ML Kit in React Native Firebase
---
# ML Kit Quick Start
## Installation
Install this module with Yarn:
```bash
yarn add @react-native-firebase/ml-natural-language@alpha
```
> Integrating manually and not via React Native auto-linking? Check the setup instructions for <Anchor version group href="/android">Android</Anchor> & <Anchor version group href="/ios">iOS</Anchor>.
## Module usage
Import the ML Kit package into your project:
```js
import mlNaturalLanguage from '@react-native-firebase/ml-natural-language';
```
The package also provides access to the firebase instance:
```js
import { firebase } from '@react-native-firebase/ml-natural-language';
```
### Configuring Models
To be able to use the APIs you'll need to enable the models for the APIs you wish to use.
React Native Firebase allows you to configure these in via a `firebase.json` file in your project root.
Add any of the keys indicated below to your JSON file and set them to `true` to enable them. All models and APIs are disabled (`false`) by default.
```json5
{
"react-native": {
// Language Identification
"ml_natural_language_language_id_model": false,
// Smart Replies
"ml_natural_language_smart_reply_model": false
}
}
```
> If you are manually linking on iOS (e.g. not using CocoaPods) then it's up to you to manage these models and dependencies yourself - `firebase.json` support is only for Android and iOS (via Pods).
To learn more, view the <Anchor version group="app" href="/firebase-json">App documentation</Anchor>.