slackhq / circuit

⚡️ A Compose-driven architecture for Kotlin and Android applications.
https://slackhq.github.io/circuit/
Apache License 2.0
1.43k stars 68 forks source link

[Q] Hook up to system back navigation in particular screen. #1503

Closed mpierucci closed 2 months ago

mpierucci commented 2 months ago

Hello! Is there a way to hook up to androids system back navigation?

We have a particular screen were we are creating some files to provde back as a result. The idea is that if the user press backs then we delete those files since are not going to be used. From the top bar we can easily hook up the navigation icon action and delete the files before popping the navigator.

How could this be achieved if the user uses the gesture/bottom bar navigation pattern? Cheers!

ZacSweers commented 2 months ago

Does BackHandler from androidx cover your case?

mpierucci commented 2 months ago

We are also using compose multiplatform ( BackHandler is not suported yet AFAIK) but I can get creative there. Thanks! Edit: actually is seems like is there already. Cheers!