Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-16 17:48:11 +03:00
parent 45ab6836ad
commit 5c56f04c38
52 changed files with 228 additions and 72 deletions

View file

@ -223,6 +223,7 @@ internal class StakingModel @Inject constructor(
subscribeOnSelectedAppCurrency()
subscribeOnBalanceHiding()
subscribeOnCurrencyStatusUpdates()
stateController.initializeWithUserWallet(userWallet)
}
override fun onDestroy() {
@ -607,6 +608,7 @@ internal class StakingModel @Inject constructor(
override fun showApprovalBottomSheet() {
stateController.update(
ShowApprovalBottomSheetTransformer(
userWallet = userWallet,
appCurrencyProvider = Provider { appCurrency },
cryptoCurrencyStatusProvider = Provider { cryptoCurrencyStatus },
feeCryptoCurrencyStatus = feeCryptoCurrencyStatus,

View file

@ -6,6 +6,7 @@ import com.tangem.core.navigation.url.UrlOpener
import com.tangem.core.ui.event.consumedEvent
import com.tangem.core.ui.event.triggeredEvent
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.features.staking.impl.presentation.state.events.StakingEvent
import com.tangem.features.staking.impl.presentation.state.stub.StakingClickIntentsStub
@ -33,6 +34,14 @@ internal class StakingStateController @Inject constructor(
private val buttonsTransformer = SetButtonsStateTransformer(urlOpener)
private val titleTransformer = SetTitleTransformer
fun initializeWithUserWallet(userWallet: UserWallet) {
mutableUiState.update {
it.copy(
showColdWalletInteractionIcon = userWallet is UserWallet.Cold,
)
}
}
fun update(function: (StakingUiState) -> StakingUiState) {
mutableUiState.update(function = function)
mutableUiState.update(function = buttonsTransformer::transform)
@ -88,6 +97,7 @@ internal class StakingStateController @Inject constructor(
actionType = StakingActionCommonType.Enter(skipEnterAmount = false),
buttonsState = NavigationButtonsState.Empty,
balanceState = null,
showColdWalletInteractionIcon = true,
)
}
}

View file

@ -42,6 +42,7 @@ internal data class StakingUiState(
val buttonsState: NavigationButtonsState,
val event: StateEvent<StakingEvent>,
val balanceState: BalanceState?,
val showColdWalletInteractionIcon: Boolean,
) {
fun copyWrapped(

View file

@ -49,7 +49,7 @@ internal class SetButtonsStateTransformer(
val isPrimaryButtonDisabled = prevState.isPrimaryButtonDisabled()
return NavigationButton(
textReference = prevState.getButtonText(),
iconRes = R.drawable.ic_tangem_24,
iconRes = R.drawable.ic_tangem_24.takeIf { prevState.showColdWalletInteractionIcon },
isDimmed = isPrimaryButtonDisabled,
isIconVisible = isIconVisible,
showProgress = isInProgress,

View file

@ -2,6 +2,7 @@ package com.tangem.features.staking.impl.presentation.state.transformers.approva
import com.tangem.common.ui.amountScreen.models.AmountState
import com.tangem.common.ui.bottomsheet.permission.state.*
import com.tangem.common.ui.userwallet.ext.walletInterationIcon
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.extensions.wrappedList
@ -10,6 +11,7 @@ import com.tangem.core.ui.format.bigdecimal.fiat
import com.tangem.core.ui.format.bigdecimal.format
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.FeeState
import com.tangem.features.staking.impl.presentation.state.StakingStates
@ -18,6 +20,7 @@ import com.tangem.utils.Provider
import com.tangem.utils.transformer.Transformer
internal class ShowApprovalBottomSheetTransformer(
private val userWallet: UserWallet,
private val appCurrencyProvider: Provider<AppCurrency>,
private val cryptoCurrencyStatusProvider: Provider<CryptoCurrencyStatus>,
private val feeCryptoCurrencyStatus: CryptoCurrencyStatus?,
@ -75,6 +78,7 @@ internal class ShowApprovalBottomSheetTransformer(
footerText = resourceReference(R.string.staking_give_permission_fee_footer),
onChangeApproveType = prevState.clickIntents::onApproveTypeChange,
),
walletInteractionIcon = walletInterationIcon(userWallet),
onCancel = onDismiss,
),
),