[docs] dynamic links docs fixes
This commit is contained in:
parent
49a54ebedc
commit
9758c99537
|
@ -26,6 +26,7 @@
|
|||
- [Crash Reporting](/modules/crash)
|
||||
- [Database](/modules/database)
|
||||
- [Firestore (Beta)](/modules/firestore)
|
||||
- [Dynamic Links](/modules/links)
|
||||
- [Remote Config](/modules/config)
|
||||
- [Storage](/modules/storage)
|
||||
- [Transactions](/modules/transactions)
|
||||
|
|
|
@ -215,7 +215,9 @@ dependencies {
|
|||
If you plan on using [Firebase Dynamic
|
||||
Links](https://firebase.google.com/docs/dynamic-links/):
|
||||
|
||||
In `android/app/src/main/AndroidManifest.xml`, add a new intent filter to the activity that handles deep links for your app, and specify the host and the scheme:
|
||||
Make sure to setup dynamic links for Android as described [here](https://firebase.google.com/docs/dynamic-links/android/receive#set-up-firebase-and-the-dynamic-links-sdk)
|
||||
|
||||
In `android/app/src/main/AndroidManifest.xml`, add a new intent filter to the activity that handles deep links for your app (for react-native this is usually MainActivity), and specify the host and the scheme:
|
||||
|
||||
```xml
|
||||
<intent-filter>
|
||||
|
|
|
@ -166,17 +166,21 @@ https://firebase.googleblog.com/2017/01/debugging-firebase-cloud-messaging-on.ht
|
|||
|
||||
If you plan on using [Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links/) then, you need to:
|
||||
|
||||
### 5.1) create a new URL type
|
||||
### 5.1) Setup
|
||||
|
||||
Make sure to setup dynamic links for iOS as described [here](https://firebase.google.com/docs/dynamic-links/ios/receive#set-up-firebase-and-the-dynamic-links-sdk)
|
||||
|
||||
### 5.2) create a new URL type
|
||||
|
||||
In the Info tab of your app's Xcode project, create a new URL type to be used for Dynamic Links. Set the Identifier field to a unique value and the URL scheme field to either your bundle identifier or a unique value.
|
||||
|
||||
### 5.2) Enable Associated Domains capability
|
||||
### 5.3) Enable Associated Domains capability
|
||||
|
||||
In the Capabilities tab of your app's Xcode project, enable Associated Domains and
|
||||
add the following to the Associated Domains list:
|
||||
`applinks:app_code.app.goo.gl` where `app_code` is your dynamic links domain application code.
|
||||
|
||||
### 5.3) Update `AppDelegate.m`
|
||||
### 5.4) Update `AppDelegate.m`
|
||||
|
||||
Add the following import:
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ All Dynamic Links operations are accessed via `firebase.links()`
|
|||
|
||||
## Create Dynamic Links
|
||||
|
||||
RNFirebase mimics [The REST API](https://firebase.google.com/docs/dynamic-links/rest) for Dynamic Links creation.
|
||||
RNFirebase mimics [Firebase's REST API](https://firebase.google.com/docs/dynamic-links/rest) for Dynamic Links creation.
|
||||
The differences from the REST API are:
|
||||
1. The input for the methods is a javascript object instead of a JSON object.
|
||||
2. The response contains the URL string only.
|
||||
|
@ -22,7 +22,7 @@ Creates a long dynamic link.
|
|||
firebase.links().createDynamicLink({
|
||||
dynamicLinkInfo: {
|
||||
dynamicLinkDomain: "abc123.app.goo.gl",
|
||||
link: "https://example.com/",
|
||||
link: "https://example.com?param1=foo¶m2=bar",
|
||||
androidInfo: {
|
||||
androidPackageName: "com.example.android"
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ Creates a short dynamic link.
|
|||
```javascript
|
||||
firebase.links().createShortDynamicLink(dynamicLinkInfo: {
|
||||
dynamicLinkDomain: "abc123.app.goo.gl",
|
||||
link: "https://example.com/",
|
||||
link: "https://example.com?param1=foo¶m2=bar",
|
||||
androidInfo: {
|
||||
androidPackageName: "com.example.android"
|
||||
},
|
||||
|
@ -108,7 +108,7 @@ firebase.links().getInitialLink().then((url) => {
|
|||
});
|
||||
```
|
||||
|
||||
#### `onLink(listener: Function): () => any`
|
||||
#### `onLink(listener: Function<String>): Function`
|
||||
|
||||
On a new URL, the payload URL is passed to the listener callback. This method is only triggered when the app is running. Use getInitialLink for URLs which cause the app to open.
|
||||
In order to subscribe to the listener, call to the method with a callback and save the returned function.
|
||||
|
@ -116,7 +116,7 @@ When you want to unsubscribe, just call the function that returned at subscripti
|
|||
|
||||
```javascript
|
||||
// Subscribe
|
||||
const unsubscribe = firebase.links().onLink().then((url) => {
|
||||
const unsubscribe = firebase.links().onLink((url) => {
|
||||
//...
|
||||
});
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export default class Links extends ModuleBase {
|
|||
|
||||
/**
|
||||
* Returns the link that triggered application open
|
||||
* @returns {*}
|
||||
* @returns {Promise.<String>}
|
||||
*/
|
||||
getInitialLink() {
|
||||
return this._native.getInitialLink();
|
||||
|
@ -30,17 +30,27 @@ export default class Links extends ModuleBase {
|
|||
/**
|
||||
* Subscribe to dynamic links
|
||||
* @param listener
|
||||
* @returns {*}
|
||||
* @returns {Function}
|
||||
*/
|
||||
onLink(listener: Function): () => any {
|
||||
const rnListener = this._eventEmitter.addListener(EVENT_TYPE.Link, listener);
|
||||
return () => rnListener.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create long Dynamic Link from parameters
|
||||
* @param parameters
|
||||
* @returns {Promise.<String>}
|
||||
*/
|
||||
createDynamicLink(parameters: Object = {}): Promise<String> {
|
||||
return this._native.createDynamicLink(parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create short Dynamic Link from parameters
|
||||
* @param parameters
|
||||
* @returns {Promise.<String>}
|
||||
*/
|
||||
createShortDynamicLink(parameters: Object = {}): Promise<String> {
|
||||
return this._native.createShortDynamicLink(parameters);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue