-
Notifications
You must be signed in to change notification settings - Fork 475
Engine events that require a callback #1110
Comments
Let's look at the APIs in more detail: Geolocation requestsWhat needs to happen?
GeckoView
WebView
File uploadsWhat needs to happen?
GeckoView
WebView
Permission requestsWhat needs to happen?
GeckoView
WebView
WindowsWhat needs to happen?
GeckoView
WebView
|
Observations:
|
I wonder if we could put some state into |
Summarizing our current plan on how to implement these engine callbacks: We'll use our existing interface Observer {
...
fun onFilePrompt(filePromptRequest: FilePromptRequest) = Unit
fun onShowGeoPermissionPrompt(geoPromptRequest: GeoPromptRequest)
fun onHideGeoPermissionPrompt(geoPromptRequest: GeoPromptRequest)
...
} These class GeckoFilePrompt(private val context: Context,
private val title: String,
private val type: Int,
private val mimetype: Array<String>,
private val callback: GeckoSession.PromptDelegate.FileCallback
) : FilePrompt {
override fun confirm(uris: Array<Uri>) {
callback.confirm(context, uris)
}
} class SystemFilePrompt(private val callback: ValueCallback<Array<Uri>>,
private val fileChooserParams: WebChromeClient.FileChooserParams
) : FilePrompt {
override fun confirm(uris: Array<Uri>) {
callback.onReceiveValue(uris)
}
} When these observer methods are called, override fun onFilePrompt(filePromptRequest: FilePromptRequest) {
session.filePrompt = Consumable.from(filePromptRequest)
} All components observing browser session changes (currently all Presenters) can then react and consume these requests by showing the prompt and resolving the request/callback. It's important that we only An alternative we've discussed is using POJOs (or data classes) instead of |
Thank you for the summary. Closing this issue because we have a plan now. In the next sprint we want to pick one or multiple of the mentioned callbacks and implement them. |
So far events coming out of the engine (callbacks getting called in delegates) added/changed/updated some data and we used that to update the state in
Session
.There are some upcoming engine feature where we are required to keep a reference to a callback that the engine gives to us. Fullscreen mode was an example of that where
WebView
gave us aCustomViewCallback
. In this case we were able to keep the callback internally and the app side didn't need to deal with that. The upcoming features (e.g. open/close window #1067, geolocation #1078, file uploads #1076, permission requests #1157) may require that the app gets some kind of way to execute those callbacks. And I don't think we want to stuff the callbacks intoSession
which is just a plain holder of the current state.┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: