Closed ghiculescu closed 3 years ago
While it's entirely possible to add file upload support in your app on top of turbo-android
(it's what we do in HEY), I think it's a good idea to bring out-of-the-box support to the library. I've started that work in https://github.com/hotwired/turbo-android/pull/123 and there's some remaining work to do. I'll update when it's ready.
It doesn't look like turbo-android exposes the underlying Webview
You can access the WebView
instance through the TurboSession
instance. In any Fragment
this can be done through session.webView
.
You can also subclass the TurboWebView
class and provide your own instance to the library, however this shouldn't be necessary for most situations. You'd do it like:
class MainSessionNavHostFragment : TurboSessionNavHostFragment() {
// ...
override fun onCreateWebView(context: Context): TurboWebView {
return MyCustomTurboWebView(context)
}
}
Thanks @jayohms you're the best <3 Happy to help test it.
@ghiculescu File upload support is now available in 7.0.0-beta02
Closing this, but please let me know if you run into any issues.
Thank you @jayohms - it works great. I really appreciate you jumping on this so quickly.
Thanks for releasing turbo-android, so excited to see it live!
I was wondering if you have any plans to add support for
<input type=file>
. According to https://stackoverflow.com/questions/29045637/html-input-type-file-is-not-working-on-webview-in-android-is-there-any-way-to (and many many other SO posts) it's not supported byandroid.webkit.WebView
.To replicate, point a demo app at
polite-adaptive-walk.glitch.me
. Clicking "choose file" will do nothing.It doesn't look like
turbo-android
exposes the underlyingWebview
, so I'm not sure where to start in terms of tinkering with ways to make this work. For example I found https://github.com/delight-im/Android-AdvancedWebView but I don't get the impression it'll be easy to make it work. Before I start trying anyway, I was wondering if this is an issue you all are aware of and have any plans/workarounds for?This is my first time building an app in Android natively, but I've seen similar issues on react-native apps (example). Please let me know if I've made some fundamentally dumb assumptions about the OS.