mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Pin: use moveTaskToBack instead of finish
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user