IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
290 stars 109 forks source link

webview input file / download file #244

Closed johnd0e closed 5 years ago

johnd0e commented 5 years ago

It's common task for iitc plugins - load local file to import some data. And html has element for this - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

But to make it work in WebView - additional setup required: https://google.com/search?q=webview+input+file

Unfortunately IITCm does not follow that recommendations, and implements own way: adds one more function, which get result requesting //request-file.iitcm.localhost/onFileSelectedXXXX in cumbersome way:

https://github.com/IITC-CE/ingress-intel-total-conversion/blob/256f9c53a866a254b40e40b1f766e58b4d2a89f4/code/smartphone.js#L206-L219

Although that code works (most of the time), but this approach introduces fragmentation: in order to support both mobile and desktop, developer has to:

Besides, IITCm function is limited:

johnd0e commented 5 years ago

The similar issue is for downloading file: we have separate function android.saveFile, instead of setting download listener