Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-04 14:46:26 +04:00
parent 3d5a8654a5
commit 67ca192c16
19 changed files with 90 additions and 52 deletions

View file

@ -227,7 +227,10 @@ internal class CreateWalletStartModel @Inject constructor(
is SaveWalletError.WalletAlreadySaved -> {
userWalletsListRepository.unlock(
userWalletId = userWallet.walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(scanResponse),
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
scanResponse = scanResponse,
source = AnalyticsParam.ScreensSources.Intro,
),
).onRight {
appRouter.replaceAll(AppRoute.Wallet)
}

View file

@ -421,7 +421,10 @@ internal class CreateWalletStartModelTest {
coVerify {
userWalletsListRepository.unlock(
userWalletId = testUserWalletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(testScanResponse),
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
scanResponse = testScanResponse,
source = AnalyticsParam.ScreensSources.Intro,
),
)
}
verify { appRouter.replaceAll(routes = arrayOf(AppRoute.Wallet), onComplete = any()) }

View file

@ -13,22 +13,22 @@ import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.settings.HotWalletRestrictionManager
import com.tangem.domain.wallets.analytics.WalletSettingsAnalyticEvents
import com.tangem.domain.wallets.usecase.ApplyUserWalletListSortingUseCase
import com.tangem.domain.wallets.usecase.UnlockWalletUseCase
import com.tangem.features.details.entity.UserWalletListUM
import com.tangem.features.details.entity.WalletReorderUM
import com.tangem.features.details.impl.R
import com.tangem.domain.settings.HotWalletRestrictionManager
import com.tangem.features.details.utils.UserWalletSaver
import com.tangem.features.wallet.utils.UserWalletsFetcher
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.logging.TangemLogger
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import com.tangem.utils.logging.TangemLogger
import javax.inject.Inject
@Suppress("LongParameterList")
@ -112,7 +112,7 @@ internal class UserWalletListModel @Inject constructor(
private fun onWalletClicked(userWalletId: UserWalletId) {
modelScope.launch {
unlockWalletUseCase(userWalletId)
unlockWalletUseCase(userWalletId, AnalyticsParam.ScreensSources.Settings)
.onRight { router.push(AppRoute.WalletSettings(userWalletId)) }
.onLeft { error ->
TangemLogger.e("Failed to unlock wallet $userWalletId: $error")

View file

@ -29,12 +29,12 @@ import com.tangem.domain.wallets.usecase.GenerateBuyTangemCardLinkUseCase
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
import com.tangem.features.hotwallet.createhardwarewallet.entity.CreateHardwareWalletUM
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import com.tangem.utils.logging.TangemLogger
import javax.inject.Inject
private const val HIDE_PROGRESS_DELAY = 400L
@ -181,7 +181,10 @@ internal class CreateHardwareWalletModel @Inject constructor(
)
userWalletsListRepository.unlock(
userWalletId = walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(scanResponse),
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
scanResponse = scanResponse,
source = AnalyticsParam.ScreensSources.AddNew,
),
).onRight {
router.replaceAll(AppRoute.Wallet)
}

View file

@ -115,7 +115,10 @@ internal class UpgradeWalletModel @Inject constructor(
)
tangemSdkManager
.scanProduct(shouldCheckIsAlreadyActivated = true)
.scanProduct(
shouldCheckIsAlreadyActivated = true,
source = AnalyticsParam.ScreensSources.Upgrade,
)
.doOnSuccess { scanResponse ->
checkIsWalletSuitableToBeUsedAsUpgrade(scanResponse = scanResponse) {
delay(DELAY_SDK_DIALOG_CLOSE)

View file

@ -1,7 +1,6 @@
package com.tangem.feature.wallet.child.wallet.model.intents
import arrow.core.getOrElse
import com.tangem.utils.logging.TangemLogger
import com.tangem.common.routing.AppRoute.*
import com.tangem.common.routing.AppRouter
import com.tangem.common.ui.notifications.NotificationId
@ -14,6 +13,7 @@ import com.tangem.core.decompose.di.ModelScoped
import com.tangem.core.decompose.ui.UiMessageSender
import com.tangem.core.navigation.review.ReviewManager
import com.tangem.core.navigation.url.UrlOpener
import com.tangem.domain.assetsdiscovery.usecase.AcknowledgeAssetsDiscoveryCompletionUseCase
import com.tangem.domain.card.SetCardWasScannedUseCase
import com.tangem.domain.common.wallets.UserWalletsListRepository
import com.tangem.domain.feedback.GetWalletMetaInfoUseCase
@ -41,16 +41,15 @@ import com.tangem.domain.tokens.model.analytics.PromoAnalyticsEvent
import com.tangem.domain.tokens.model.analytics.PromoAnalyticsEvent.Program
import com.tangem.domain.tokens.model.analytics.PromoAnalyticsEvent.PromotionBannerClicked
import com.tangem.domain.tokens.model.details.NavigationAction
import com.tangem.domain.assetsdiscovery.usecase.AcknowledgeAssetsDiscoveryCompletionUseCase
import com.tangem.domain.wallets.usecase.*
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent
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.state.WalletStateController
import com.tangem.feature.wallet.presentation.wallet.state.model.WalletEvent
import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender
import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnalyticEvents
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
@ -174,7 +173,6 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
}
override fun onGenerateMissedAddressesClick(missedAddressCurrencies: List<CryptoCurrency>) {
analyticsEventHandler.send(Basic.CardWasScanned(AnalyticsParam.ScreensSources.Main))
analyticsEventHandler.send(MainScreen.NoticeScanYourCardTapped())
modelScope.launch {
@ -199,7 +197,7 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
userWalletsListRepository.unlockAllWallets()
.onLeft {
val selectedUserWalletId = stateHolder.getSelectedWalletId()
nonBiometricUnlockWalletUseCase(selectedUserWalletId)
nonBiometricUnlockWalletUseCase(selectedUserWalletId, AnalyticsParam.ScreensSources.Main)
.onLeft { error ->
error.handle(
onAlreadyUnlocked = {},

View file

@ -208,8 +208,11 @@ internal class WelcomeModel @Inject constructor(
).onLeft { error ->
if (error is SaveWalletError.WalletAlreadySaved) {
userWalletsListRepository.unlock(
userWallet.walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(scanResponse),
userWalletId = userWallet.walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
scanResponse = scanResponse,
source = AnalyticsParam.ScreensSources.SignIn,
),
).onRight {
userWalletsListRepository.select(userWallet.walletId)
router.replaceAll(AppRoute.Wallet)
@ -274,7 +277,7 @@ internal class WelcomeModel @Inject constructor(
}
private suspend fun nonBiometricUnlockWallet(userWalletId: UserWalletId) {
nonBiometricUnlockWalletUseCase(userWalletId)
nonBiometricUnlockWalletUseCase(userWalletId, AnalyticsParam.ScreensSources.SignIn)
.onRight {
routedOut = true
userWalletsListRepository.select(userWalletId)