-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter] Add file chooser on Android #3225
Conversation
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@googlebot I fixed it |
e8319b9
to
24711b7
Compare
1839ad9
to
5dd5353
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but 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 by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
Something weird happened with the rebase of this branch, I can see things that are already merged (like the move of camera to camera/camera). Do you mind rebasing this a little better, so we can see only the changes you worked on? Thanks! |
Also: there's a |
5dd5353
to
8540259
Compare
Don't know what happened there, but thanks for pointing that out! |
@ditman Not sure about the 'file_selector' plugin. Would that also cover taking a picture with the camera? |
8f070e7
to
42fdb08
Compare
@ditman Can we use the image_picker plugin in webview_flutter (regarding dependencies)? The point of this PR is to mimic the behaviour that is standard on iOS. I mean, would it make sense to depend on another plugin just for Android? The current implementation in this PR completely solves the issue we are facing in our app. On iOS we can upload an image (either using the camera or from the library), and with this PR the very same is now possible on Android. No other plugins are required to do this. |
@fesp I misunderstood the intent of this PR. This is to enable the input type file when rendering a webview. The other plugins let you select a file in a normal flutter app (not within a webview). Thanks for the contrib!! |
de21f4d
to
4525fa5
Compare
@firatcetiner Please do not approve PRs, as it serves no purpose and creates confusion. As our docs say, this is reserved for people with commit access. |
I'm using:
With that I get the option of using my camera to take a picture/video or pick a file using the file browser app (from where I could go to my gallery app). Adding In general I think instead of depending on fixed package names it's better to use general intents, as not everyone uses the Google Photos/Docs/... app. I tried
but that didn't prompt me to use the gallery directly either. Maybe it'd work on other devices? |
@fesp Are you planning on adding tests to this PR to move it forward? Are you still having issues running tests locally? |
@stuartmorgan I'm sorry it is taking so long, but I'm still planning on getting this done. I'm able to run the tests and wrote one for this PR but didn't get it to work the first time. I'm very busy at the moment, but I'll try to find a moment to look into it a bit more. |
It's very helpful 👍 , thank you |
We are also using this patch successfully. After #3325 got merged this ist the only missing piece for us! A big thumbs up for working on it! 😄 👍 |
Why hasn't it been fixed? |
After some conversations on the sidelines I want to create a different solution that is easier to test and maintain. The solution might be depending on flutter/flutter/issues/94051 |
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. 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. |
Based on discussion in the document linked above, the way we plan to move forward with file selection is by exposing the callback, so that clients of the plugin can register whatever handler they like. That will avoid the problem of needing to permanently maintain what is essentially a second copy of plugins that we already need to maintain separately, and will give people more flexibility if they want to use different implementations. It also makes the permissions opt-in rather than required, which is also good for flexibility. Once that's implemented, we can evaluate whether it's helpful to provide a default implementation of that public handler (e.g., using Given that direction, I'm going to close this. Thanks again for the contribution though! |
Is there an issue/a PR where the progress on implementing the above document can be followed? |
The issue linked from the PR description is still the relevant issue. |
@stuartmorgan I need to bring your attention that the referenced document is overwritten and its contents have changed. Have a look for yourself. |
I don't own that document, so can't change it. The core conclusion from the discussion in the document is summarized above though. |
Hi @fesp / @tneotia @darshankawar cud you also please have a look? |
Guys could anyone help me with which patch I can use to get it working? |
@stuartmorgan what is the current status of exposing the callbacks for handling the file uploads? If it is already done can you please link the relevant documentation? |
Description
Currently on Android nothing happens for
<input type="file">
. This PR solves that, allowing the user to choose a file and optionally use the camera.Related Issues
flutter/flutter#27924
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?