-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Firebase dynamic links #563
Firebase dynamic links #563
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.
It's getting late here. I'll continue tomorrow.
@@ -0,0 +1,63 @@ | |||
# Uncomment this line to define a global platform for your project |
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.
Podfiles should not be included in the repo. Flutter tools autogenerates those, if missing.
This one is out of date, by the way.
@@ -0,0 +1,3 @@ | |||
## 0.0.1 | |||
|
|||
* Initial Release |
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.
[nit] Change log entries should be grammatically complete phrases using standard US spelling. So
* Initial release.
would be more correct (though it arguably still conveys too little information; what are the initial features?).
|
||
*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback](https://github.com/flutter/flutter/issues) and [Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome! | ||
|
||
## Usage |
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.
[nit] Please add empty line after the heading for consistency with the other sections.
You can create short or long Dynamic Links with the Firebase Dynamic Links Builder API. This API accepts either a long Dynamic Link or an object containing Dynamic Link parameters, and returns a URL like the following example: | ||
|
||
```dart | ||
|
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.
[nit] Padding lines at the start and end of code snippets should not be necessary. The md2html transformation should already take care of it in a visually pleasing way.
Oh, and this snippet is not Dart by the way.
```dart | ||
|
||
final DynamicLinkComponents components = new DynamicLinkComponents( | ||
domain: 'abc123.app.goo.gl', |
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.
[nit] Dart indentation is 2 spaces. This code uses both 4 and 2 spaces.
|
||
environment: | ||
sdk: ">=2.0.0-dev.28.0 <3.0.0" | ||
flutter: ">=0.2.4 <2.0.0" |
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 end file with an empty line.
/// Short url value. | ||
final Uri shortUrl; | ||
|
||
/// Gets information about potential warnings on link creation. |
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.
Getters should be documented with a noun phrase describing what the property is.
class NavigationInfoParameters { | ||
NavigationInfoParameters({this.forcedRedirectEnabled}); | ||
|
||
/// Should forced non-interactive redirect be used when link is tapped on mobile device. |
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 is formulated like a question, but no question mark? Maybe
/// Whether forced non-interactive redirect should be used when link is tapped on mobile device.
/// a domain and a randomized path. Long URLs will have a domain and a query | ||
/// that contains all of the Dynamic Link parameters. | ||
class DynamicLinkComponents { | ||
DynamicLinkComponents({ |
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.
Dartdoc says this class is used for Dynamic Link URL generation. Dartdoc also implies that instances somehow describe Dynamic Link parameters. The class is called DynamicLinkComponents.
This is mildly confusing terminology...
}); | ||
|
||
/// Applies Android parameters to a generated Dynamic Link URL. | ||
AndroidParameters androidParameters; |
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 make this class immutable, if at all possible. It seems clients are supposed to specify all components using the constructor. And all the parameter classes below are immutable.
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'm done. Some more nits and a few real change requests. Overall, LVGTM.
@@ -0,0 +1,8 @@ | |||
.DS_Store |
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 all .gitignore
files from individual plugins. If you rebase to master, the repo root .gitignore
should make git ignore all the files we don't want to check in.
disable 'InvalidPackage' | ||
} | ||
dependencies { | ||
api 'com.google.firebase:firebase-invites:15.0.0' |
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 update this dependency to 15.+
so it stays consistent with other firebase plugins.
String content = (String) googleAnalyticsParameters.get("content"); | ||
String medium = (String) googleAnalyticsParameters.get("medium"); | ||
String source = (String) googleAnalyticsParameters.get("source"); | ||
String term = (String) googleAnalyticsParameters.get("term"); |
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.
You could consider adding a local helper method a la MethodCall.argument(String)
static <T> T valueFor(String key, Map<String, Object> map) {
@SuppressWarnings("unchecked")
T result = (T) map.get(key);
return result;
}
Then you can avoid all the casts.
@@ -0,0 +1,6 @@ | |||
#Mon May 07 13:02:14 PDT 2018 |
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 appears you have removed the wrong gradle-wrapper.properties
file. You want such a file in the example/android
folder, not the app/
subfolder. And it should refer to gradle-4.1-all
to be consistent with all the other plugins.
part 'src/itunes_connect_analytics_parameters.dart'; | ||
part 'src/navigation_info_parameters.dart'; | ||
part 'src/short_dynamic_link.dart'; | ||
part 'src/social_meta_tag_parameters.dart'; |
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 have not seen this "one part = one file = one class" style before with Dart. Seems like a Java thing, really. But I have no strong opinion here.
@required this.link, | ||
this.navigationInfoParameters, | ||
this.socialMetaTagParameters, | ||
}); |
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.
You should really add }) : assert(domain != null), assert(link != null);
here. The @required
annotation yields an analyzer error, if you leave out the parameter at a call site, not if you explicitly set it to null
.
Same in other classes.
'title': 'bro', | ||
}, | ||
}), | ||
]); |
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.
A few trailing commas (after ]
I believe) should help reduce all indentation to two spaces in the above code.
@@ -0,0 +1,415 @@ | |||
// Copyright 2017 The Chromium Authors. All rights reserved. |
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.
New files should use the current year. (When update existing files, we leave the header as is.)
Applies in many places.
* Initial project creation * Added Firebase Dynamic Links library * Dart side for create dynamic links * Added gradle to .gitignore * Implement android create dynamic link * Removed gradle stuff * iOS implementation of creating link * Dynamic link creation fixes * Added short link creation * Added shortening of dynamic link * Created example UI * Added testing * License and plugin info * Added pub info * Brackets over braces * Comments and FLT prefix * Cleaned up platform code * Formatting changes * Added short link error exception * Formatting * More Formatting * Parentheses and fixed tests * Fixed README * Added short link warnings * Formatting * Formatting * More comments * Added ShortDynamicPathLength test * ShortLinks now throw flutter error * Formatting * Addressing some comments * Addressing more comments * Addressing more comments * Formatting * PR comments * Formatting and PR comments * Changed name Components -> Parameters * Updated README * Now I understand why trailing commas * Removed gradle-wrapper files * Removed .gitigores * Added map helper function and updated gradle * Added gradle-wrapper.properties * Added assert to test for nulls * Comma formatting * Update Licenses to 2018 * Formatting * Remove gradle properties
Initial release for Firebase Dynamic Links