mirror of
https://github.com/bitwarden/android.git
synced 2025-03-15 18:58:59 +03:00
BIT-1631: Hide Pending requests button when approve requests is disabled (#819)
This commit is contained in:
parent
365e4e5dd9
commit
f33ec6e6a3
2 changed files with 20 additions and 9 deletions
|
@ -66,7 +66,7 @@ private const val MINUTES_PER_HOUR = 60
|
|||
/**
|
||||
* Displays the account security screen.
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
@Suppress("LongMethod", "LongParameterList")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AccountSecurityScreen(
|
||||
|
@ -175,13 +175,15 @@ fun AccountSecurityScreen(
|
|||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
BitwardenTextRow(
|
||||
text = stringResource(id = R.string.pending_log_in_requests),
|
||||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(AccountSecurityAction.PendingLoginRequestsClick) }
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
if (state.isApproveLoginRequestsEnabled) {
|
||||
BitwardenTextRow(
|
||||
text = stringResource(id = R.string.pending_log_in_requests),
|
||||
onClick = remember(viewModel) {
|
||||
{ viewModel.trySendAction(AccountSecurityAction.PendingLoginRequestsClick) }
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
BitwardenListHeaderText(
|
||||
|
|
|
@ -131,13 +131,21 @@ class AccountSecurityScreenTest : BaseComposeTest() {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `on approve login requests toggle off should send Disabled action`() {
|
||||
fun `on approve login requests toggle off should send Disabled action and hide requests row`() {
|
||||
composeTestRule
|
||||
.onNodeWithText("Pending login requests")
|
||||
.assertDoesNotExist()
|
||||
|
||||
mutableStateFlow.update { it.copy(isApproveLoginRequestsEnabled = true) }
|
||||
|
||||
composeTestRule
|
||||
.onNodeWithText("Use this device to approve login requests made from other devices")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
composeTestRule
|
||||
.onNodeWithText("Pending login requests")
|
||||
.performScrollTo()
|
||||
.assertIsDisplayed()
|
||||
|
||||
verify {
|
||||
viewModel.trySendAction(
|
||||
|
@ -300,6 +308,7 @@ class AccountSecurityScreenTest : BaseComposeTest() {
|
|||
|
||||
@Test
|
||||
fun `on pending login requests click should send PendingLoginRequestsClick`() {
|
||||
mutableStateFlow.update { it.copy(isApproveLoginRequestsEnabled = true) }
|
||||
composeTestRule
|
||||
.onNodeWithText("Pending login requests")
|
||||
.performScrollTo()
|
||||
|
|
Loading…
Add table
Reference in a new issue