Closed sorainnosia closed 4 years ago
Hi @sorainnosia !
Thanks for the bug report !
It seem that there is maybe a callback missing in the current configuration of GeckoView engine in BlazorMobile.
It should works on other platform.
In the meantime, you may try to redirect a button of your app to a native file picker, but it's more a workaround.
I'm investigating this issue, if i found a overridable workaround i will tell you what to write in your app.
Otherwise if it's not possible you will have to wait for a minor update !
Note for myself:
We may take inspiration from Firefox Focus prompt delegate code:
File picking with apps behavior:
https://forums.xamarin.com/discussion/139363/opening-filechooser-with-camera-option
I have made a lot of code about this today in order to make the input type='file' working on Android with GeckoView.
Permissions asking is ready, and call to Android intents seems ok, but i still need works on the file data retrieving, and on the file access emulation support for the browser.
I will keep this updated (see previous comment with checkbox's)
Editing this issue in regard of https://github.com/Daddoon/BlazorMobile/issues/187
Renamed the issue
Maybe you can work around file input making a file component which checks first the device platform if is wp, android or ios call native file picker using proxy interface. Anything else use the regular file input picker from web browser. It should not be a big deal. I will try making this workaround and post the code to workaround this issue in the meantime.
The filepicker should work perfectly on UWP, iOS and Electron by default.
Actually filepicker must be more complete on Android, as you should be able to select your Android activity app from where you are searching your data.
I'm working on this actually, but it's a little time consuming. I prefer to fix this the right way instead of hacking something.
But yes, in the meantime you may do some hackery manually on your side with native events and data transfer, but i may be not very performant, as it will serialize bytes[] to base64, i imagine, and then there is some Javascript to C# marshalling in order to retrieve it in Blazor (with IJSRuntime).
I have tried to port Javascript call to native to C# on another branch BUT...There is also a bug in Mono WebAssembly that must be fixed first too, that i reported to Mono team.
I found and tested this package and works. https://github.com/jfversluis/FilePicker-Plugin-for-Xamarin-and-Windows
I will wait until you fix this.
I totally forgot the file input have others options than just read a file from device.
A file input have the options to open the camera, take a photo or video which is something it should be built in when we use a file input on device after setting up the accept
attribute on the input file.
Yes.
And it can be a fileinput with a multiple attribute, in order to select multiple file.
Accept is also an attribute that must be managed but it's not strictly mandatory for a first version, at least if i read the Tip on w3schools: https://www.w3schools.com/tags/att_input_accept.asp
But user should be able to select his app.
At the moment i'm managing to call a list of Camera or Gallery compatible Intents on Android, and show them listed before taking any action.
I must face some issue about Android permissions.
Next steps will be to search how to generically fetch data from the external intents after file selection, and then copy them on an accessible temp path in order to allow the file:// signature to work from the browser, due to some GeckoView limitation in the version currently used.
File input management is nearly finished !
It now works on this branch: https://github.com/Daddoon/BlazorMobile/tree/dev_blazormobile_3.2.4-preview2.20160.5_geckoview_fileinput
In my test project, i can choose a file from any compatible Android app, and load it on the web page with Javascript after selection.
Some additional notes:
Good. I don't usually work or manage multiple files in one input so I don't care too much about it just want file management work, and the accept attribute should not do anything on platform just on the web so everything seems ok for me.
A new version has been released !
See migration guide here: https://github.com/Daddoon/BlazorMobile/blob/master/MIGRATION.md#blazormobile-323-preview2201605-to-324-preview2201605
There is still some events implementation missing. This has been transfered in this issue: https://github.com/Daddoon/BlazorMobile/issues/190
It will be for a next release.
Closing.
I can confirm File input now working properly.
Hi,
In Android project, the HTML5 markup
does not open up Gallery and does nothing (no respond) Or do I suppose to use Xamarin markup?