Updated on 2026-08-14
This commit is contained in:
parent
0802dfb9fc
commit
1974534e52
6 changed files with 37 additions and 4 deletions
|
|
@ -158,5 +158,7 @@ internal object WalletScreenPreviewData {
|
|||
onWalletChange = {},
|
||||
event = consumedEvent(),
|
||||
isHidingMode = false,
|
||||
showMarketsOnboarding = false,
|
||||
onDismissMarketsOnboarding = {},
|
||||
)
|
||||
}
|
||||
|
|
@ -94,6 +94,8 @@ internal class WalletStateController @Inject constructor() {
|
|||
onWalletChange = {},
|
||||
event = consumedEvent(),
|
||||
isHidingMode = false,
|
||||
showMarketsOnboarding = false,
|
||||
onDismissMarketsOnboarding = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -13,4 +13,6 @@ internal data class WalletScreenState(
|
|||
val onWalletChange: (Int) -> Unit,
|
||||
val event: StateEvent<WalletEvent>,
|
||||
val isHidingMode: Boolean,
|
||||
val showMarketsOnboarding: Boolean,
|
||||
val onDismissMarketsOnboarding: () -> Unit,
|
||||
)
|
||||
|
|
@ -34,6 +34,7 @@ internal class InitializeWalletsTransformer(
|
|||
}
|
||||
.toImmutableList(),
|
||||
onWalletChange = clickIntents::onWalletChange,
|
||||
onDismissMarketsOnboarding = clickIntents::onDismissMarketsOnboarding,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,7 @@ import androidx.lifecycle.viewModelScope
|
|||
import arrow.core.getOrElse
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
|
||||
import com.tangem.domain.settings.CanUseBiometryUseCase
|
||||
import com.tangem.domain.settings.IsWalletsScrollPreviewEnabled
|
||||
import com.tangem.domain.settings.ShouldAskPermissionUseCase
|
||||
import com.tangem.domain.settings.ShouldShowSaveWalletScreenUseCase
|
||||
import com.tangem.domain.settings.*
|
||||
import com.tangem.domain.tokens.RefreshMultiCurrencyWalletQuotesUseCase
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase
|
||||
|
|
@ -30,6 +27,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.transformers.*
|
|||
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
|
||||
import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvider
|
||||
import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletClickIntents
|
||||
import com.tangem.features.markets.MarketsFeatureToggles
|
||||
import com.tangem.features.pushnotifications.api.featuretoggles.PushNotificationsFeatureToggles
|
||||
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
|
||||
import com.tangem.features.pushnotifications.api.utils.getPushPermissionOrNull
|
||||
|
|
@ -58,6 +56,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
private val getSelectedWalletUseCase: GetSelectedWalletUseCase,
|
||||
private val getWalletsUseCase: GetWalletsUseCase,
|
||||
private val shouldShowSaveWalletScreenUseCase: ShouldShowSaveWalletScreenUseCase,
|
||||
private val shouldShowMarketsTooltipUseCase: ShouldShowMarketsTooltipUseCase,
|
||||
private val canUseBiometryUseCase: CanUseBiometryUseCase,
|
||||
private val isWalletsScrollPreviewEnabled: IsWalletsScrollPreviewEnabled,
|
||||
private val getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase,
|
||||
|
|
@ -69,6 +68,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
private val refreshMultiCurrencyWalletQuotesUseCase: RefreshMultiCurrencyWalletQuotesUseCase,
|
||||
private val shouldAskPermissionUseCase: ShouldAskPermissionUseCase,
|
||||
private val pushNotificationsFeatureToggles: PushNotificationsFeatureToggles,
|
||||
private val marketsFeatureToggles: MarketsFeatureToggles,
|
||||
analyticsEventsHandler: AnalyticsEventHandler,
|
||||
) : ViewModel() {
|
||||
|
||||
|
|
@ -83,6 +83,7 @@ internal class WalletViewModel @Inject constructor(
|
|||
analyticsEventsHandler.send(WalletScreenAnalyticsEvent.MainScreen.ScreenOpened)
|
||||
|
||||
suggestToEnableBiometrics()
|
||||
suggestToOpenMarkets()
|
||||
|
||||
maybeMigrateNames()
|
||||
subscribeToUserWalletsUpdates()
|
||||
|
|
@ -121,6 +122,20 @@ internal class WalletViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun suggestToOpenMarkets() {
|
||||
viewModelScope.launch {
|
||||
withContext(dispatchers.io) { delay(timeMillis = 1_800) }
|
||||
|
||||
if (marketsFeatureToggles.isFeatureEnabled && shouldShowMarketsTooltipUseCase()) {
|
||||
stateHolder.update {
|
||||
it.copy(showMarketsOnboarding = true)
|
||||
}
|
||||
}
|
||||
|
||||
shouldShowMarketsTooltipUseCase(isShown = true)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun isShowSaveWalletScreenEnabled(): Boolean {
|
||||
return router.isWalletLastScreen() && shouldShowSaveWalletScreenUseCase() && canUseBiometryUseCase()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ 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.settings.ShouldShowMarketsTooltipUseCase
|
||||
import com.tangem.domain.tokens.GetCryptoCurrencyActionsUseCase
|
||||
import com.tangem.domain.tokens.GetPrimaryCurrencyStatusUpdatesUseCase
|
||||
import com.tangem.domain.tokens.TokensAction
|
||||
|
|
@ -35,6 +36,8 @@ internal interface WalletContentClickIntents {
|
|||
|
||||
fun onOrganizeTokensClick()
|
||||
|
||||
fun onDismissMarketsOnboarding()
|
||||
|
||||
fun onTokenItemClick(currencyStatus: CryptoCurrencyStatus)
|
||||
|
||||
fun onTokenItemLongClick(cryptoCurrencyStatus: CryptoCurrencyStatus)
|
||||
|
|
@ -52,6 +55,7 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
|||
private val getPrimaryCurrencyStatusUpdatesUseCase: GetPrimaryCurrencyStatusUpdatesUseCase,
|
||||
private val getCryptoCurrencyActionsUseCase: GetCryptoCurrencyActionsUseCase,
|
||||
private val getExplorerTransactionUrlUseCase: GetExplorerTransactionUrlUseCase,
|
||||
private val shouldShowMarketsTooltipUseCase: ShouldShowMarketsTooltipUseCase,
|
||||
private val analyticsEventHandler: AnalyticsEventHandler,
|
||||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
private val reduxStateHolder: ReduxStateHolder,
|
||||
|
|
@ -98,6 +102,13 @@ internal class WalletContentClickIntentsImplementor @Inject constructor(
|
|||
router.openOrganizeTokensScreen(userWalletId = stateHolder.getSelectedWalletId())
|
||||
}
|
||||
|
||||
override fun onDismissMarketsOnboarding() {
|
||||
stateHolder.update { it.copy(showMarketsOnboarding = false) }
|
||||
viewModelScope.launch {
|
||||
shouldShowMarketsTooltipUseCase(isShown = true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTokenItemClick(currencyStatus: CryptoCurrencyStatus) {
|
||||
analyticsEventHandler.send(PortfolioEvent.TokenTapped)
|
||||
router.openTokenDetails(stateHolder.getSelectedWalletId(), currencyStatus)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue