mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
[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
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:
parent
2b13151bd1
commit
5a0b1caecd
1 changed files with 15 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.x8bit.bitwarden.ui.auth.feature.vaultunlock
|
package com.x8bit.bitwarden.ui.auth.feature.vaultunlock
|
||||||
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
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.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusManager
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
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.LocalContext
|
||||||
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
import androidx.compose.ui.platform.testTag
|
import androidx.compose.ui.platform.testTag
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
@ -69,6 +73,7 @@ import javax.crypto.Cipher
|
||||||
fun VaultUnlockScreen(
|
fun VaultUnlockScreen(
|
||||||
viewModel: VaultUnlockViewModel = hiltViewModel(),
|
viewModel: VaultUnlockViewModel = hiltViewModel(),
|
||||||
biometricsManager: BiometricsManager = LocalBiometricsManager.current,
|
biometricsManager: BiometricsManager = LocalBiometricsManager.current,
|
||||||
|
focusManager: FocusManager = LocalFocusManager.current,
|
||||||
) {
|
) {
|
||||||
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
|
val state by viewModel.stateFlow.collectAsStateWithLifecycle()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
@ -148,7 +153,12 @@ fun VaultUnlockScreen(
|
||||||
BitwardenScaffold(
|
BitwardenScaffold(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.nestedScroll(scrollBehavior.nestedScrollConnection),
|
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||||
|
.pointerInput(Unit) {
|
||||||
|
detectTapGestures(
|
||||||
|
onTap = { focusManager.clearFocus(force = true) },
|
||||||
|
)
|
||||||
|
},
|
||||||
topBar = {
|
topBar = {
|
||||||
BitwardenTopAppBar(
|
BitwardenTopAppBar(
|
||||||
title = state.vaultUnlockType.unlockScreenTitle(),
|
title = state.vaultUnlockType.unlockScreenTitle(),
|
||||||
|
@ -159,7 +169,10 @@ fun VaultUnlockScreen(
|
||||||
BitwardenAccountActionItem(
|
BitwardenAccountActionItem(
|
||||||
initials = state.initials,
|
initials = state.initials,
|
||||||
color = state.avatarColor,
|
color = state.avatarColor,
|
||||||
onClick = { accountMenuVisible = !accountMenuVisible },
|
onClick = {
|
||||||
|
focusManager.clearFocus()
|
||||||
|
accountMenuVisible = !accountMenuVisible
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
BitwardenOverflowActionItem(
|
BitwardenOverflowActionItem(
|
||||||
|
|
Loading…
Reference in a new issue