feat(core): back button event on Android, closes #8142#14133
feat(core): back button event on Android, closes #8142#14133lucasfernog merged 10 commits intodevfrom
Conversation
I've used https://github.com/ionic-team/capacitor-plugins/blob/main/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java as a reference here, checking if there's a back button event handler with a default of webview's goBack implementation
Package Changes Through e52cfeeThere are 11 changes which include @tauri-apps/api with minor, tauri-cli with minor, tauri-utils with minor, tauri-runtime-wry with minor, tauri-runtime with minor, tauri with minor, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-build with minor, tauri-codegen with patch, tauri-macros with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
|
the exit impl still needs to be tested |
|
I've removed the App::exit impl - after further testing, the existing API is working fine |
|
If i register a callback it seems to work fine but if i don't register one, i get p.s. i had to merge #14132 into my local clone of this branch for the listener to work. |
ohh i didn't realize wry handled this.. i'll push an update |
|
One really weird thing (that i've seen elsewhere as well, just not this reliably) is that i have to manually shutdown the emulator if i want to re-run Otherwise this seems to work good now though i wonder if someone will ask for a way to remove the listener to restore native behavior at runtime. I assume that'll be rare so i think we can wait until that's actually needed? |
onBackButtonPress returns PluginListener which is a class that has a unregister function (I also forgot about this, had to check lol) |
I think it's unrelated. I've seen this when i use Android Studio and i click run or debug way too many times - it even breaks Android Studio itself after a while. I think it's related to the adb port forwarding, it gets stuck eventually. |
@FabianLars you're right this indeed makes it a lot easy to reproduce this.. but only if you no-op on the back button handler.. if I do this it doesn't seem like it breaks: I've opened a couple PRs to help: tauri-apps/cargo-mobile2#493 tauri-apps/cargo-mobile2#495 |
I've used https://github.com/ionic-team/capacitor-plugins/blob/main/app/android/src/main/java/com/capacitorjs/plugins/app/AppPlugin.java as a reference here, checking if there's a back button event handler with a default of webview's goBack implementation