-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Add receiving dynamic link capability to Firebase Dynamic Links Plugin #596
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -20,7 +20,7 @@ You can create short or long Dynamic Links with the Firebase Dynamic Links Build | |||
https://abc123.app.goo.gl/WXYZ | |||
``` | |||
|
|||
You can create a Dynamic Link programmatically by setting the following parameters and getting the DynamicLinkParameters.url parameter. | |||
You can create a Dynamic Link programmatically by setting the following parameters and getting the `DynamicLinkParameters.url` parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter => property
Here and below.
- Accept the terms of service if you are prompted to do so. | ||
- Take note of your project's Dynamic Links domain, which is displayed at the top of the Dynamic Links page. You need your project's Dynamic Links domain to programmatically create Dynamic Links. A Dynamic Links domain looks like `APP_CODE.app.goo.gl`. | ||
|
||
Receiving dynamic links on *iOS* requires a couple more steps than *android*. If you only want to receive dynamic links on *android*, skip to step 4. You can follow a video on the next two steps [here.](https://youtu.be/sFPo296OQqk?t=2m40s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
android => Android, twice
@@ -71,6 +71,35 @@ final ShortDynamicLink shortenedLink = await DynamicLinkParameters.shortenUrl( | |||
final Uri shortUrl = shortenedLink.shortUrl; | |||
``` | |||
|
|||
## Handle Received Dynamic Links |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe discuss briefly what we are trying to accomplish with this -- either here or at the start of the page. It's not completely obvious at this point in the text that the plugin is about deep linking, and that "receiving dynamic links" is about having the app respond to a deep link received at launch time by navigating to the right place.
CURRENT_PROJECT_VERSION = 1; | ||
DEVELOPMENT_TEAM = EQHXZ8M8AV; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove DEVELOPMENT_TEAM
ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumptions from testing:
To receive dynamic links, you need to activate Associated Domain capability in Xcode. Because of this, this requires signing and which requires development team and Runner.Entitlements.
If I delete this, the example app would only run in our environment with proper setup.
CURRENT_PROJECT_VERSION = 1; | ||
DEVELOPMENT_TEAM = EQHXZ8M8AV; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove DEVELOPMENT_TEAM ids.
this.minimumVersion, | ||
); | ||
|
||
/// The time the user clicked on the dynamic link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In what? Milliseconds since the epoch?
/// The time the user clicked on the dynamic link. | ||
final int clickTimestamp; | ||
|
||
/// The version of the minimum version of your app that can open the link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate "version".
|
||
/// The the minimum version of your app that can open the link. | ||
/// | ||
/// It is app’s developer responsibility to open AppStore when received link |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> It is the app developer's responsibility ...
/// | ||
/// If there is no pending dynamic link, returns null. Otherwise, returns | ||
/// access to dynamic link parameters. | ||
Future<PendingDynamicLinkData> retrieveDynamicLink() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method always returns a Future. That Future completes to null, if there is no pending dynamic link.
final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.retrieveDynamicLink(); | ||
|
||
final Uri deepLink = data.link; | ||
goToRouteUsingDeepLink(deepLink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this requires some additional documentation. Since we receive the pending dynamic link asynchronously, there is the question of what, if anything, to show until it arrives. If we show nothing, we may miss a frame during launch. If we show something, the view is likely to flicker as we immediately navigate to where the deep link points us (probably the poorer alternative).
The readme should provide a recommendation, e.g. to do something like
Future<void> main() async {
final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.retrieveDynamicLink();
final Uri deepLink = data?.link;
runApp(widgetFor(deepLink));
}
Widget widgetFor(Uri deepLink) {
if (deepLink == null) {
// return app landing page
} else {
// calculate and return some page based on the deep link
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
flutter#596) Add receiving dynamic link capability to Firebase Dynamic Links Plugin (flutter#596)
No description provided.