From aae7a6e895af72a546a3980c89999d77afb06b2b Mon Sep 17 00:00:00 2001 From: Brian Yencho Date: Fri, 2 Aug 2024 16:39:23 -0500 Subject: [PATCH] PM-10528: Fix user switching issue due to rapid Activity recreation when locking (#3669) --- app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt index 42a41436c..1c31b93d3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt @@ -112,6 +112,10 @@ class MainViewModel @Inject constructor( .onEach { when (it) { is VaultStateEvent.Locked -> { + // Similar to account switching, triggering this action too soon can + // interfere with animations or navigation logic, so we will delay slightly. + @Suppress("MagicNumber") + delay(500) trySendAction(MainAction.Internal.VaultUnlockStateChange) }