[PM-10696] Dismiss vault unlock keyboard (#3718)
Some checks failed
Scan / Check PR run (push) Failing after 0s
Scan / SAST scan (push) Has been skipped
Scan / Quality scan (push) Has been skipped
Test / Check PR run (push) Failing after 0s
Crowdin Push / Crowdin Push (push) Waiting to run
Test / Test (push) Has been skipped

This commit is contained in:
Patrick Honkonen 2024-08-12 16:11:30 -04:00 committed by GitHub
parent 2b13151bd1
commit 5a0b1caecd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(