Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Add receiving dynamic link capability to Firebase Dynamic Links Plugin #596

Merged
merged 40 commits into from
Jun 25, 2018

Conversation

bparrishMines
Copy link
Contributor

No description provided.

@bparrishMines bparrishMines changed the title Add receiving dynamic link capability to Firebase Dynamic Links Plugin Add receiving dynamic link capability to Firebase Dynamic Links Plugin (WIP) Jun 4, 2018
@bparrishMines bparrishMines changed the title Add receiving dynamic link capability to Firebase Dynamic Links Plugin (WIP) (WIP) Add receiving dynamic link capability to Firebase Dynamic Links Plugin Jun 4, 2018
@bparrishMines bparrishMines changed the title (WIP) Add receiving dynamic link capability to Firebase Dynamic Links Plugin [WIP] Add receiving dynamic link capability to Firebase Dynamic Links Plugin Jun 5, 2018
@bparrishMines bparrishMines changed the title [WIP] Add receiving dynamic link capability to Firebase Dynamic Links Plugin Add receiving dynamic link capability to Firebase Dynamic Links Plugin Jun 6, 2018
Copy link
Contributor

@mravn-google mravn-google left a 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.
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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);
Copy link
Contributor

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
  }
}

Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bparrishMines bparrishMines merged commit 46e8652 into flutter:master Jun 25, 2018
@bparrishMines bparrishMines deleted the receive_links branch June 25, 2018 20:46
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
flutter#596)

Add receiving dynamic link capability to Firebase Dynamic Links Plugin (flutter#596)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants