feat(bundles tab): add BackHandler

This commit is contained in:
Ax333l 2023-10-26 09:03:26 +02:00
parent 50e8d1f8f4
commit 757840b76f

View File

@ -1,5 +1,6 @@
package app.revanced.manager.ui.screen package app.revanced.manager.ui.screen
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@ -203,6 +204,13 @@ fun DashboardScreen(
} }
DashboardPage.BUNDLES -> { DashboardPage.BUNDLES -> {
BackHandler {
if (bundlesSelectable) vm.cancelSourceSelection() else composableScope.launch {
pagerState.animateScrollToPage(
DashboardPage.DASHBOARD.ordinal
)
}
}
val sources by vm.sources.collectAsStateWithLifecycle(initialValue = emptyList()) val sources by vm.sources.collectAsStateWithLifecycle(initialValue = emptyList())