mirror of
https://github.com/bitwarden/android.git
synced 2025-03-16 11:18:45 +03:00
BIT-2208: Add test tags for dialogs (#1277)
This commit is contained in:
parent
ea01470d21
commit
6c85a908b3
9 changed files with 135 additions and 17 deletions
|
@ -5,7 +5,13 @@ import androidx.compose.material3.AlertDialog
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.Text
|
||||
|
@ -21,6 +27,7 @@ import kotlinx.parcelize.Parcelize
|
|||
* @param onDismissRequest called when the user has requested to dismiss the dialog, whether by
|
||||
* tapping "OK", tapping outside the dialog, or pressing the back button.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun BitwardenBasicDialog(
|
||||
visibilityState: BasicDialogState,
|
||||
|
@ -34,6 +41,7 @@ fun BitwardenBasicDialog(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.ok),
|
||||
onClick = onDismissRequest,
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
)
|
||||
},
|
||||
title = visibilityState.title?.let {
|
||||
|
@ -41,6 +49,7 @@ fun BitwardenBasicDialog(
|
|||
Text(
|
||||
text = it(),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.testTag("AlertTitleText"),
|
||||
)
|
||||
}
|
||||
},
|
||||
|
@ -48,9 +57,14 @@ fun BitwardenBasicDialog(
|
|||
Text(
|
||||
text = visibilityState.message(),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.testTag("AlertContentText"),
|
||||
)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,18 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.semantics.clearAndSetSemantics
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.role
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.util.orNow
|
||||
import com.x8bit.bitwarden.ui.platform.util.toFormattedPattern
|
||||
|
@ -46,7 +51,7 @@ import java.time.ZonedDateTime
|
|||
* @param modifier A [Modifier] that you can use to apply custom modifications to the composable.
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun BitwardenDateSelectButton(
|
||||
label: String,
|
||||
|
@ -122,7 +127,7 @@ fun BitwardenDateSelectButton(
|
|||
)
|
||||
shouldShowDialog = false
|
||||
},
|
||||
modifier = modifier,
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.ok),
|
||||
|
@ -133,7 +138,7 @@ fun BitwardenDateSelectButton(
|
|||
dismissButton = {
|
||||
TextButton(
|
||||
onClick = { shouldShowDialog = false },
|
||||
modifier = modifier,
|
||||
modifier = Modifier.testTag("DismissAlertButton"),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.cancel),
|
||||
|
@ -141,6 +146,10 @@ fun BitwardenDateSelectButton(
|
|||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
},
|
||||
) {
|
||||
DatePicker(state = datePickerState)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,12 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
|
@ -29,6 +34,7 @@ import kotlinx.parcelize.Parcelize
|
|||
*
|
||||
* @param visibilityState the [LoadingDialogState] used to populate the dialog.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun BitwardenLoadingDialog(
|
||||
visibilityState: LoadingDialogState,
|
||||
|
@ -49,6 +55,10 @@ fun BitwardenLoadingDialog(
|
|||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
modifier = Modifier
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
}
|
||||
.fillMaxWidth()
|
||||
.wrapContentHeight(),
|
||||
) {
|
||||
|
@ -59,16 +69,20 @@ fun BitwardenLoadingDialog(
|
|||
) {
|
||||
Text(
|
||||
text = visibilityState.text(),
|
||||
modifier = Modifier.padding(
|
||||
top = 24.dp,
|
||||
bottom = 8.dp,
|
||||
),
|
||||
modifier = Modifier
|
||||
.testTag("AlertTitleText")
|
||||
.padding(
|
||||
top = 24.dp,
|
||||
bottom = 8.dp,
|
||||
),
|
||||
)
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.padding(
|
||||
top = 8.dp,
|
||||
bottom = 24.dp,
|
||||
),
|
||||
modifier = Modifier
|
||||
.testTag("AlertProgressIndicator")
|
||||
.padding(
|
||||
top = 8.dp,
|
||||
bottom = 24.dp,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,13 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton
|
||||
|
@ -26,6 +31,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenPasswordField
|
|||
* @param onDismissRequest called when the user attempts to dismiss the dialog (for example by
|
||||
* tapping outside of it).
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun BitwardenMasterPasswordDialog(
|
||||
onConfirmClick: (masterPassword: String) -> Unit,
|
||||
|
@ -38,6 +44,7 @@ fun BitwardenMasterPasswordDialog(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.cancel),
|
||||
onClick = onDismissRequest,
|
||||
modifier = Modifier.testTag("DismissAlertButton"),
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
|
@ -45,12 +52,14 @@ fun BitwardenMasterPasswordDialog(
|
|||
label = stringResource(id = R.string.submit),
|
||||
isEnabled = masterPassword.isNotEmpty(),
|
||||
onClick = { onConfirmClick(masterPassword) },
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
)
|
||||
},
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.password_confirmation),
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.testTag("AlertTitleText"),
|
||||
)
|
||||
},
|
||||
text = {
|
||||
|
@ -58,6 +67,7 @@ fun BitwardenMasterPasswordDialog(
|
|||
Text(
|
||||
text = stringResource(id = R.string.password_confirmation_desc),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.testTag("AlertContentText"),
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
@ -66,11 +76,17 @@ fun BitwardenMasterPasswordDialog(
|
|||
label = stringResource(id = R.string.master_password),
|
||||
value = masterPassword,
|
||||
onValueChange = { masterPassword = it },
|
||||
modifier = Modifier.imePadding(),
|
||||
modifier = Modifier
|
||||
.testTag("AlertInputField")
|
||||
.imePadding(),
|
||||
autoFocus = true,
|
||||
)
|
||||
}
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -18,8 +18,10 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
|
@ -51,7 +53,10 @@ fun BitwardenSelectionDialog(
|
|||
val scrollState = rememberScrollState()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.semantics { testTagsAsResourceId = true }
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
}
|
||||
.requiredHeightIn(
|
||||
max = configuration.maxDialogHeight,
|
||||
)
|
||||
|
@ -64,6 +69,7 @@ fun BitwardenSelectionDialog(
|
|||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertTitleText")
|
||||
.padding(24.dp)
|
||||
.fillMaxWidth(),
|
||||
text = title,
|
||||
|
@ -93,7 +99,9 @@ fun BitwardenSelectionDialog(
|
|||
)
|
||||
}
|
||||
BitwardenTextButton(
|
||||
modifier = Modifier.padding(24.dp),
|
||||
modifier = Modifier
|
||||
.testTag("DismissAlertButton")
|
||||
.padding(24.dp),
|
||||
label = stringResource(id = R.string.cancel),
|
||||
onClick = onDismissRequest,
|
||||
)
|
||||
|
|
|
@ -9,11 +9,16 @@ import androidx.compose.runtime.getValue
|
|||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenTextButton
|
||||
import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField
|
||||
|
@ -28,6 +33,7 @@ import com.x8bit.bitwarden.ui.platform.components.field.BitwardenTextField
|
|||
* @param autoFocus When set to true, the view will request focus after the first recomposition.
|
||||
* @param initialText The text that will be visible at the start of text entry.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun BitwardenTextEntryDialog(
|
||||
title: String?,
|
||||
|
@ -47,12 +53,14 @@ fun BitwardenTextEntryDialog(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.cancel),
|
||||
onClick = onDismissRequest,
|
||||
modifier = Modifier.testTag("DismissAlertButton"),
|
||||
)
|
||||
},
|
||||
confirmButton = {
|
||||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.ok),
|
||||
onClick = { onConfirmClick(text) },
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
)
|
||||
},
|
||||
title = title?.let {
|
||||
|
@ -60,6 +68,7 @@ fun BitwardenTextEntryDialog(
|
|||
Text(
|
||||
text = it,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.testTag("AlertTitleText"),
|
||||
)
|
||||
}
|
||||
},
|
||||
|
@ -69,6 +78,7 @@ fun BitwardenTextEntryDialog(
|
|||
value = text,
|
||||
onValueChange = { text = it },
|
||||
modifier = Modifier
|
||||
.testTag("AlertContentText")
|
||||
.focusRequester(focusRequester)
|
||||
.onGloballyPositioned {
|
||||
shouldRequestFocus = true
|
||||
|
@ -76,6 +86,10 @@ fun BitwardenTextEntryDialog(
|
|||
)
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
},
|
||||
)
|
||||
|
||||
if (autoFocus && shouldRequestFocus) {
|
||||
|
|
|
@ -27,9 +27,14 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
|
@ -70,12 +75,14 @@ fun BitwardenTimePickerDialog(
|
|||
Text(
|
||||
text = stringResource(id = R.string.ok),
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(
|
||||
onClick = onDismissRequest,
|
||||
modifier = Modifier.testTag("DismissAlertButton"),
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.cancel),
|
||||
|
@ -116,6 +123,7 @@ fun BitwardenTimePickerDialog(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
private fun TimePickerDialog(
|
||||
onDismissRequest: () -> Unit,
|
||||
|
@ -132,6 +140,10 @@ private fun TimePickerDialog(
|
|||
shape = MaterialTheme.shapes.extraLarge,
|
||||
tonalElevation = 6.dp,
|
||||
modifier = Modifier
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
}
|
||||
.width(IntrinsicSize.Min)
|
||||
.height(IntrinsicSize.Min)
|
||||
.background(
|
||||
|
@ -145,6 +157,7 @@ private fun TimePickerDialog(
|
|||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertTitleText")
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 20.dp),
|
||||
// TODO: This should be "Select time" but we don't have that string (BIT-1405)
|
||||
|
|
|
@ -19,9 +19,14 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
|
@ -43,7 +48,7 @@ import com.x8bit.bitwarden.ui.platform.components.util.maxDialogWidth
|
|||
* @param confirmTextColor The color of the confirm text.
|
||||
* @param dismissTextColor The color of the dismiss text.
|
||||
*/
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@OptIn(ExperimentalLayoutApi::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
@Suppress("LongMethod")
|
||||
fun BitwardenTwoButtonDialog(
|
||||
|
@ -65,6 +70,10 @@ fun BitwardenTwoButtonDialog(
|
|||
val scrollState = rememberScrollState()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
}
|
||||
.requiredHeightIn(
|
||||
max = configuration.maxDialogHeight,
|
||||
)
|
||||
|
@ -82,6 +91,7 @@ fun BitwardenTwoButtonDialog(
|
|||
title?.let {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertTitleText")
|
||||
.padding(horizontal = 24.dp)
|
||||
.fillMaxWidth(),
|
||||
text = title,
|
||||
|
@ -100,6 +110,7 @@ fun BitwardenTwoButtonDialog(
|
|||
}
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertContentText")
|
||||
.weight(1f, fill = false)
|
||||
.verticalScroll(scrollState)
|
||||
.padding(horizontal = 24.dp)
|
||||
|
@ -122,13 +133,17 @@ fun BitwardenTwoButtonDialog(
|
|||
modifier = Modifier.padding(horizontal = 8.dp),
|
||||
) {
|
||||
BitwardenTextButton(
|
||||
modifier = Modifier.padding(horizontal = 4.dp),
|
||||
modifier = Modifier
|
||||
.testTag("AcceptAlertButton")
|
||||
.padding(horizontal = 4.dp),
|
||||
label = confirmButtonText,
|
||||
labelTextColor = confirmTextColor,
|
||||
onClick = onConfirmClick,
|
||||
)
|
||||
BitwardenTextButton(
|
||||
modifier = Modifier.padding(horizontal = 4.dp),
|
||||
modifier = Modifier
|
||||
.testTag("DismissAlertButton")
|
||||
.padding(horizontal = 4.dp),
|
||||
label = dismissButtonText,
|
||||
labelTextColor = dismissTextColor,
|
||||
onClick = onDismissClick,
|
||||
|
|
|
@ -15,9 +15,14 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
|
@ -36,6 +41,7 @@ import com.x8bit.bitwarden.ui.platform.components.util.maxDialogHeight
|
|||
* @param onSubmitClick A callback for when the "Submit" button is clicked.
|
||||
* @param onDismissRequest A callback for when the dialog is requesting to be dismissed.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
fun PinInputDialog(
|
||||
|
@ -52,6 +58,10 @@ fun PinInputDialog(
|
|||
val scrollState = rememberScrollState()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
testTag = "AlertPopup"
|
||||
}
|
||||
.requiredHeightIn(
|
||||
max = configuration.maxDialogHeight,
|
||||
)
|
||||
|
@ -64,6 +74,7 @@ fun PinInputDialog(
|
|||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertTitleText")
|
||||
.padding(24.dp)
|
||||
.fillMaxWidth(),
|
||||
text = stringResource(id = R.string.enter_pin),
|
||||
|
@ -85,6 +96,7 @@ fun PinInputDialog(
|
|||
) {
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.testTag("AlertContentText")
|
||||
.padding(24.dp)
|
||||
.fillMaxWidth(),
|
||||
text = stringResource(id = R.string.set_pin_description),
|
||||
|
@ -98,6 +110,7 @@ fun PinInputDialog(
|
|||
onValueChange = onPinChange,
|
||||
keyboardType = KeyboardType.Number,
|
||||
modifier = Modifier
|
||||
.testTag("AlertInputField")
|
||||
.padding(16.dp)
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
|
@ -117,11 +130,13 @@ fun PinInputDialog(
|
|||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.cancel),
|
||||
onClick = onCancelClick,
|
||||
modifier = Modifier.testTag("DismissAlertButton"),
|
||||
)
|
||||
|
||||
BitwardenFilledButton(
|
||||
label = stringResource(id = R.string.submit),
|
||||
onClick = onSubmitClick,
|
||||
modifier = Modifier.testTag("AcceptAlertButton"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue