Updated on 2026-08-14

This commit is contained in:
Tangem 2023-09-26 18:14:45 +05:00
parent 8f639cbc60
commit c215778788
16 changed files with 230 additions and 88 deletions

View file

@ -103,6 +103,12 @@ internal object TokensDomainModule {
return FetchCurrencyStatusUseCase(currenciesRepository, networksRepository, quotesRepository)
}
@Provides
@ViewModelScoped
fun provideGetCryptoCurrencyUseCase(currenciesRepository: CurrenciesRepository): GetCryptoCurrencyUseCase {
return GetCryptoCurrencyUseCase(currenciesRepository)
}
@Provides
@ViewModelScoped
fun provideToggleTokenListGroupingUseCase(

View file

@ -7,7 +7,10 @@ import com.tangem.common.flatMap
import com.tangem.core.analytics.Analytics
import com.tangem.core.navigation.AppScreen
import com.tangem.core.navigation.NavigationAction
import com.tangem.core.ui.extensions.networkIconResId
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.features.tokendetails.navigation.TokenDetailsArguments
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
import com.tangem.tap.common.analytics.events.AnalyticsParam
import com.tangem.tap.common.analytics.events.Token.ButtonRemoveToken
@ -17,6 +20,7 @@ import com.tangem.tap.common.extensions.dispatchErrorNotification
import com.tangem.tap.common.extensions.dispatchWithMain
import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.domain.TapError
import com.tangem.tap.features.wallet.models.Currency
import com.tangem.tap.features.wallet.converters.CryptoCurrencyConverter
import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.features.wallet.redux.WalletState
@ -40,8 +44,7 @@ class MultiWalletMiddleware {
is WalletAction.MultiWallet.SelectWallet -> {
if (action.currency != null) {
val bundle = bundleOf(
// TODO: [REDACTED_JIRA]
TokenDetailsRouter.SELECTED_CURRENCY_KEY to cryptoCurrencyConverter.convert(action.currency),
TokenDetailsRouter.TOKEN_DETAILS_ARGS to createTokenDetailsArgument(action.currency),
)
store.dispatch(NavigationAction.NavigateTo(screen = AppScreen.WalletDetails, bundle = bundle))
}
@ -130,4 +133,21 @@ class MultiWalletMiddleware {
store.state.globalState.tapWalletManager.loadData(updatedUserWallet, refresh = true)
}
}
private fun createTokenDetailsArgument(currency: Currency): TokenDetailsArguments {
val cryptoCurrency = cryptoCurrencyConverter.convert(currency)
return TokenDetailsArguments(
currencyId = cryptoCurrency.id,
currencyName = cryptoCurrency.name,
iconUrl = cryptoCurrency.iconUrl,
coinType = when (cryptoCurrency) {
is CryptoCurrency.Coin -> TokenDetailsArguments.CoinType.Native
is CryptoCurrency.Token -> TokenDetailsArguments.CoinType.Token(
standardName = cryptoCurrency.network.standardType.name,
networkName = cryptoCurrency.network.name,
networkIcon = cryptoCurrency.networkIconResId,
)
},
)
}
}