mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-08 17:24:31 +01:00
Apply fixes to navigation
This commit is contained in:
@@ -2,6 +2,7 @@ package no.nordicsemi.android.nrftoolbox
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.ParcelUuid
|
||||
import android.util.Log
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -88,7 +89,10 @@ internal fun HomeScreen() {
|
||||
when (val destination = destination.value) {
|
||||
FinishDestination -> context.finish()
|
||||
HomeDestination -> navController.navigateUp()
|
||||
is ProfileDestination -> navController.navigate(destination.id.id)
|
||||
is ProfileDestination -> {
|
||||
navController.navigateUp()
|
||||
navController.navigate(destination.id.id)
|
||||
}
|
||||
is ScannerDestination -> navController.navigate(destination.id.id)
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ class HomeViewModel @Inject constructor(
|
||||
|
||||
fun navigateUp() {
|
||||
val currentDestination = _destination.value
|
||||
when (currentDestination) {
|
||||
_destination.value = when (currentDestination) {
|
||||
FinishDestination -> FinishDestination
|
||||
HomeDestination -> FinishDestination
|
||||
is ProfileDestination -> HomeDestination
|
||||
is ScannerDestination -> HomeDestination
|
||||
}.exhaustive
|
||||
}
|
||||
}
|
||||
|
||||
private fun onDeviceSelected(result: FindDeviceSuccessResult) {
|
||||
|
||||
Reference in New Issue
Block a user