diff --git a/domain/account/src/main/java/com/tangem/domain/account/models/AccountList.kt b/domain/account/src/main/java/com/tangem/domain/account/models/AccountList.kt index 872e82d16f..5f7740206a 100644 --- a/domain/account/src/main/java/com/tangem/domain/account/models/AccountList.kt +++ b/domain/account/src/main/java/com/tangem/domain/account/models/AccountList.kt @@ -18,6 +18,8 @@ import kotlinx.serialization.Serializable * @property userWalletId the user wallet id associated with the account list * @property accounts a list of accounts belonging to the user wallet * @property totalAccounts the total number of accounts + * @property sortType the sorting type applied to the accounts + * @property groupType the grouping type applied to the accounts * [REDACTED_AUTHOR] */ diff --git a/domain/account/src/main/java/com/tangem/domain/account/models/AccountStatusList.kt b/domain/account/src/main/java/com/tangem/domain/account/models/AccountStatusList.kt index 761ac72309..b982971414 100644 --- a/domain/account/src/main/java/com/tangem/domain/account/models/AccountStatusList.kt +++ b/domain/account/src/main/java/com/tangem/domain/account/models/AccountStatusList.kt @@ -1,5 +1,7 @@ package com.tangem.domain.account.models +import com.tangem.domain.models.TokensGroupType +import com.tangem.domain.models.TokensSortType import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.account.AccountStatus import com.tangem.domain.models.currency.CryptoCurrencyStatus @@ -13,6 +15,8 @@ import kotlinx.serialization.Serializable * @property accountStatuses a set of account statuses associated with the user wallet * @property totalAccounts the total number of accounts (including archived ones) * @property totalFiatBalance the total fiat balance across all accounts + * @property sortType the sorting type applied to the accounts + * @property groupType the grouping type applied to the accounts * [REDACTED_AUTHOR] */ @@ -22,6 +26,8 @@ data class AccountStatusList( val accountStatuses: List, val totalAccounts: Int, val totalFiatBalance: TotalFiatBalance, + val sortType: TokensSortType, + val groupType: TokensGroupType, ) { val mainAccount: AccountStatus diff --git a/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt b/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt index 78bb3226e7..eea36af204 100644 --- a/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt +++ b/domain/account/status/src/main/java/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducer.kt @@ -86,6 +86,8 @@ internal class DefaultSingleAccountStatusListProducer @AssistedInject constructo accountStatuses = accountStatuses.toList(), totalAccounts = accountList.totalAccounts, totalFiatBalance = TotalFiatBalanceCalculator.calculate(balances), + sortType = accountList.sortType, + groupType = accountList.groupType, ) } } diff --git a/domain/account/status/src/test/kotlin/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducerTest.kt b/domain/account/status/src/test/kotlin/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducerTest.kt index 8ff3b59d4f..fa8f5e0a78 100644 --- a/domain/account/status/src/test/kotlin/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducerTest.kt +++ b/domain/account/status/src/test/kotlin/com/tangem/domain/account/status/producer/DefaultSingleAccountStatusListProducerTest.kt @@ -84,6 +84,8 @@ class DefaultSingleAccountStatusListProducerTest { ), totalAccounts = 1, totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL), + sortType = accountList.sortType, + groupType = accountList.groupType, ) Truth.assertThat(actual).containsExactly(expected) @@ -119,6 +121,8 @@ class DefaultSingleAccountStatusListProducerTest { ), totalAccounts = 1, totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL), + sortType = accountList.sortType, + groupType = accountList.groupType, ) Truth.assertThat(actual1).containsExactly(expected) @@ -138,6 +142,8 @@ class DefaultSingleAccountStatusListProducerTest { ), totalAccounts = 1, totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL), + sortType = updatedAccountList.sortType, + groupType = updatedAccountList.groupType, ) Truth.assertThat(actual2).containsExactly(expected2) @@ -168,6 +174,8 @@ class DefaultSingleAccountStatusListProducerTest { ), totalAccounts = 1, totalFiatBalance = TotalFiatBalance.Loaded(amount = BigDecimal.ZERO, source = StatusSource.ACTUAL), + sortType = accountList.sortType, + groupType = accountList.groupType, ) // Act (first emission) @@ -239,6 +247,8 @@ class DefaultSingleAccountStatusListProducerTest { ), totalAccounts = 1, totalFiatBalance = TotalFiatBalance.Loading, + sortType = accountList.sortType, + groupType = accountList.groupType, ) Truth.assertThat(actual).containsExactly(expected)