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

Add download url support to Firebase Storage plugin #457

Merged
merged 10 commits into from
Apr 9, 2018

Conversation

kroikie
Copy link
Contributor

@kroikie kroikie commented Apr 2, 2018

Add getDownloadUrl support to the Firebase Storage plugin.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@@ -48,6 +48,13 @@ class StorageReference {
);
}

Future<String> getDownloadURL() async {
final dynamic downloadUrl = await FirebaseStorage._channel.invokeMethod(
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 you can make this non-async and say return FirebaseStorage._channel.invokeMethod(...

See delete for another example of this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done,

Is there any advantage to having the return type here by Future<String> instead of Future<dynamic>

Copy link
Contributor

Choose a reason for hiding this comment

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

It's documenting that we're returning a String here and not some other type like a Uri.

Future<String> getDownloadURL() async {
final dynamic downloadUrl = await FirebaseStorage._channel.invokeMethod(
"StorageReference#getDownloadUrl",
<String, String>{'path': _pathComponents.join("/")});
Copy link
Contributor

Choose a reason for hiding this comment

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

If you put a trailing comma here you can avoid the double-indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -53,6 +53,46 @@ void main() {
});
});

group('getDownloadUrl', () {
const MethodChannel channel = const MethodChannel(
Copy link
Contributor

Choose a reason for hiding this comment

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

This plugin should match the other plugins in terms of the method channel name: 'plugins.flutter.io/firebase_storage'. This is can be done in a separate CL, I filed flutter/flutter#16171

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted.


setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
print('get download called');
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for print statements in tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -48,6 +48,13 @@ class StorageReference {
);
}

Future<dynamic> getDownloadURL() async {
Copy link
Contributor

@collinjackson collinjackson Apr 3, 2018

Choose a reason for hiding this comment

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

you could make this not be async and remove the await (in addition to specifying the return type)

Copy link
Contributor

Choose a reason for hiding this comment

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

I was mistaken, this is actually necessary in strong mode

Copy link

@rrousselGit rrousselGit Apr 9, 2018

Choose a reason for hiding this comment

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

is the dynamic really needed ? Why not String ?

@collinjackson collinjackson merged commit d566d02 into flutter:master Apr 9, 2018
slightfoot pushed a commit to slightfoot/plugins that referenced this pull request Jun 5, 2018
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants