diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/details/TokenAction.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/details/TokenAction.kt index 5c134f0308..2eb98d3e78 100644 --- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/details/TokenAction.kt +++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/details/TokenAction.kt @@ -4,4 +4,5 @@ enum class TokenAction { Receive, Send, Swap, + Info, } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsClickIntents.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsClickIntents.kt index e0e6cd1566..66d495e481 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsClickIntents.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsClickIntents.kt @@ -79,4 +79,6 @@ interface TokenDetailsClickIntents { fun onConfirmDisposeExpressStatus() fun onDisposeExpressStatus() + + fun onYieldInfoClick() } \ No newline at end of file diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt index ff704f39f3..53870b1c26 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt @@ -8,6 +8,7 @@ import com.arkivanov.decompose.router.slot.activate import com.arkivanov.decompose.router.slot.dismiss import com.tangem.blockchain.common.address.AddressType import com.tangem.common.routing.AppRoute +import com.tangem.common.routing.AppRoute.* import com.tangem.common.routing.AppRouter import com.tangem.common.ui.bottomsheet.receive.AddressModel import com.tangem.common.ui.bottomsheet.receive.mapToAddressModels @@ -1028,6 +1029,15 @@ internal class TokenDetailsModel @Inject constructor( internalUiState.value = stateFactory.getStateWithClosedBottomSheet() } + override fun onYieldInfoClick() { + bottomSheetNavigation.activate( + configuration = TokenDetailsBottomSheetConfig.YieldSupplyWarning( + cryptoCurrency = cryptoCurrency, + tokenAction = TokenAction.Info, + ), + ) + } + private fun handleUnavailabilityReason(unavailabilityReason: ScenarioUnavailabilityReason): Boolean { if (unavailabilityReason == ScenarioUnavailabilityReason.None) return false @@ -1161,7 +1171,9 @@ internal class TokenDetailsModel @Inject constructor( override fun onYieldSupplyWarningAcknowledged(tokenAction: TokenAction) { bottomSheetNavigation.dismiss() modelScope.launch { - saveViewedYieldSupplyWarningUseCase(cryptoCurrency.name) + if(tokenAction != TokenAction.Info) { + saveViewedYieldSupplyWarningUseCase(cryptoCurrency.name) + } if (tokenAction == TokenAction.Receive) { saveViewedTokenReceiveWarningUseCase(cryptoCurrency.name) } @@ -1169,12 +1181,13 @@ internal class TokenDetailsModel @Inject constructor( TokenAction.Receive -> navigateToReceive() TokenAction.Send -> sendCurrency() TokenAction.Swap -> appRouter.push( - AppRoute.Swap( + Swap( currencyFrom = cryptoCurrency, userWalletId = userWalletId, screenSource = AnalyticsParam.ScreensSources.Token.value, ), ) + TokenAction.Info -> Unit } } } diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt index 86527f1f30..22b55017a2 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt @@ -16,8 +16,10 @@ import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDeta import com.tangem.feature.tokendetails.presentation.tokendetails.state.BalanceType import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsBalanceBlockState import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState +import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsYieldSupplyState import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.TokenDetailsNotification import com.tangem.feature.tokendetails.presentation.tokendetails.state.utils.getBalance +import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles import com.tangem.utils.Provider import com.tangem.utils.StringsSigns.DASH_SIGN import com.tangem.utils.converter.Converter @@ -29,6 +31,7 @@ internal class TokenDetailsLoadedBalanceConverter( private val currentStateProvider: Provider, private val appCurrencyProvider: Provider, private val clickIntents: TokenDetailsClickIntents, + private val yieldSupplyFeatureToggles: YieldSupplyFeatureToggles, ) : Converter, TokenDetailsState> { override fun convert(value: Either): TokenDetailsState { @@ -100,6 +103,14 @@ internal class TokenDetailsLoadedBalanceConverter( selectedBalanceType = currentState.selectedBalanceType, isBalanceSelectorEnabled = isBalanceSelectorEnabled, isBalanceFlickering = status.value.isFlickering(), + yieldSupplyState = + if (yieldSupplyFeatureToggles.isYieldSupplyFeatureEnabled && + status.value.yieldSupplyStatus?.isActive == true + ) { + TokenDetailsYieldSupplyState.Active(clickIntents::onYieldInfoClick) + } else { + TokenDetailsYieldSupplyState.Empty + }, ) is CryptoCurrencyStatus.Loading -> TokenDetailsBalanceBlockState.Loading( actionButtons = currentState.actionButtons, diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt index 0ff211dbf7..af30b75a43 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStateFactory.kt @@ -70,6 +70,7 @@ internal class TokenDetailsStateFactory( currentStateProvider = currentStateProvider, appCurrencyProvider = appCurrencyProvider, clickIntents = clickIntents, + yieldSupplyFeatureToggles = yieldSupplyFeatureToggles, ) }