Updated on 2026-08-14

This commit is contained in:
Tangem 2024-03-12 19:34:15 +04:00
parent 6279e6f808
commit bee7b16acc
12 changed files with 148 additions and 134 deletions

View file

@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.firstOrNull
class GetUserWalletUseCase(private val walletsStateHolder: WalletsStateHolder) {
suspend operator fun invoke(userWalletId: UserWalletId): Either<Any, UserWallet> = either {
suspend operator fun invoke(userWalletId: UserWalletId): Either<GetUserWalletError, UserWallet> = either {
val userWalletsListManager = ensureUserWalletListManagerNotNull(
walletsStateHolder = walletsStateHolder,
raise = GetUserWalletError::DataError,

View file

@ -32,19 +32,13 @@ internal sealed interface WalletState : WalletStateHolder {
data class Locked(
override val walletCardState: WalletCardState,
override val bottomSheetConfig: TangemBottomSheetConfig?,
val onUnlockNotificationClick: () -> Unit,
val isBottomSheetShow: Boolean = false,
val onBottomSheetDismiss: () -> Unit = {},
val onUnlockClick: () -> Unit,
val onScanClick: () -> Unit,
) : MultiCurrency(),
WalletStateHolder by LockedWalletStateHolder(
walletCardState,
bottomSheetConfig,
onUnlockNotificationClick,
isBottomSheetShow,
onBottomSheetDismiss,
onUnlockClick,
onScanClick,
) {
override val tokensListState = WalletTokensListState.ContentState.Locked
@ -70,21 +64,15 @@ internal sealed interface WalletState : WalletStateHolder {
data class Locked(
override val walletCardState: WalletCardState,
override val buttons: PersistentList<WalletManageButton>,
override val bottomSheetConfig: TangemBottomSheetConfig?,
val onUnlockNotificationClick: () -> Unit,
val isBottomSheetShow: Boolean = false,
val onBottomSheetDismiss: () -> Unit = {},
val onUnlockClick: () -> Unit,
val onScanClick: () -> Unit,
val onExploreClick: () -> Unit,
) : SingleCurrency(),
TxHistoryStateHolder by LockedTxHistoryStateHolder(onExploreClick),
WalletStateHolder by LockedWalletStateHolder(
walletCardState,
bottomSheetConfig,
onUnlockNotificationClick,
isBottomSheetShow,
onBottomSheetDismiss,
onUnlockClick,
onScanClick,
) {
override val marketPriceBlockState: MarketPriceBlockState? = null
@ -108,20 +96,14 @@ internal sealed interface WalletState : WalletStateHolder {
data class Locked(
override val walletCardState: WalletCardState,
val onUnlockNotificationClick: () -> Unit,
val isBottomSheetShow: Boolean = false,
val onBottomSheetDismiss: () -> Unit = {},
val onUnlockClick: () -> Unit,
val onScanClick: () -> Unit,
override val bottomSheetConfig: TangemBottomSheetConfig?,
val onExploreClick: () -> Unit,
) : Visa(),
TxHistoryStateHolder by LockedTxHistoryStateHolder(onExploreClick),
WalletStateHolder by LockedWalletStateHolder(
walletCardState,
bottomSheetConfig,
onUnlockNotificationClick,
isBottomSheetShow,
onBottomSheetDismiss,
onUnlockClick,
onScanClick,
) {
override val balancesAndLimitBlockState: BalancesAndLimitsBlockState? = null

View file

@ -1,7 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.state.model.holder
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletBottomSheetConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletCardState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletPullToRefreshConfig
@ -18,11 +17,8 @@ internal interface WalletStateHolder {
internal class LockedWalletStateHolder(
override val walletCardState: WalletCardState,
override val bottomSheetConfig: TangemBottomSheetConfig?,
onUnlockNotificationClick: () -> Unit,
isBottomSheetShow: Boolean,
onBottomSheetDismiss: () -> Unit,
onUnlockClick: () -> Unit,
onScanClick: () -> Unit,
) : WalletStateHolder {
override val pullToRefreshConfig: WalletPullToRefreshConfig
@ -31,13 +27,4 @@ internal class LockedWalletStateHolder(
override val warnings: ImmutableList<WalletNotification> = persistentListOf(
WalletNotification.UnlockWallets(onUnlockNotificationClick),
)
override val bottomSheetConfig = TangemBottomSheetConfig(
isShow = isBottomSheetShow,
onDismissRequest = onBottomSheetDismiss,
content = WalletBottomSheetConfig.UnlockWallets(
onUnlockClick = onUnlockClick,
onScanClick = onScanClick,
),
)
}

View file

@ -7,18 +7,28 @@ internal class CloseBottomSheetTransformer(userWalletId: UserWalletId) : WalletS
override fun transform(prevState: WalletState): WalletState {
return when (prevState) {
is WalletState.MultiCurrency.Content -> {
prevState.copy(bottomSheetConfig = prevState.bottomSheetConfig?.copy(isShow = false))
}
is WalletState.MultiCurrency.Locked -> prevState.copy(isBottomSheetShow = false)
is WalletState.SingleCurrency.Content -> {
prevState.copy(bottomSheetConfig = prevState.bottomSheetConfig?.copy(isShow = false))
}
is WalletState.SingleCurrency.Locked -> prevState.copy(isBottomSheetShow = false)
is WalletState.Visa.Content -> prevState.copy(
bottomSheetConfig = prevState.bottomSheetConfig?.copy(isShow = false),
is WalletState.MultiCurrency.Content -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.MultiCurrency.Locked -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.SingleCurrency.Content -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.SingleCurrency.Locked -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.Visa.Content -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.Visa.Locked -> prevState.copy(
bottomSheetConfig = updateConfig(prevState),
)
is WalletState.Visa.Locked -> prevState.copy(isBottomSheetShow = false)
}
}
private fun updateConfig(prevState: WalletState) = prevState.bottomSheetConfig?.copy(
isShow = false,
)
}

View file

@ -13,7 +13,6 @@ import kotlinx.collections.immutable.toImmutableList
internal class InitializeWalletsTransformer(
private val selectedWalletIndex: Int,
private val selectedWallet: UserWallet,
private val wallets: List<UserWallet>,
private val clickIntents: WalletClickIntents,
) : WalletScreenStateTransformer {
@ -23,7 +22,7 @@ internal class InitializeWalletsTransformer(
override fun transform(prevState: WalletScreenState): WalletScreenState {
return prevState.copy(
onBackClick = clickIntents::onBackClick,
topBarConfig = createTopBarConfig(userWallet = selectedWallet),
topBarConfig = createTopBarConfig(),
selectedWalletIndex = selectedWalletIndex,
wallets = wallets
.map { userWallet ->
@ -38,13 +37,9 @@ internal class InitializeWalletsTransformer(
)
}
private fun createTopBarConfig(userWallet: UserWallet): WalletTopBarConfig {
private fun createTopBarConfig(): WalletTopBarConfig {
return WalletTopBarConfig(
onDetailsClick = if (userWallet.isLocked) {
clickIntents::onOpenUnlockWalletsBottomSheetClick
} else {
clickIntents::onDetailsClick
},
onDetailsClick = clickIntents::onDetailsClick,
)
}
@ -53,27 +48,24 @@ internal class InitializeWalletsTransformer(
multiCurrencyCreator = {
WalletState.MultiCurrency.Locked(
walletCardState = userWallet.toLockedWalletCardState(),
bottomSheetConfig = null,
onUnlockNotificationClick = clickIntents::onOpenUnlockWalletsBottomSheetClick,
onUnlockClick = clickIntents::onUnlockWalletClick,
onScanClick = clickIntents::onScanToUnlockWalletClick,
)
},
singleCurrencyCreator = {
WalletState.SingleCurrency.Locked(
walletCardState = userWallet.toLockedWalletCardState(),
bottomSheetConfig = null,
buttons = createDisabledButtons(),
onUnlockNotificationClick = clickIntents::onOpenUnlockWalletsBottomSheetClick,
onUnlockClick = clickIntents::onUnlockWalletClick,
onScanClick = clickIntents::onScanToUnlockWalletClick,
onExploreClick = clickIntents::onExploreClick,
)
},
visaWalletCreator = {
WalletState.Visa.Locked(
walletCardState = userWallet.toLockedWalletCardState(),
bottomSheetConfig = null,
onUnlockNotificationClick = clickIntents::onOpenUnlockWalletsBottomSheetClick,
onUnlockClick = clickIntents::onUnlockWalletClick,
onScanClick = clickIntents::onScanToUnlockWalletClick,
onExploreClick = clickIntents::onExploreClick,
)
},

View file

@ -13,41 +13,30 @@ internal class OpenBottomSheetTransformer(
override fun transform(prevState: WalletState): WalletState {
return when (prevState) {
is WalletState.MultiCurrency.Content -> {
prevState.copy(
bottomSheetConfig = TangemBottomSheetConfig(
isShow = true,
onDismissRequest = onDismissBottomSheet,
content = content,
),
)
}
is WalletState.MultiCurrency.Locked -> {
prevState.copy(isBottomSheetShow = true, onBottomSheetDismiss = onDismissBottomSheet)
}
is WalletState.SingleCurrency.Content -> {
prevState.copy(
bottomSheetConfig = TangemBottomSheetConfig(
isShow = true,
onDismissRequest = onDismissBottomSheet,
content = content,
),
)
}
is WalletState.SingleCurrency.Locked -> {
prevState.copy(isBottomSheetShow = true, onBottomSheetDismiss = onDismissBottomSheet)
}
is WalletState.MultiCurrency.Content -> prevState.copy(
bottomSheetConfig = updateConfig(),
)
is WalletState.MultiCurrency.Locked -> prevState.copy(
bottomSheetConfig = updateConfig(),
)
is WalletState.SingleCurrency.Content -> prevState.copy(
bottomSheetConfig = updateConfig(),
)
is WalletState.SingleCurrency.Locked -> prevState.copy(
bottomSheetConfig = updateConfig(),
)
is WalletState.Visa.Content -> prevState.copy(
bottomSheetConfig = TangemBottomSheetConfig(
isShow = true,
onDismissRequest = onDismissBottomSheet,
content = content,
),
bottomSheetConfig = updateConfig(),
)
is WalletState.Visa.Locked -> prevState.copy(
isBottomSheetShow = true,
onBottomSheetDismiss = onDismissBottomSheet,
bottomSheetConfig = updateConfig(),
)
}
}
private fun updateConfig() = TangemBottomSheetConfig(
isShow = true,
onDismissRequest = onDismissBottomSheet,
content = content,
)
}

View file

@ -4,7 +4,6 @@ import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletScreenState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletTopBarConfig
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletLoadingStateFactory
import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletClickIntents
import kotlinx.collections.immutable.toImmutableList
@ -19,7 +18,6 @@ internal class UnlockWalletTransformer(
override fun transform(prevState: WalletScreenState): WalletScreenState {
return prevState.copy(
topBarConfig = prevState.topBarConfig.toUnlockedState(),
wallets = prevState.wallets
.map { state ->
val unlockedWallet = getUnlockedWallet(state.walletCardState.id)
@ -29,10 +27,6 @@ internal class UnlockWalletTransformer(
)
}
private fun WalletTopBarConfig.toUnlockedState(): WalletTopBarConfig {
return copy(onDetailsClick = clickIntents::onDetailsClick)
}
private fun getUnlockedWallet(walletId: UserWalletId): UserWallet? {
return unlockedWallets.firstOrNull { it.walletId == walletId }
}

View file

@ -8,7 +8,7 @@ import com.tangem.domain.tokens.model.TokenActionsState
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.wallet.state.model.TokenActionButtonConfig
import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletCurrencyActionsClickIntentsImplementor
import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletCurrencyActionsClickIntents
import com.tangem.utils.converter.Converter
import com.tangem.utils.isNullOrZero
import kotlinx.collections.immutable.ImmutableList
@ -16,7 +16,7 @@ import kotlinx.collections.immutable.toImmutableList
internal class MultiWalletCurrencyActionsConverter(
private val userWallet: UserWallet,
private val clickIntents: WalletCurrencyActionsClickIntentsImplementor,
private val clickIntents: WalletCurrencyActionsClickIntents,
) : Converter<TokenActionsState, ImmutableList<TokenActionButtonConfig>> {
override fun convert(value: TokenActionsState): ImmutableList<TokenActionButtonConfig> {

View file

@ -199,7 +199,6 @@ internal class WalletViewModel @Inject constructor(
stateHolder.update(
transformer = InitializeWalletsTransformer(
selectedWalletIndex = action.selectedWalletIndex,
selectedWallet = action.selectedWallet,
wallets = action.wallets,
clickIntents = clickIntents,
),

View file

@ -26,7 +26,7 @@ import javax.inject.Inject
@ViewModelScoped
internal class WalletClickIntents @Inject constructor(
private val walletCardClickIntentsImplementor: WalletCardClickIntentsImplementor,
private val warningsClickIntentsImplementer: WalletWarningsClickIntentsImplementer,
private val warningsClickIntentsImplementer: WalletWarningsClickIntentsImplementor,
private val currencyActionsClickIntentsImplementor: WalletCurrencyActionsClickIntentsImplementor,
private val contentClickIntentsImplementor: WalletContentClickIntentsImplementor,
private val visaWalletIntentsImplementor: VisaWalletIntentsImplementor,

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.viewmodels.intents
import arrow.core.getOrElse
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.domain.redux.ReduxStateHolder
import com.tangem.domain.tokens.GetCryptoCurrencyActionsUseCase
@ -9,17 +10,19 @@ import com.tangem.domain.tokens.model.CryptoCurrencyStatus
import com.tangem.domain.tokens.model.TokenActionsState
import com.tangem.domain.txhistory.usecase.GetExplorerTransactionUrlUseCase
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.feature.wallet.presentation.wallet.analytics.PortfolioEvent
import com.tangem.feature.wallet.presentation.wallet.domain.unwrap
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.feature.wallet.presentation.wallet.state.model.ActionsBottomSheetConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletBottomSheetConfig
import com.tangem.feature.wallet.presentation.wallet.state.transformers.converter.MultiWalletCurrencyActionsConverter
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import dagger.hilt.android.scopes.ViewModelScoped
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject
internal interface WalletContentClickIntents {
@ -43,8 +46,9 @@ internal interface WalletContentClickIntents {
@ViewModelScoped
internal class WalletContentClickIntentsImplementor @Inject constructor(
private val stateHolder: WalletStateController,
private val currencyActionsClickIntentsImplementor: WalletCurrencyActionsClickIntentsImplementor,
private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
private val currencyActionsClickIntents: WalletCurrencyActionsClickIntentsImplementor,
private val walletWarningsClickIntents: WalletWarningsClickIntentsImplementor,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val getPrimaryCurrencyStatusUpdatesUseCase: GetPrimaryCurrencyStatusUpdatesUseCase,
private val getCryptoCurrencyActionsUseCase: GetCryptoCurrencyActionsUseCase,
private val getExplorerTransactionUrlUseCase: GetExplorerTransactionUrlUseCase,
@ -55,7 +59,33 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
override fun onBackClick() = router.popBackStack()
override fun onDetailsClick() = router.openDetailsScreen()
override fun onDetailsClick() {
viewModelScope.launch(dispatchers.main) {
val userWalletId = stateHolder.getSelectedWalletId()
val userWallet = getUserWalletUseCase(userWalletId).getOrElse {
Timber.e(
"""
Unable to get user wallet
|- ID: $userWalletId
|- Exception: $it
""".trimIndent(),
)
return@launch
}
if (userWallet.isLocked) {
stateHolder.showBottomSheet(
WalletBottomSheetConfig.UnlockWallets(
onUnlockClick = walletWarningsClickIntents::onUnlockWalletClick,
onScanClick = walletWarningsClickIntents::onScanToUnlockWalletClick,
),
)
} else {
router.openDetailsScreen()
}
}
}
override fun onManageTokensClick() {
analyticsEventHandler.send(PortfolioEvent.ButtonManageTokens)
@ -74,9 +104,20 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
}
override fun onTokenItemLongClick(cryptoCurrencyStatus: CryptoCurrencyStatus) {
val userWallet = getSelectedWalletSyncUseCase.unwrap() ?: return
viewModelScope.launch(dispatchers.main) {
val userWalletId = stateHolder.getSelectedWalletId()
val userWallet = getUserWalletUseCase(userWalletId).getOrElse {
Timber.e(
"""
Unable to get user wallet
|- ID: $userWalletId
|- Exception: $it
""".trimIndent(),
)
return@launch
}
getCryptoCurrencyActionsUseCase(userWallet = userWallet, cryptoCurrencyStatus = cryptoCurrencyStatus)
.take(count = 1)
.collectLatest {
@ -90,7 +131,7 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
ActionsBottomSheetConfig(
actions = MultiWalletCurrencyActionsConverter(
userWallet = userWallet,
clickIntents = currencyActionsClickIntentsImplementor,
clickIntents = currencyActionsClickIntents,
).convert(tokenActionsState),
),
userWallet.walletId,

View file

@ -1,5 +1,6 @@
package com.tangem.feature.wallet.presentation.wallet.viewmodels.intents
import arrow.core.getOrElse
import com.tangem.core.analytics.api.AnalyticsEventHandler
import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.ui.extensions.resourceReference
@ -13,16 +14,17 @@ import com.tangem.domain.settings.ShouldShowSwapPromoWalletUseCase
import com.tangem.domain.tokens.FetchTokenListUseCase
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.wallets.models.UnlockWalletsError
import com.tangem.domain.wallets.usecase.GetSelectedWalletSyncUseCase
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.domain.wallets.usecase.UnlockWalletsUseCase
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent.Basic
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent.MainScreen
import com.tangem.feature.wallet.presentation.wallet.domain.ScanCardToUnlockWalletClickHandler
import com.tangem.feature.wallet.presentation.wallet.domain.ScanCardToUnlockWalletError
import com.tangem.feature.wallet.presentation.wallet.domain.unwrap
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletAlertState
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletBottomSheetConfig
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletEvent
import com.tangem.feature.wallet.presentation.wallet.state.transformers.CloseBottomSheetTransformer
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
@ -57,17 +59,17 @@ internal interface WalletWarningsClickIntents {
@Suppress("LongParameterList")
@ViewModelScoped
internal class WalletWarningsClickIntentsImplementer @Inject constructor(
internal class WalletWarningsClickIntentsImplementor @Inject constructor(
private val stateHolder: WalletStateController,
private val walletEventSender: WalletEventSender,
private val getSelectedWalletSyncUseCase: GetSelectedWalletSyncUseCase,
private val unlockWalletsUseCase: UnlockWalletsUseCase,
private val derivePublicKeysUseCase: DerivePublicKeysUseCase,
private val scanCardToUnlockWalletClickHandler: ScanCardToUnlockWalletClickHandler,
private val fetchTokenListUseCase: FetchTokenListUseCase,
private val setCardWasScannedUseCase: SetCardWasScannedUseCase,
private val neverToSuggestRateAppUseCase: NeverToSuggestRateAppUseCase,
private val remindToRateAppLaterUseCase: RemindToRateAppLaterUseCase,
private val getUserWalletUseCase: GetUserWalletUseCase,
private val scanCardToUnlockWalletClickHandler: ScanCardToUnlockWalletClickHandler,
private val unlockWalletsUseCase: UnlockWalletsUseCase,
private val analyticsEventHandler: AnalyticsEventHandler,
private val reduxStateHolder: ReduxStateHolder,
private val dispatchers: CoroutineDispatcherProvider,
@ -82,31 +84,33 @@ internal class WalletWarningsClickIntentsImplementer @Inject constructor(
}
private fun prepareOnboardingProcess() {
getSelectedWalletSyncUseCase.unwrap()?.let {
reduxStateHolder.dispatch(
LegacyAction.StartOnboardingProcess(
scanResponse = it.scanResponse,
canSkipBackup = false,
),
)
viewModelScope.launch(dispatchers.main) {
getSelectedUserWallet()?.let {
reduxStateHolder.dispatch(
LegacyAction.StartOnboardingProcess(
scanResponse = it.scanResponse,
canSkipBackup = false,
),
)
}
}
}
override fun onCloseAlreadySignedHashesWarningClick() {
val userWallet = getSelectedWalletSyncUseCase.unwrap() ?: return
viewModelScope.launch(dispatchers.main) {
val userWallet = getSelectedUserWallet() ?: return@launch
setCardWasScannedUseCase(cardId = userWallet.cardId)
}
}
override fun onGenerateMissedAddressesClick(missedAddressCurrencies: List<CryptoCurrency>) {
val userWallet = getSelectedWalletSyncUseCase.unwrap() ?: return
analyticsEventHandler.send(Basic.CardWasScanned(AnalyticsParam.ScannedFrom.Main))
analyticsEventHandler.send(MainScreen.NoticeScanYourCardTapped)
viewModelScope.launch(dispatchers.main) {
val userWallet = getSelectedUserWallet() ?: return@launch
derivePublicKeysUseCase(
userWalletId = userWallet.walletId,
currencies = missedAddressCurrencies,
@ -119,11 +123,12 @@ internal class WalletWarningsClickIntentsImplementer @Inject constructor(
override fun onOpenUnlockWalletsBottomSheetClick() {
analyticsEventHandler.send(MainScreen.WalletUnlockTapped)
val config = requireNotNull(stateHolder.getSelectedWallet().bottomSheetConfig) {
"Impossible to open unlock wallet bottom sheet if it's null"
}
stateHolder.showBottomSheet(config.content)
stateHolder.showBottomSheet(
WalletBottomSheetConfig.UnlockWallets(
onUnlockClick = this::onUnlockWalletClick,
onScanClick = this::onScanToUnlockWalletClick,
),
)
}
override fun onUnlockWalletClick() {
@ -204,4 +209,19 @@ internal class WalletWarningsClickIntentsImplementer @Inject constructor(
shouldShowSwapPromoWalletUseCase.neverToShow()
}
}
private suspend fun getSelectedUserWallet(): UserWallet? {
val userWalletId = stateHolder.getSelectedWalletId()
return getUserWalletUseCase(userWalletId).getOrElse {
Timber.e(
"""
Unable to get user wallet
|- ID: $userWalletId
|- Exception: $it
""".trimIndent(),
)
null
}
}
}