You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Android com.getcapacitor.BridgeWebViewClient does not override the doUpdateVisitedHistory callback to its listeners. This knowledge should be available to the WebViewListeners, so they can (optionally) react, update their plugin functionality or act on native code
Platform(s)
This is an android platform-specific call for the WebViewClient
Preferred Solution
Add to BridgeWebViewClient:
@Override
public void doUpdateVisitedHistory [...]
for (WebViewListener listener : bridge.getWebViewListeners()) {
listener.onUpdateVisitedHistory(view.canGoBack());
}
Add to WebViewListener:
/**
* Callback for page-visit changes that should lead to the user having different browsing state
* and history.
*
* @param canGoBack Whether or not the user can go further back in the visit history
*/
public void onUpdateVisitedHistory(boolean canGoBack) {
// Override me to add behavior to the page-visit history update
}
Alternatives
See context below, all alternatives that provide the same level of support for plugins would involve a lot of custom code with separate fields that know the state of the WebView navigation stack
Additional Context
This change will soon be required to improve the OnBackPressedDispatcher / OnBackInvokedDispatcher handling in Android. Android 13 already introduced Support for predictive back-gestures when leaving the activity, and claims this will be fleshed out in the coming years with support for predictive back in fragment transitions. The change proposed in this feature request comes from the fact that their CodeLab uses the doUpdateVisitedHistory callback, so for example the Capacitor App Plugin will sorely need this callback soon
The text was updated successfully, but these errors were encountered:
Feature Request
Description
Currently, the Android
com.getcapacitor.BridgeWebViewClient
does not override thedoUpdateVisitedHistory
callback to its listeners. This knowledge should be available to theWebViewListener
s, so they can (optionally) react, update their plugin functionality or act on native codePlatform(s)
This is an android platform-specific call for the WebViewClient
Preferred Solution
Add to BridgeWebViewClient:
Add to WebViewListener:
Alternatives
See context below, all alternatives that provide the same level of support for plugins would involve a lot of custom code with separate fields that know the state of the WebView navigation stack
Additional Context
This change will soon be required to improve the
OnBackPressedDispatcher
/OnBackInvokedDispatcher
handling in Android. Android 13 already introduced Support for predictive back-gestures when leaving the activity, and claims this will be fleshed out in the coming years with support for predictive back in fragment transitions. The change proposed in this feature request comes from the fact that their CodeLab uses thedoUpdateVisitedHistory
callback, so for example the Capacitor App Plugin will sorely need this callback soonThe text was updated successfully, but these errors were encountered: