mirror of
https://github.com/bitwarden/android.git
synced 2024-11-23 01:46:00 +03:00
BIT-1151: Enforce maximum account limit in account switcher (#310)
This commit is contained in:
parent
bd2cd54d47
commit
d3a813b647
1 changed files with 15 additions and 7 deletions
|
@ -44,6 +44,12 @@ import com.x8bit.bitwarden.ui.vault.feature.vault.util.initials
|
|||
import com.x8bit.bitwarden.ui.vault.feature.vault.util.supportingTextResOrNull
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
/**
|
||||
* The maximum number of accounts before the "Add account" button will be hidden to prevent the user
|
||||
* from adding any more.
|
||||
*/
|
||||
private const val MAXIMUM_ACCOUNT_LIMIT = 5
|
||||
|
||||
/**
|
||||
* An account switcher that will slide down inside whatever parent is it placed in and add a
|
||||
* a scrim via a [BitwardenAnimatedScrim] to all content below it (but not above it). Additional
|
||||
|
@ -148,13 +154,15 @@ private fun AnimatedAccountSwitcher(
|
|||
color = MaterialTheme.colorScheme.outlineVariant,
|
||||
)
|
||||
}
|
||||
item {
|
||||
AddAccountItem(
|
||||
onClick = onAddAccountClick,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
if (accountSummaries.size < MAXIMUM_ACCOUNT_LIMIT) {
|
||||
item {
|
||||
AddAccountItem(
|
||||
onClick = onAddAccountClick,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue