feat(core): back button event on Android, closes #8142 - #16
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| put("canGoBack", this@AppPlugin.webView?.canGoBack() ?: false) | ||
| } | ||
| trigger(BACK_BUTTON_EVENT, data) | ||
| } |
There was a problem hiding this comment.
Stale listeners cause back button to stop working
Medium Severity
After a webview page reload or navigation, JS-registered listeners become stale but remain in the Kotlin listeners map. When handleOnBackPressed runs, hasListener(BACK_BUTTON_EVENT) returns true for these dead channels, so trigger() is called instead of the default back navigation. Since the JS callback no longer exists, the event is lost and the back button appears to do nothing. The load() method doesn't clear listeners, and there's no page lifecycle hook to clean them up.
Benchmark PR from qodo-benchmark#162
Note
Introduces Android back-button handling and supporting infrastructure.
AppPluginthat intercepts back presses (navigates webview back or finishes activity) and exposes anexitcommand;TauriActivitynow enables back navigationappplugin setup and extends core app permissions withregister_listener/remove_listenerapp.onBackButtonPressto@tauri-apps/apiand updates global bundle to support plugin listener registration/removalPluginbase to support event listeners (registerListener,removeListener,hasListener)wryto0.53.4and updates related lockfile entries; minor cleanup in Android path resolverWritten by Cursor Bugbot for commit 55a5c9a. Configure here.