AshleyScirra commented on issue #1776: URL: https://github.com/apache/cordova-android/issues/1776#issuecomment-2757462347
We'd like to make use of the new support for the File System Access API in Cordova on Android for [Construct](https://www.construct.net/), and after finding it not working, I ended up here, so that's a long winded way of saying +1. What I found is some key remarks in [this Intent to Ship email thread](https://groups.google.com/a/chromium.org/g/blink-dev/c/x3IcFv2jY6c/m/HxuEfzBHAAAJ) for File System Access on Android and WebView. Some key quotes: > Hi Joel, could you summarise how this has ended up working on WebView, as there's neither permissions nor UI there? Will apps using WebView have to adopt anything? > ...apps that use webview will need to implement WebChromeClient#onShowFileChooser() for the JS code window.showOpenFilePicker() / showDirectoryPicker() / showSaveFilePicker(). I am working on adding more options to WebChromeClient.FileChooserParams to make it clearer when each is being used. The additional options will be available in a future (should be the next) API release. For permissions, the assumption is that if / when the app makes files available to JS code via onShowFileChooser(), the files are considered to have edit permissions. Any app that does not want to allow JS code to edit files should either not implement onShowFileChooser(), or should apply filtering. It looks like in cordova-android's source code SystemWebChromeClient.java already has an implementation for `onShowFileChooser()` - [see here](http://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java#L221). The [Android documentation for onShowFileChooser()](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowFileChooser(android.webkit.WebView,%20android.webkit.ValueCallback%3Candroid.net.Uri[]%3E,%20android.webkit.WebChromeClient.FileChooserParams)) includes in the description: > This is called to handle HTML forms with 'file' input type So I would guess what has happened is the old onShowFileChooser() method previously existed for `<input type="file">` and Cordova supported it, but now with support for the File System Access API there are new modes/options in that method that Cordova needs to take in to account. I've found in other webview test apps the "user aborted request" error comes up too, presumably because as with Cordova they also are not implementing the necessary path through onShowFileChooser(). It's not clear to me if the mentioned updates to `WebChromeClient.FileChooserParams` are now available - I'd guess not from a glance at the documentation, so perhaps we will have to wait for a future API update. Once available I'd consider paying for a developer's time to implement this - contact me at ash...@scirra.com if any Cordova developers are interested. The code from this site looks like it can be used as a test case for implementing this: https://file-system-access-demo.glitch.me/ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org