From 5a0b1caecd25afbdbcb4660941cff3f7a654e529 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:11:30 -0400 Subject: [PATCH] [PM-10696] Dismiss vault unlock keyboard (#3718) --- .../feature/vaultunlock/VaultUnlockScreen.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt index 446f6b176..368f6c994 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt @@ -1,6 +1,7 @@ package com.x8bit.bitwarden.ui.auth.feature.vaultunlock import android.widget.Toast +import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -23,8 +24,11 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusManager import androidx.compose.ui.input.nestedscroll.nestedScroll +import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign @@ -69,6 +73,7 @@ import javax.crypto.Cipher fun VaultUnlockScreen( viewModel: VaultUnlockViewModel = hiltViewModel(), biometricsManager: BiometricsManager = LocalBiometricsManager.current, + focusManager: FocusManager = LocalFocusManager.current, ) { val state by viewModel.stateFlow.collectAsStateWithLifecycle() val context = LocalContext.current @@ -148,7 +153,12 @@ fun VaultUnlockScreen( BitwardenScaffold( modifier = Modifier .fillMaxSize() - .nestedScroll(scrollBehavior.nestedScrollConnection), + .nestedScroll(scrollBehavior.nestedScrollConnection) + .pointerInput(Unit) { + detectTapGestures( + onTap = { focusManager.clearFocus(force = true) }, + ) + }, topBar = { BitwardenTopAppBar( title = state.vaultUnlockType.unlockScreenTitle(), @@ -159,7 +169,10 @@ fun VaultUnlockScreen( BitwardenAccountActionItem( initials = state.initials, color = state.avatarColor, - onClick = { accountMenuVisible = !accountMenuVisible }, + onClick = { + focusManager.clearFocus() + accountMenuVisible = !accountMenuVisible + }, ) } BitwardenOverflowActionItem(