feat(core): back button event on Android, closes #8142 - #6
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| { | ||
| let handle = _api.register_android_plugin("app.tauri", "AppPlugin")?; | ||
| let handle_ref = &handle; | ||
| _app.manage(AppPlugin(*handle_ref)); |
There was a problem hiding this comment.
Invalid move out of reference for non-Copy type
High Severity
The code creates a reference handle_ref to handle and then attempts to dereference it with *handle_ref. Since PluginHandle<R> implements Clone but not Copy, this attempts an invalid move out of a shared reference. The intermediate reference serves no purpose — the code can simply pass handle directly to AppPlugin(handle).
| fun exit(invoke: Invoke) { | ||
| activity.finish() | ||
| invoke.resolve() | ||
| } |
There was a problem hiding this comment.
Command exit is unreachable due to missing permission
Low Severity
The exit command is annotated with @Command but has no corresponding permission entry in build.rs and no TypeScript API exposure. Plugin commands require permissions to be callable via the invoke system. Without adding ("exit", false) to the core:app commands in build.rs, this command is dead code that can never be reached through JavaScript.
Benchmark PR from agentic-review-benchmarks#6
Note
Adds Android back button handling and corresponding JS API, plus listener infrastructure and build integration.
AppPluginintercepts back presses; emitsapp > back-buttonwithcanGoBack; falls back to WebViewgoBack()or default back; addsexitcommand. Auto-generatedTauriActivitynow setshandleBackNavigation = true.app.onBackButtonPress(handler)andOnBackButtonPressPayload; wires throughaddPluginListenerin global bundle andpackages/api/src/app.ts.register_listener/remove_listenercommands forcore:app; registers the Android plugin inappsetup; updates permissions docs.wryto0.53.4(and related windows crates); minor Android path code cleanup; regenerates global API bundle.Written by Cursor Bugbot for commit 5a010d0. Configure here.