mirror of
https://github.com/bitwarden/android.git
synced 2024-11-27 03:49:36 +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 com.x8bit.bitwarden.ui.vault.feature.vault.util.supportingTextResOrNull
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
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
|
* 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
|
* a scrim via a [BitwardenAnimatedScrim] to all content below it (but not above it). Additional
|
||||||
|
@ -148,6 +154,7 @@ private fun AnimatedAccountSwitcher(
|
||||||
color = MaterialTheme.colorScheme.outlineVariant,
|
color = MaterialTheme.colorScheme.outlineVariant,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (accountSummaries.size < MAXIMUM_ACCOUNT_LIMIT) {
|
||||||
item {
|
item {
|
||||||
AddAccountItem(
|
AddAccountItem(
|
||||||
onClick = onAddAccountClick,
|
onClick = onAddAccountClick,
|
||||||
|
@ -158,6 +165,7 @@ private fun AnimatedAccountSwitcher(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
Loading…
Reference in a new issue