Updated on 2026-08-14
This commit is contained in:
parent
18201957b1
commit
f368e6a2f5
15 changed files with 121 additions and 122 deletions
|
|
@ -2,28 +2,9 @@
|
|||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>BooleanPropertyNaming:AccountCreateEditModel.kt$AccountCreateEditModel$val duplicateAccountNames = (error as? AddCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet) ?.cause is AccountList.Error.DuplicateAccountNames</ID>
|
||||
<ID>BooleanPropertyNaming:AccountCreateEditModel.kt$AccountCreateEditModel$val duplicateAccountNames = (error as? UpdateCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet) ?.cause is AccountList.Error.DuplicateAccountNames</ID>
|
||||
<ID>BooleanPropertyNaming:AccountCreateEditModel.kt$AccountCreateEditModel$val showConfirmDialog = uiState.value.buttonState.isButtonEnabled</ID>
|
||||
<ID>BooleanPropertyNaming:AccountCreateEditUM.kt$AccountCreateEditUM.Button$val showProgress: Boolean</ID>
|
||||
<ID>MultilineLambdaItParameter:AccountCreateEditContent.kt${ /* * If the user had the default main account name and enters the same name during renaming, * we should use the default value instead of custom to avoid breaking the name validation process. */ val newName = if (wasDefault && it == defaultAccountName) { AccountNameUM.DefaultMain } else { AccountNameUM.Custom(raw = it) } account.onNameChange(newName) }</ID>
|
||||
<ID>MultilineLambdaItParameter:ArchivedAccountListContent.kt$PreviewStateProvider${ ArchivedAccountUM( accountId = it.toString(), accountName = accountName, accountIconUM = portfolioIcon(), tokensInfo = stringReference("10 tokens"), networksInfo = stringReference("2 networks"), onClick = {}, isLoading = it % 2 == 0, ) }</ID>
|
||||
<ID>NamedArguments:PortfolioSelectorModel.kt$PortfolioSelectorModel$buildAccountsList(portfolioData, artworks, isEnabled, selectedAccount)</ID>
|
||||
<ID>NamedArguments:PortfolioSelectorModel.kt$PortfolioSelectorModel$buildUiList(isAccountsMode, portfolioData, artworks, isEnabled, selectedAccount)</ID>
|
||||
<ID>NamedArguments:PortfolioSelectorModel.kt$PortfolioSelectorModel$buildWalletList(portfolioData, artworks, isEnabled, selectedAccount)</ID>
|
||||
<ID>NonBooleanPropertyPrefixedWithIs:DefaultPortfolioSelectorController.kt$DefaultPortfolioSelectorController$override val isAccountMode: Flow<Boolean> by lazy { isAccountsModeEnabledUseCase() }</ID>
|
||||
<ID>NonBooleanPropertyPrefixedWithIs:DefaultPortfolioSelectorController.kt$DefaultPortfolioSelectorController$override val isEnabled: MutableStateFlow<(UserWallet, AccountStatus) -> Boolean> = MutableStateFlow { _, _ -> true }</ID>
|
||||
<ID>NonBooleanPropertyPrefixedWithIs:DefaultPortfolioSelectorController.kt$DefaultPortfolioSelectorController$private val isAccountsModeEnabledUseCase: IsAccountsModeEnabledUseCase</ID>
|
||||
<ID>NonBooleanPropertyPrefixedWithIs:PortfolioSelectorModel.kt$PortfolioSelectorModel$private val isAccountsModeEnabledUseCase: IsAccountsModeEnabledUseCase</ID>
|
||||
<ID>NullableBooleanCheck:AccountDetailsModel.kt$AccountDetailsModel$getUserWalletUseCase(account.accountId.userWalletId) .getOrNull()?.isMultiCurrency ?: false</ID>
|
||||
<ID>PropertyUsedBeforeDeclaration:AccountDetailsModel.kt$AccountDetailsModel$_uiState</ID>
|
||||
<ID>PropertyUsedBeforeDeclaration:ArchivedAccountListModel.kt$ArchivedAccountListModel$_uiState</ID>
|
||||
<ID>UnnecessaryLet:ArchivedAccountListModel.kt$ArchivedAccountListModel$let { _uiState.value = newState }</ID>
|
||||
<ID>UnnecessaryLet:PortfolioSelectorContent.kt$PortfolioSelectorPreviewData$let(::add)</ID>
|
||||
<ID>UnusedImports:PortfolioSelectorBS.kt$import androidx.compose.foundation.background</ID>
|
||||
<ID>UseEmptyCounterpart:AccountCreateEditModel.kt$AccountCreateEditModel$mapOf()</ID>
|
||||
<ID>UseEmptyCounterpart:ArchivedAccountListModel.kt$ArchivedAccountListModel$mapOf()</ID>
|
||||
<ID>VarCouldBeVal:AccountDetailsContent.kt$PreviewStateProvider$var portfolioIcon = AccountIconPreviewData.randomAccountIcon()</ID>
|
||||
<ID>VarCouldBeVal:ArchivedAccountListModel.kt$ArchivedAccountListModel$private var getArchivedAccountsJob = JobHolder()</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
|
|||
|
|
@ -46,9 +46,10 @@ internal class ArchivedAccountListModel @Inject constructor(
|
|||
private val params = paramsContainer.require<ArchivedAccountListComponent.Params>()
|
||||
private val onCloseClick = { router.pop() }
|
||||
|
||||
val uiState: StateFlow<AccountArchivedUM> get() = _uiState
|
||||
private val _uiState: MutableStateFlow<AccountArchivedUM> = MutableStateFlow(getInitialState())
|
||||
private var getArchivedAccountsJob = JobHolder()
|
||||
val uiState: StateFlow<AccountArchivedUM>
|
||||
field = MutableStateFlow(getInitialState())
|
||||
|
||||
private val getArchivedAccountsJob = JobHolder()
|
||||
|
||||
init {
|
||||
getArchivedAccounts()
|
||||
|
|
@ -85,7 +86,9 @@ internal class ArchivedAccountListModel @Inject constructor(
|
|||
},
|
||||
)
|
||||
|
||||
newState?.let { _uiState.value = newState }
|
||||
if (newState != null) {
|
||||
uiState.value = newState
|
||||
}
|
||||
}
|
||||
.flowOn(dispatchers.default)
|
||||
.launchIn(modelScope)
|
||||
|
|
@ -93,11 +96,11 @@ internal class ArchivedAccountListModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun recoverCryptoPortfolio(accountId: AccountId) = modelScope.launch {
|
||||
_uiState.update { it.toggleProgress(accountId, isLoading = true) }
|
||||
uiState.update { it.toggleProgress(accountId, isLoading = true) }
|
||||
val result = withContext(dispatchers.default) {
|
||||
recoverCryptoPortfolioUseCase(accountId)
|
||||
}
|
||||
_uiState.update { it.toggleProgress(accountId, isLoading = false) }
|
||||
uiState.update { it.toggleProgress(accountId, isLoading = false) }
|
||||
result
|
||||
.onLeft(::handleRecoverError)
|
||||
.onRight {
|
||||
|
|
@ -134,7 +137,7 @@ internal class ArchivedAccountListModel @Inject constructor(
|
|||
messageSender.showErrorDialog(universalError = featureError, onDismiss = router::pop)
|
||||
}
|
||||
|
||||
private fun logError(error: AccountFeatureError, params: Map<String, String> = mapOf()) {
|
||||
private fun logError(error: AccountFeatureError, params: Map<String, String> = emptyMap()) {
|
||||
val exception = IllegalStateException(error.toString())
|
||||
|
||||
Timber.e(exception)
|
||||
|
|
|
|||
|
|
@ -170,15 +170,15 @@ private class PreviewStateProvider : CollectionPreviewParameterProvider<AccountA
|
|||
fun portfolioIcon() = AccountIconPreviewData.randomAccountIcon()
|
||||
val accountName = stringReference("Account name")
|
||||
|
||||
val firstList = List(10) {
|
||||
val firstList = List(10) { id ->
|
||||
ArchivedAccountUM(
|
||||
accountId = it.toString(),
|
||||
accountId = id.toString(),
|
||||
accountName = accountName,
|
||||
accountIconUM = portfolioIcon(),
|
||||
tokensInfo = stringReference("10 tokens"),
|
||||
networksInfo = stringReference("2 networks"),
|
||||
onClick = {},
|
||||
isLoading = it % 2 == 0,
|
||||
isLoading = id % 2 == 0,
|
||||
)
|
||||
}.toImmutableList()
|
||||
val first = AccountArchivedUM.Content(
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun handleAddAccountError(error: AddCryptoPortfolioUseCase.Error) {
|
||||
val duplicateAccountNames = (error as? AddCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet)
|
||||
val isDuplicateAccountNamesError = (error as? AddCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet)
|
||||
?.cause is AccountList.Error.DuplicateAccountNames
|
||||
when {
|
||||
duplicateAccountNames -> showAccountNameExist()
|
||||
isDuplicateAccountNamesError -> showAccountNameExist()
|
||||
else -> {
|
||||
showSomethingWrong()
|
||||
logError(error = AccountFeatureError.CreateAccount.FailedToCreateAccount(cause = error))
|
||||
|
|
@ -159,10 +159,10 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun handleEditAccountError(error: UpdateCryptoPortfolioUseCase.Error) {
|
||||
val duplicateAccountNames = (error as? UpdateCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet)
|
||||
val isDuplicateAccountNamesError = (error as? UpdateCryptoPortfolioUseCase.Error.AccountListRequirementsNotMet)
|
||||
?.cause is AccountList.Error.DuplicateAccountNames
|
||||
when {
|
||||
duplicateAccountNames -> showAccountNameExist()
|
||||
isDuplicateAccountNamesError -> showAccountNameExist()
|
||||
else -> {
|
||||
showSomethingWrong()
|
||||
logError(error = AccountFeatureError.EditAccount.FailedToEditAccount(cause = error))
|
||||
|
|
@ -176,30 +176,39 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun onCloseClick() {
|
||||
val showConfirmDialog = uiState.value.buttonState.isButtonEnabled
|
||||
if (showConfirmDialog) unsaveChangeDialog() else router.pop()
|
||||
val shouldShowConfirmDialog = uiState.value.buttonState.isButtonEnabled
|
||||
if (shouldShowConfirmDialog) unsaveChangeDialog() else router.pop()
|
||||
}
|
||||
|
||||
private fun onIconSelect(icon: CryptoPortfolioIcon.Icon) {
|
||||
uiState.value = uiState.value
|
||||
.updateIconSelect(icon)
|
||||
.validateNewState()
|
||||
uiState.update { currentState ->
|
||||
currentState.updateIconSelect(icon)
|
||||
.validateNewState()
|
||||
}
|
||||
}
|
||||
|
||||
private fun onColorSelect(color: CryptoPortfolioIcon.Color) {
|
||||
uiState.value = uiState.value
|
||||
.updateColorSelect(color)
|
||||
.validateNewState()
|
||||
uiState.update { currentState ->
|
||||
currentState.updateColorSelect(color)
|
||||
.validateNewState()
|
||||
}
|
||||
}
|
||||
|
||||
private fun onNameChange(name: AccountNameUM) {
|
||||
uiState.value = uiState.value
|
||||
.updateName(name)
|
||||
.validateNewState()
|
||||
val isNotEmptyCustomName = (name as? AccountNameUM.Custom)?.raw?.isNotEmpty() == true
|
||||
if (!name.isValidName() && isNotEmptyCustomName) {
|
||||
Timber.d("Invalid account name: $name")
|
||||
return
|
||||
}
|
||||
|
||||
uiState.update { currentState ->
|
||||
currentState.updateName(name)
|
||||
.validateNewState()
|
||||
}
|
||||
}
|
||||
|
||||
private fun AccountCreateEditUM.validateNewState(): AccountCreateEditUM {
|
||||
val isValidName = this.account.name.toDomain().isRight()
|
||||
val isValidName = this.account.name.isValidName()
|
||||
val isAvailableForConfirm = when (params) {
|
||||
is AccountCreateEditComponent.Params.Create -> isValidName
|
||||
is AccountCreateEditComponent.Params.Edit -> {
|
||||
|
|
@ -213,6 +222,8 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
return this.updateButton(isButtonEnabled = isAvailableForConfirm)
|
||||
}
|
||||
|
||||
private fun AccountNameUM.isValidName(): Boolean = this.toDomain().isRight()
|
||||
|
||||
private fun getInitialState(): AccountCreateEditUM {
|
||||
return AccountCreateEditUM(
|
||||
title = umBuilder.toolbarTitle,
|
||||
|
|
@ -250,7 +261,7 @@ internal class AccountCreateEditModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun logError(error: AccountFeatureError, params: Map<String, String> = mapOf()) {
|
||||
private fun logError(error: AccountFeatureError, params: Map<String, String> = emptyMap()) {
|
||||
val exception = IllegalStateException(error.toString())
|
||||
|
||||
Timber.e(exception)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ internal data class AccountCreateEditUM(
|
|||
|
||||
data class Button(
|
||||
val isButtonEnabled: Boolean,
|
||||
val showProgress: Boolean,
|
||||
val shouldShowProgress: Boolean,
|
||||
val onConfirmClick: () -> Unit,
|
||||
val text: TextReference,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ internal class AccountCreateEditUMBuilder(
|
|||
}
|
||||
return AccountCreateEditUM.Button(
|
||||
isButtonEnabled = false,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
onConfirmClick = onConfirmClick,
|
||||
text = text,
|
||||
)
|
||||
|
|
@ -119,7 +119,7 @@ internal class AccountCreateEditUMBuilder(
|
|||
}
|
||||
|
||||
fun AccountCreateEditUM.toggleProgress(showProgress: Boolean): AccountCreateEditUM {
|
||||
return this.copy(buttonState = this.buttonState.copy(showProgress = showProgress))
|
||||
return this.copy(buttonState = this.buttonState.copy(shouldShowProgress = showProgress))
|
||||
}
|
||||
|
||||
fun AccountCreateEditUM.updateDerivationIndex(derivationIndex: Int): AccountCreateEditUM {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ internal fun AccountCreateEditContent(state: AccountCreateEditUM, modifier: Modi
|
|||
color = TangemTheme.colors.text.tertiary,
|
||||
)
|
||||
}
|
||||
if (state.buttonState.showProgress) {
|
||||
if (state.buttonState.shouldShowProgress) {
|
||||
focusManager.clearFocus()
|
||||
keyboardController?.hide()
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ internal fun AccountCreateEditContent(state: AccountCreateEditUM, modifier: Modi
|
|||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
enabled = state.buttonState.isButtonEnabled,
|
||||
showProgress = state.buttonState.showProgress,
|
||||
showProgress = state.buttonState.shouldShowProgress,
|
||||
text = state.buttonState.text.resolveReference(),
|
||||
onClick = state.buttonState.onConfirmClick,
|
||||
)
|
||||
|
|
@ -129,15 +129,15 @@ private fun AccountSummary(account: Account) {
|
|||
placeholder = account.inputPlaceholder,
|
||||
value = account.name.value.resolveReference(),
|
||||
singleLine = true,
|
||||
onValueChange = {
|
||||
onValueChange = { value ->
|
||||
/*
|
||||
* If the user had the default main account name and enters the same name during renaming,
|
||||
* we should use the default value instead of custom to avoid breaking the name validation process.
|
||||
*/
|
||||
val newName = if (wasDefault && it == defaultAccountName) {
|
||||
val newName = if (wasDefault && value == defaultAccountName) {
|
||||
AccountNameUM.DefaultMain
|
||||
} else {
|
||||
AccountNameUM.Custom(raw = it)
|
||||
AccountNameUM.Custom(raw = value)
|
||||
}
|
||||
|
||||
account.onNameChange(newName)
|
||||
|
|
@ -321,7 +321,7 @@ private class PreviewStateProvider : CollectionPreviewParameterProvider<AccountC
|
|||
),
|
||||
buttonState = AccountCreateEditUM.Button(
|
||||
isButtonEnabled = false,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
onConfirmClick = {},
|
||||
text = stringReference("Add account"),
|
||||
),
|
||||
|
|
@ -355,7 +355,7 @@ private class PreviewStateProvider : CollectionPreviewParameterProvider<AccountC
|
|||
),
|
||||
buttonState = AccountCreateEditUM.Button(
|
||||
isButtonEnabled = false,
|
||||
showProgress = false,
|
||||
shouldShowProgress = false,
|
||||
onConfirmClick = {},
|
||||
text = stringReference("Save"),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -42,13 +42,14 @@ internal class AccountDetailsModel @Inject constructor(
|
|||
|
||||
private val params = paramsContainer.require<AccountDetailsComponent.Params>()
|
||||
|
||||
val uiState: StateFlow<AccountDetailsUM> get() = _uiState
|
||||
private val _uiState: MutableStateFlow<AccountDetailsUM> = MutableStateFlow(buildUI(params.account))
|
||||
val uiState: StateFlow<AccountDetailsUM>
|
||||
field = MutableStateFlow(buildUI(params.account))
|
||||
|
||||
private val accountId = params.account.accountId
|
||||
|
||||
init {
|
||||
singleAccountSupplier(SingleAccountProducer.Params(accountId))
|
||||
.onEach { account -> _uiState.update { buildUI(account) } }
|
||||
.onEach { account -> uiState.update { buildUI(account) } }
|
||||
.launchIn(modelScope)
|
||||
}
|
||||
|
||||
|
|
@ -89,11 +90,11 @@ internal class AccountDetailsModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun archiveCryptoPortfolio() = modelScope.launch {
|
||||
_uiState.update { it.toggleProgress(true) }
|
||||
uiState.update { it.toggleProgress(true) }
|
||||
archiveCryptoPortfolioUseCase(accountId)
|
||||
.onLeft { error ->
|
||||
failedArchiveDialog(error)
|
||||
_uiState.update { it.toggleProgress(false) }
|
||||
uiState.update { it.toggleProgress(false) }
|
||||
}
|
||||
.onRight {
|
||||
val message = resourceReference(R.string.account_archive_success_message)
|
||||
|
|
@ -136,8 +137,8 @@ internal class AccountDetailsModel @Inject constructor(
|
|||
)
|
||||
}
|
||||
}
|
||||
val isMultiCurrency = getUserWalletUseCase(account.accountId.userWalletId)
|
||||
.getOrNull()?.isMultiCurrency ?: false
|
||||
val isMultiCurrency = getUserWalletUseCase(account.accountId.userWalletId).getOrNull()
|
||||
?.isMultiCurrency == true
|
||||
return AccountDetailsUM(
|
||||
accountName = account.accountName.toUM().value,
|
||||
accountIcon = account.portfolioIcon.toUM(),
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ private val archiveModeAvailable
|
|||
private class PreviewStateProvider : CollectionPreviewParameterProvider<AccountDetailsUM>(
|
||||
buildList {
|
||||
val accountName = "Main"
|
||||
var portfolioIcon = AccountIconPreviewData.randomAccountIcon()
|
||||
val portfolioIcon = AccountIconPreviewData.randomAccountIcon()
|
||||
val first = AccountDetailsUM(
|
||||
onCloseClick = {},
|
||||
onAccountEditClick = {},
|
||||
|
|
|
|||
|
|
@ -53,7 +53,13 @@ internal class PortfolioSelectorModel @Inject constructor(
|
|||
flow4 = selectorController.isEnabled,
|
||||
flow5 = selectedAccountState,
|
||||
transform = { isAccountsMode, portfolioData, artworks, isEnabled, selectedAccount ->
|
||||
val uiList = buildUiList(isAccountsMode, portfolioData, artworks, isEnabled, selectedAccount)
|
||||
val uiList = buildUiList(
|
||||
isAccountsMode = isAccountsMode,
|
||||
portfolioData = portfolioData,
|
||||
artworks = artworks,
|
||||
isEnabled = isEnabled,
|
||||
selectedAccount = selectedAccount,
|
||||
)
|
||||
val title = when (isAccountsMode) {
|
||||
true -> resourceReference(R.string.common_choose_account)
|
||||
false -> resourceReference(R.string.common_choose_wallet)
|
||||
|
|
@ -75,8 +81,18 @@ internal class PortfolioSelectorModel @Inject constructor(
|
|||
isEnabled: (UserWallet, AccountStatus) -> Boolean,
|
||||
selectedAccount: AccountId?,
|
||||
): List<PortfolioSelectorItemUM> = when (isAccountsMode) {
|
||||
true -> buildAccountsList(portfolioData, artworks, isEnabled, selectedAccount)
|
||||
false -> buildWalletList(portfolioData, artworks, isEnabled, selectedAccount)
|
||||
true -> buildAccountsList(
|
||||
portfolioData = portfolioData,
|
||||
artworks = artworks,
|
||||
isEnabled = isEnabled,
|
||||
selectedAccount = selectedAccount,
|
||||
)
|
||||
false -> buildWalletList(
|
||||
portfolioData = portfolioData,
|
||||
artworks = artworks,
|
||||
isEnabled = isEnabled,
|
||||
selectedAccount = selectedAccount,
|
||||
)
|
||||
}
|
||||
|
||||
private fun buildWalletList(
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.tangem.features.account.selector.ui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
|
|||
|
|
@ -161,76 +161,65 @@ internal object PortfolioSelectorPreviewData {
|
|||
get() = walletItem.copy(isEnabled = false)
|
||||
|
||||
val firstList
|
||||
get() = buildList {
|
||||
get() = listOf(
|
||||
PortfolioSelectorItemUM.GroupTitle(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = stringReference("Tangem 2.0"),
|
||||
).let(::add)
|
||||
accountItem
|
||||
.let { PortfolioSelectorItemUM.Portfolio(it, false) }
|
||||
.let(::add)
|
||||
lockedAccountItem
|
||||
.let { PortfolioSelectorItemUM.Portfolio(it, false) }
|
||||
.let(::add)
|
||||
),
|
||||
PortfolioSelectorItemUM.Portfolio(accountItem, false),
|
||||
PortfolioSelectorItemUM.Portfolio(lockedAccountItem, false),
|
||||
PortfolioSelectorItemUM.GroupTitle(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = stringReference("Tangem White"),
|
||||
).let(::add)
|
||||
accountItem.let { PortfolioSelectorItemUM.Portfolio(it, true) }
|
||||
.let(::add)
|
||||
}
|
||||
),
|
||||
PortfolioSelectorItemUM.Portfolio(accountItem, true),
|
||||
)
|
||||
|
||||
val secondList
|
||||
get() = firstList + buildList {
|
||||
get() = firstList + listOf(
|
||||
PortfolioSelectorItemUM.GroupTitle(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = resourceReference(R.string.common_locked_wallets),
|
||||
).let(::add)
|
||||
add(PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false))
|
||||
add(PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false))
|
||||
}
|
||||
),
|
||||
PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false),
|
||||
PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false),
|
||||
)
|
||||
|
||||
val walletList
|
||||
get() = buildList {
|
||||
add(PortfolioSelectorItemUM.Portfolio(walletItem, false))
|
||||
add(PortfolioSelectorItemUM.Portfolio(walletItem, true))
|
||||
}
|
||||
get() = listOf(
|
||||
PortfolioSelectorItemUM.Portfolio(walletItem, false),
|
||||
PortfolioSelectorItemUM.Portfolio(walletItem, true),
|
||||
)
|
||||
|
||||
val lockedWalletList
|
||||
get() = buildList {
|
||||
add(PortfolioSelectorItemUM.Portfolio(walletItem, true))
|
||||
val title = PortfolioSelectorItemUM.GroupTitle(
|
||||
get() = listOf(
|
||||
PortfolioSelectorItemUM.Portfolio(walletItem, true),
|
||||
PortfolioSelectorItemUM.GroupTitle(
|
||||
id = UUID.randomUUID().toString(),
|
||||
name = resourceReference(R.string.common_locked_wallets),
|
||||
)
|
||||
add(title)
|
||||
add(PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false))
|
||||
add(PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false))
|
||||
}
|
||||
),
|
||||
PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false),
|
||||
PortfolioSelectorItemUM.Portfolio(lockedWalletItem, false),
|
||||
)
|
||||
}
|
||||
|
||||
internal class PortfolioSelectorPreviewStateProvider : CollectionPreviewParameterProvider<PortfolioSelectorUM>(
|
||||
buildList {
|
||||
val first = PortfolioSelectorUM(
|
||||
listOf(
|
||||
PortfolioSelectorUM(
|
||||
title = resourceReference(R.string.common_choose_account),
|
||||
items = firstList.toImmutableList(),
|
||||
)
|
||||
val second = PortfolioSelectorUM(
|
||||
),
|
||||
PortfolioSelectorUM(
|
||||
title = resourceReference(R.string.common_choose_account),
|
||||
items = secondList.toImmutableList(),
|
||||
)
|
||||
val walletListUM = PortfolioSelectorUM(
|
||||
),
|
||||
PortfolioSelectorUM(
|
||||
title = resourceReference(R.string.common_choose_wallet),
|
||||
items = walletList.toImmutableList(),
|
||||
)
|
||||
val lockedWalletListUM =
|
||||
PortfolioSelectorUM(
|
||||
title = resourceReference(R.string.common_choose_wallet),
|
||||
items = lockedWalletList.toImmutableList(),
|
||||
)
|
||||
add(first)
|
||||
add(second)
|
||||
add(walletListUM)
|
||||
add(lockedWalletListUM)
|
||||
},
|
||||
),
|
||||
PortfolioSelectorUM(
|
||||
title = resourceReference(R.string.common_choose_wallet),
|
||||
items = lockedWalletList.toImmutableList(),
|
||||
),
|
||||
),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue