Pin: use moveTaskToBack instead of finish
This commit is contained in:
parent
a2ebf39cb5
commit
45feedb208
2 changed files with 3 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ fun <T : Any> BackStack<T>.removeLast(element: T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FinishActivityBackHandler(enabled: Boolean = true) {
|
fun MoveActivityToBackgroundBackHandler(enabled: Boolean = true) {
|
||||||
|
|
||||||
fun Context.findActivity(): ComponentActivity? = when (this) {
|
fun Context.findActivity(): ComponentActivity? = when (this) {
|
||||||
is ComponentActivity -> this
|
is ComponentActivity -> this
|
||||||
|
|
@ -58,7 +58,7 @@ fun FinishActivityBackHandler(enabled: Boolean = true) {
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
BackHandler(enabled = enabled) {
|
BackHandler(enabled = enabled) {
|
||||||
context.findActivity()?.finish()
|
context.findActivity()?.moveTaskToBack(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PinState.Locked -> {
|
PinState.Locked -> {
|
||||||
FinishActivityBackHandler()
|
MoveActivityToBackgroundBackHandler()
|
||||||
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LockPermanent)
|
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LockPermanent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue