-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Add file upload on Android #5172
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
Line was not supposed to be committed
…ch/flutter-plugins into android-on-show-file-chooser
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.
Thanks for the submission! At a high level this looks like what was discussed in the previous PR. @bparrishMines should take a high-level look as well.
There is an issue currently blocking moving forward with this though, as noted below (unless we added a different, separate handler object, but that would be ugly).
@@ -27,6 +27,8 @@ abstract class WebViewPlatformCallbacksHandler { | |||
/// /// Only works when [WebSettings.hasProgressTracking] is set to `true`. | |||
void onProgress(int progress); | |||
|
|||
Future<List<String>> onShowFileChooser(); |
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 a breaking change as things are currently structured, so adding this will need to wait for the platform interface API update.
@mvanbeusekom @bparrishMines Can we verify that this kind of change will indeed by safe in the updated version?
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.
Yes, I don't see any reason this won't be possible with the new interface. The only difference is that we may make this unique to AndroidWebViewControllerDelegate
. Which would only slightly change how it is used in this PR.
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.
@bparrishMines what's the branch of the "new interface" ?
I understand that you are refactoring webview_flutter and you want to be sure that this PR will fit the new design.
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.
The work on the new interface can be tracked at: flutter/flutter#94051.
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.
Ok, in the meantime, this PR is stale right ?
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.
Not all of it. The part that adds it to the native api WebChromeClient
wrapper should remain valid. Reducing the PR to this will make it easier to add it to the new interface at a later point.
@dupuchba Are you interested in following-up with the narrower scope @bparrishMines suggested above? |
Yes I am, I was thinking at adding this when @bparrishMines work would be ready :-) ! |
Hi @dupuchba I need a way out ASAP. Could you guide me where do I make the change? I am all confused looking at the new arch. [UPDATE]: I made the changes to the package based on your changes and still it doesn't work. |
hey @Shubhankt1 I am going on holidays and I don't have the time to get back at this issue. Last April I said I would make a PR with the new plugin architecture for flutter_webview, once it's done. |
Status update from triage: Still blocked on flutter/flutter#94051, but we hope to have that resolved soon. |
Isn't it frustrating that if this a solution, it cannot be merged for everyone to use? |
@godilite to be faire I've not updated my commit to the new platform infrastructure. |
Hi. I am happy to see flutter/flutter#94051 merged which was blocking this. Now, is there a timeframe for when this will be closed? I am holding an update to my app based on your comments. thanks and best. |
@rashidotm excellent news ! I am probably going to address this in January 23 |
@bparrishMines thanks a lot for your time and work. |
Currently on Android nothing happens for
<input type="file">
This PR solves that by registering the callback
onShowFileChooser
on theWebView
that must returns aFuture<List<String>>
(list of file path).It lets you use which-ever file-provider plugin you want to use as recommended by @stuartmorgan here.
Status:
Thanks all
Related issues
#3225
flutter/flutter#27924
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.