diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt index c3134cf94..cd24e7c3e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/folders/FoldersScreen.kt @@ -41,6 +41,8 @@ import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingConten import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.feature.settings.folders.model.FolderDisplayItem +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList /** * Displays the folders screen. @@ -106,7 +108,7 @@ fun FoldersScreen( when (val viewState = state.value.viewState) { is FoldersState.ViewState.Content -> { FoldersContent( - foldersList = viewState.folderList, + foldersList = viewState.folderList.toImmutableList(), onItemClick = remember(viewModel) { { viewModel.trySendAction(FoldersAction.FolderClick(it)) } }, @@ -138,7 +140,7 @@ fun FoldersScreen( @Composable private fun FoldersContent( - foldersList: List, + foldersList: ImmutableList, onItemClick: (folderId: String) -> Unit, modifier: Modifier = Modifier, ) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt index 2863d0609..932d1f746 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt @@ -80,6 +80,7 @@ import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Pa import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias.ServiceType import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorState.MainType.Username.UsernameType.ForwardedEmailAlias.ServiceTypeOption import com.x8bit.bitwarden.ui.tools.feature.generator.model.GeneratorMode +import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList @@ -339,7 +340,7 @@ private fun ScrollContent( Spacer(modifier = Modifier.height(8.dp)) MainStateOptionsItem( selectedType = state.selectedType, - possibleMainStates = state.typeOptions, + possibleMainStates = state.typeOptions.toImmutableList(), onMainStateOptionClicked = onMainStateOptionClicked, ) } @@ -421,7 +422,7 @@ private fun GeneratedStringItem( @Composable private fun MainStateOptionsItem( selectedType: GeneratorState.MainType, - possibleMainStates: List, + possibleMainStates: ImmutableList, onMainStateOptionClicked: (GeneratorState.MainTypeOption) -> Unit, ) { val optionsWithStrings = possibleMainStates.associateWith { stringResource(id = it.labelRes) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendContent.kt index 592140d13..dec363181 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendContent.kt @@ -20,6 +20,7 @@ import com.x8bit.bitwarden.ui.platform.components.model.IconData import com.x8bit.bitwarden.ui.platform.components.text.BitwardenPolicyWarningText import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.tools.feature.send.handlers.SendHandlers +import kotlinx.collections.immutable.toImmutableList /** * Content view for the [SendScreen]. @@ -96,7 +97,7 @@ fun SendContent( startIcon = IconData.Local(it.type.iconRes), label = it.name, supportingLabel = it.deletionDate, - trailingLabelIcons = it.iconList, + trailingLabelIcons = it.iconList.toImmutableList(), showMoreOptions = !policyDisablesSend, onClick = { sendHandlers.onSendClick(it) }, onCopyClick = { sendHandlers.onCopySendClick(it) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendListItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendListItem.kt index 25466decb..f6172ce25 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendListItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/send/SendListItem.kt @@ -19,6 +19,8 @@ import com.x8bit.bitwarden.ui.platform.components.model.IconResource import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme import com.x8bit.bitwarden.ui.platform.util.persistentListOfNotNull +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList /** @@ -44,7 +46,7 @@ fun SendListItem( label: String, supportingLabel: String, startIcon: IconData, - trailingLabelIcons: List, + trailingLabelIcons: ImmutableList, showMoreOptions: Boolean, onClick: () -> Unit, onEditClick: () -> Unit, @@ -123,7 +125,7 @@ private fun SendListItem_preview() { label = "Sample Label", supportingLabel = "Jan 3, 2024, 10:35 AM", startIcon = IconData.Local(R.drawable.ic_send_text), - trailingLabelIcons = emptyList(), + trailingLabelIcons = persistentListOf(), showMoreOptions = true, onClick = {}, onCopyClick = {}, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt index 22efbaef6..d934038bd 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultContent.kt @@ -20,6 +20,7 @@ import com.x8bit.bitwarden.ui.platform.components.model.toIconResources import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.vault.feature.itemlisting.model.ListingItemOverflowAction import com.x8bit.bitwarden.ui.vault.feature.vault.handlers.VaultHandlers +import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toPersistentList /** @@ -88,7 +89,7 @@ fun VaultContent( label = favoriteItem.name(), supportingLabel = favoriteItem.supportingLabel?.invoke(), onClick = { vaultHandlers.vaultItemClick(favoriteItem) }, - overflowOptions = favoriteItem.overflowOptions, + overflowOptions = favoriteItem.overflowOptions.toImmutableList(), onOverflowOptionClick = { action -> if (favoriteItem.shouldShowMasterPasswordReprompt && action.requiresPasswordReprompt @@ -266,7 +267,7 @@ fun VaultContent( label = noFolderItem.name(), supportingLabel = noFolderItem.supportingLabel?.invoke(), onClick = { vaultHandlers.vaultItemClick(noFolderItem) }, - overflowOptions = noFolderItem.overflowOptions, + overflowOptions = noFolderItem.overflowOptions.toImmutableList(), onOverflowOptionClick = { action -> if (noFolderItem.shouldShowMasterPasswordReprompt && action.requiresPasswordReprompt diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultEntryListItem.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultEntryListItem.kt index 12efceaad..c666178e7 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultEntryListItem.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultEntryListItem.kt @@ -33,7 +33,7 @@ fun VaultEntryListItem( startIconTestTag: String, label: String, onClick: () -> Unit, - overflowOptions: List, + overflowOptions: ImmutableList, onOverflowOptionClick: (ListingItemOverflowAction.VaultAction) -> Unit, modifier: Modifier = Modifier, trailingLabelIcons: ImmutableList = persistentListOf(), @@ -68,7 +68,7 @@ private fun VaultEntryListItem_preview() { label = "Example Login", supportingLabel = "Username", onClick = {}, - overflowOptions = emptyList(), + overflowOptions = persistentListOf(), onOverflowOptionClick = {}, modifier = Modifier, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeScreen.kt index 46d2ce336..6ccd42b43 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/verificationcode/VerificationCodeScreen.kt @@ -33,7 +33,9 @@ import com.x8bit.bitwarden.ui.platform.components.header.BitwardenListHeaderText import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.vault.feature.verificationcode.handlers.VerificationCodeHandlers +import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toImmutableList /** * Displays the verification codes to the user. @@ -114,7 +116,7 @@ fun VerificationCodeScreen( when (val viewState = state.viewState) { is VerificationCodeState.ViewState.Content -> { VerificationCodeContent( - items = viewState.verificationCodeDisplayItems, + items = viewState.verificationCodeDisplayItems.toImmutableList(), onCopyClick = verificationCodeHandler.copyClick, itemClick = verificationCodeHandler.itemClick, modifier = modifier, @@ -151,7 +153,7 @@ private fun VerificationCodeDialogs( @Composable private fun VerificationCodeContent( - items: List, + items: ImmutableList, itemClick: (id: String) -> Unit, onCopyClick: (text: String) -> Unit, modifier: Modifier = Modifier,