Updated on 2026-08-14
This commit is contained in:
parent
1858d5453a
commit
90abe449d6
23 changed files with 1741 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ import com.tangem.domain.pay.usecase.TangemPayMainScreenCustomerInfoUseCase
|
|||
import com.tangem.domain.settings.*
|
||||
import com.tangem.domain.tokens.RefreshMultiCurrencyWalletQuotesUseCase
|
||||
import com.tangem.domain.wallets.usecase.*
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyApyUpdateUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
|
||||
|
|
@ -100,6 +101,7 @@ internal class WalletModel @Inject constructor(
|
|||
private val bindRefcodeWithWalletUseCase: BindRefcodeWithWalletUseCase,
|
||||
private val appsFlyerStore: AppsFlyerStore,
|
||||
private val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
val screenLifecycleProvider: ScreenLifecycleProvider,
|
||||
val innerWalletRouter: InnerWalletRouter,
|
||||
) : Model() {
|
||||
|
|
@ -520,6 +522,7 @@ internal class WalletModel @Inject constructor(
|
|||
wallets = action.wallets,
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -565,6 +568,7 @@ internal class WalletModel @Inject constructor(
|
|||
newUserWallet = action.selectedWallet,
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -585,6 +589,7 @@ internal class WalletModel @Inject constructor(
|
|||
userWallet = userWallet,
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -598,6 +603,7 @@ internal class WalletModel @Inject constructor(
|
|||
userWallet = action.selectedWallet,
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
@ -658,6 +664,7 @@ internal class WalletModel @Inject constructor(
|
|||
unlockedWallets = action.unlockedWallets,
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.feature.wallet.presentation.preview
|
||||
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import com.tangem.core.ui.ds.image.DeviceIconUM
|
||||
import com.tangem.core.ui.extensions.combinedReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.extensions.styledStringReference
|
||||
|
|
@ -31,6 +32,7 @@ internal object WalletBalancePreview {
|
|||
),
|
||||
stringReference(" $"),
|
||||
),
|
||||
deviceIcon = DeviceIconUM.Stub(cardsCount = 3),
|
||||
isBalanceFlickering = false,
|
||||
isZeroBalance = false,
|
||||
)
|
||||
|
|
@ -38,10 +40,12 @@ internal object WalletBalancePreview {
|
|||
val loading: WalletBalanceUM.Loading = WalletBalanceUM.Loading(
|
||||
id = UserWalletId("1"),
|
||||
name = "My Wallet",
|
||||
deviceIcon = DeviceIconUM.Mobile,
|
||||
)
|
||||
|
||||
val error: WalletBalanceUM.Error = WalletBalanceUM.Error(
|
||||
id = UserWalletId("2"),
|
||||
name = "My Wallet",
|
||||
deviceIcon = DeviceIconUM.Stub(cardsCount = 3),
|
||||
)
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import javax.inject.Inject
|
|||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Deprecated("Will be removed in favor of getWalletIconUseCase")
|
||||
internal class WalletImageResolver @Inject constructor(
|
||||
private val walletsRepository: WalletsRepository,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import com.tangem.core.ui.ds.image.DeviceIconUM
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
||||
|
|
@ -24,6 +25,9 @@ internal sealed interface WalletBalanceUM {
|
|||
/** Wallet Name */
|
||||
val name: String
|
||||
|
||||
/** Wallet Icon */
|
||||
val deviceIcon: DeviceIconUM
|
||||
|
||||
/**
|
||||
* Wallet card content state
|
||||
*
|
||||
|
|
@ -34,6 +38,7 @@ internal sealed interface WalletBalanceUM {
|
|||
data class Content(
|
||||
override val id: UserWalletId,
|
||||
override val name: String,
|
||||
override val deviceIcon: DeviceIconUM,
|
||||
val balance: TextReference,
|
||||
val balanceInAppBar: TextReference,
|
||||
val isBalanceFlickering: Boolean,
|
||||
|
|
@ -49,6 +54,7 @@ internal sealed interface WalletBalanceUM {
|
|||
data class Error(
|
||||
override val id: UserWalletId,
|
||||
override val name: String,
|
||||
override val deviceIcon: DeviceIconUM,
|
||||
) : WalletBalanceUM
|
||||
|
||||
/**
|
||||
|
|
@ -60,6 +66,7 @@ internal sealed interface WalletBalanceUM {
|
|||
data class Loading(
|
||||
override val id: UserWalletId,
|
||||
override val name: String,
|
||||
override val deviceIcon: DeviceIconUM,
|
||||
) : WalletBalanceUM
|
||||
|
||||
fun copySealed(name: String): WalletBalanceUM {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
|
||||
|
|
@ -11,12 +12,14 @@ internal class AddWalletTransformer(
|
|||
private val userWallet: UserWallet,
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) : WalletScreenStateTransformer {
|
||||
|
||||
private val walletLoadingStateFactory by lazy {
|
||||
WalletLoadingStateFactory(
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
||||
|
||||
import com.tangem.common.ui.userwallet.converter.WalletIconUMConverter
|
||||
import com.tangem.core.ui.ds.button.TangemButtonUM
|
||||
import com.tangem.domain.card.common.util.cardTypesResolver
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.isLocked
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||
|
|
@ -22,12 +24,14 @@ internal class InitializeWalletsTransformer(
|
|||
private val wallets: List<UserWallet>,
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) : WalletScreenStateTransformer {
|
||||
|
||||
private val walletLoadingStateFactory by lazy {
|
||||
WalletLoadingStateFactory(
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +115,8 @@ internal class InitializeWalletsTransformer(
|
|||
walletsBalanceUM = WalletBalanceUM.Loading(
|
||||
id = walletId,
|
||||
name = name,
|
||||
deviceIcon = getWalletIconUseCase.invoke(userWallet = this)
|
||||
.let { WalletIconUMConverter().convert(it) },
|
||||
),
|
||||
buttons = createWalletActions(userWallet = this),
|
||||
type = when (this) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
|||
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
|
||||
|
|
@ -22,12 +23,14 @@ internal class ReinitializeNewWalletTransformer(
|
|||
private val newUserWallet: UserWallet,
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) : WalletScreenStateTransformer {
|
||||
|
||||
private val walletLoadingStateFactory by lazy {
|
||||
WalletLoadingStateFactory(
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
||||
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
|
||||
|
|
@ -18,12 +19,14 @@ internal class ReinitializeWalletTransformer(
|
|||
private val userWallet: UserWallet,
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) : WalletStateTransformer(userWalletId = userWallet.walletId) {
|
||||
|
||||
private val walletLoadingStateFactory by lazy {
|
||||
WalletLoadingStateFactory(
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ internal class SetTokenListErrorTransformer(
|
|||
return WalletBalanceUM.Content(
|
||||
id = id,
|
||||
name = name,
|
||||
deviceIcon = deviceIcon,
|
||||
balanceInAppBar = BigDecimal.ZERO.formatStyled {
|
||||
fiat(
|
||||
fiatCurrencyCode = appCurrency.code,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.feature.wallet.presentation.wallet.state.transformers
|
|||
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
|
||||
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
|
||||
|
|
@ -16,12 +17,14 @@ internal class UnlockWalletTransformer(
|
|||
private val unlockedWallets: List<UserWallet>,
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) : WalletScreenStateTransformer {
|
||||
|
||||
private val walletLoadingStateFactory by lazy {
|
||||
WalletLoadingStateFactory(
|
||||
clickIntents = clickIntents,
|
||||
walletImageResolver = walletImageResolver,
|
||||
getWalletIconUseCase = getWalletIconUseCase,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ internal class MultiWalletBalanceUMTransformer(
|
|||
return WalletBalanceUM.Loading(
|
||||
id = id,
|
||||
name = name,
|
||||
deviceIcon = deviceIcon,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ internal class MultiWalletBalanceUMTransformer(
|
|||
return WalletBalanceUM.Error(
|
||||
id = id,
|
||||
name = name,
|
||||
deviceIcon = deviceIcon,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +44,7 @@ internal class MultiWalletBalanceUMTransformer(
|
|||
return WalletBalanceUM.Content(
|
||||
id = id,
|
||||
name = name,
|
||||
deviceIcon = deviceIcon,
|
||||
balanceInAppBar = fiatBalance.amount.formatStyled {
|
||||
fiat(
|
||||
fiatCurrencyCode = appCurrency.code,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.feature.wallet.presentation.wallet.state.utils
|
||||
|
||||
import com.tangem.common.ui.userwallet.converter.WalletIconUMConverter
|
||||
import com.tangem.core.analytics.models.event.MainScreenAnalyticsEvent.Companion.WALLET_TYPE
|
||||
import com.tangem.core.ui.components.containers.pullToRefresh.PullToRefreshConfig
|
||||
import com.tangem.core.ui.components.marketprice.MarketPriceBlockState
|
||||
|
|
@ -10,6 +11,7 @@ import com.tangem.domain.card.common.util.cardTypesResolver
|
|||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.models.wallet.isMultiCurrency
|
||||
import com.tangem.domain.wallets.usecase.GetWalletIconUseCase
|
||||
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
|
||||
import com.tangem.feature.wallet.impl.R
|
||||
import com.tangem.feature.wallet.presentation.wallet.domain.WalletAdditionalInfoFactory
|
||||
|
|
@ -30,6 +32,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
internal class WalletLoadingStateFactory(
|
||||
private val clickIntents: WalletClickIntents,
|
||||
private val walletImageResolver: WalletImageResolver,
|
||||
private val getWalletIconUseCase: GetWalletIconUseCase,
|
||||
) {
|
||||
|
||||
fun create(userWallet: UserWallet): WalletState {
|
||||
|
|
@ -52,6 +55,8 @@ internal class WalletLoadingStateFactory(
|
|||
walletsBalanceUM = WalletBalanceUM.Loading(
|
||||
id = userWallet.walletId,
|
||||
name = userWallet.name,
|
||||
deviceIcon = getWalletIconUseCase.invoke(userWallet = userWallet)
|
||||
.let { WalletIconUMConverter().convert(it) },
|
||||
),
|
||||
buttons = createWalletActions(userWallet),
|
||||
notifications = persistentListOf(),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import androidx.compose.animation.fadeOut
|
|||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.TextAutoSize
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.key
|
||||
|
|
@ -16,21 +15,19 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.R
|
||||
import com.tangem.core.ui.components.SpacerH
|
||||
import com.tangem.core.ui.components.TextShimmer
|
||||
import com.tangem.core.ui.components.text.applyBladeBrush
|
||||
import com.tangem.core.ui.ds.button.SecondaryTangemButton
|
||||
import com.tangem.core.ui.ds.button.TangemButtonShape
|
||||
import com.tangem.core.ui.ds.button.TangemButtonUM
|
||||
import com.tangem.core.ui.ds.image.TangemDeviceIcon
|
||||
import com.tangem.core.ui.ds.topbar.collapsing.TangemCollapsingAppBarBehavior
|
||||
import com.tangem.core.ui.ds.topbar.collapsing.rememberTangemExitUntilCollapsedScrollBehavior
|
||||
import com.tangem.core.ui.ds.topbar.collapsing.snapToExitUntilCollapsed
|
||||
|
|
@ -87,19 +84,14 @@ internal fun WalletBalance(
|
|||
SpacerH(TangemTheme.dimens2.x3)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x2),
|
||||
horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x1),
|
||||
) {
|
||||
Text(
|
||||
text = walletBalanceUM.name,
|
||||
style = TangemTheme.typography2.bodyRegular14,
|
||||
color = TangemTheme.colors2.text.neutral.tertiary,
|
||||
)
|
||||
Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.ic_tangem_24),
|
||||
contentDescription = null,
|
||||
tint = TangemTheme.colors2.graphic.neutral.tertiaryConstant,
|
||||
modifier = Modifier.size(TangemTheme.dimens2.x6),
|
||||
)
|
||||
TangemDeviceIcon(state = walletBalanceUM.deviceIcon)
|
||||
}
|
||||
}
|
||||
SpacerH(TangemTheme.dimens2.x2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue