feat(core): back button event on Android, closes #8142#32
Conversation
WalkthroughThis PR introduces Android back button press event handling to Tauri. A new AppPlugin for Android detects back-button presses, emits events to JavaScript, and provides a TypeScript hook. Associated permissions, commands, and dependencies are updated accordingly. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant WebView as WebView
participant AppPlugin as Android AppPlugin
participant JSRuntime as JS Runtime
participant Handler as JS Handler
User->>WebView: Press back button
activate AppPlugin
AppPlugin->>AppPlugin: Check if "back-button" listener exists
alt Listener exists
AppPlugin->>AppPlugin: Detect canGoBack state
AppPlugin->>JSRuntime: Emit BACK_BUTTON_EVENT with canGoBack
JSRuntime->>Handler: Invoke onBackButtonPress callback
Handler->>Handler: Process event
else No listener & canGoBack
AppPlugin->>WebView: Navigate back
WebView-->>User: Show previous page
else No listener & cannot go back
AppPlugin->>AppPlugin: Delegate to system back action
AppPlugin-->>User: Exit app (system default)
end
deactivate AppPlugin
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
🧰 Additional context used🧬 Code graph analysis (1)crates/tauri/mobile/android/src/main/java/app/tauri/AppPlugin.kt (1)
🔇 Additional comments (19)
✏️ Tip: You can disable this entire section by setting Comment |
Benchmark PR from agentic-review-benchmarks#6
Summary by CodeRabbit
New Features
onBackButtonPressAPI for detecting back navigation attempts.Dependencies
✏️ Tip: You can customize this high-level summary in your review settings.