Updated on 2026-08-14
This commit is contained in:
parent
86450e506d
commit
28221ee04c
14 changed files with 34 additions and 28 deletions
|
|
@ -105,7 +105,7 @@ internal class CardSettingsModel @Inject constructor(
|
||||||
|
|
||||||
private fun scanCard() = modelScope.launch {
|
private fun scanCard() = modelScope.launch {
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = com.tangem.core.analytics.models.AnalyticsParam.ScreensSources.Settings,
|
analyticsSource = com.tangem.core.analytics.models.AnalyticsParam.ScreensSources.CardSettings,
|
||||||
shouldCheckIsAlreadyActivated = false,
|
shouldCheckIsAlreadyActivated = false,
|
||||||
allowsRequestAccessCodeFromRepository = true,
|
allowsRequestAccessCodeFromRepository = true,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ internal class ChildFactory @Inject constructor(
|
||||||
is AppRoute.CreateHardwareWallet -> {
|
is AppRoute.CreateHardwareWallet -> {
|
||||||
createComponentChild(
|
createComponentChild(
|
||||||
context = context,
|
context = context,
|
||||||
params = Unit,
|
params = CreateHardwareWalletComponent.Params(source = route.source),
|
||||||
componentFactory = createHardwareWalletComponentFactory,
|
componentFactory = createHardwareWalletComponentFactory,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,9 @@ sealed class AppRoute(val path: String) : Route {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object CreateHardwareWallet : AppRoute(path = "/create_hardware_wallet")
|
data class CreateHardwareWallet(
|
||||||
|
val source: AnalyticsParam.ScreensSources,
|
||||||
|
) : AppRoute(path = "/create_hardware_wallet")
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CreateMobileWallet(
|
data class CreateMobileWallet(
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ sealed class AnalyticsParam {
|
||||||
@Serializable
|
@Serializable
|
||||||
enum class ScreensSources(val value: String) {
|
enum class ScreensSources(val value: String) {
|
||||||
Settings("Settings"),
|
Settings("Settings"),
|
||||||
|
CardSettings("Card Settings"),
|
||||||
Main("Main"),
|
Main("Main"),
|
||||||
SignIn("Sign In"),
|
SignIn("Sign In"),
|
||||||
Send("Send"),
|
Send("Send"),
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ internal class CreateWalletSelectionModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onHardwareWalletClick() {
|
private fun onHardwareWalletClick() {
|
||||||
router.push(AppRoute.CreateHardwareWallet)
|
router.push(AppRoute.CreateHardwareWallet(source = AnalyticsParam.ScreensSources.AddNew))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onBuyClick() {
|
private fun onBuyClick() {
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ internal class CreateWalletStartModel @Inject constructor(
|
||||||
isBiometricsRequestPolicy = shouldSaveAccessCodes,
|
isBiometricsRequestPolicy = shouldSaveAccessCodes,
|
||||||
)
|
)
|
||||||
|
|
||||||
val analyticsSource = AnalyticsParam.ScreensSources.Intro
|
val analyticsSource = AnalyticsParam.ScreensSources.CreateWalletIntro
|
||||||
|
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = analyticsSource,
|
analyticsSource = analyticsSource,
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ internal class CreateWalletStartModelTest {
|
||||||
}
|
}
|
||||||
coVerify {
|
coVerify {
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = AnalyticsParam.ScreensSources.Intro,
|
analyticsSource = AnalyticsParam.ScreensSources.CreateWalletIntro,
|
||||||
shouldCheckIsAlreadyActivated = true,
|
shouldCheckIsAlreadyActivated = true,
|
||||||
cardId = null,
|
cardId = null,
|
||||||
onProgressStateChange = any(),
|
onProgressStateChange = any(),
|
||||||
|
|
@ -141,7 +141,7 @@ internal class CreateWalletStartModelTest {
|
||||||
}
|
}
|
||||||
coVerify {
|
coVerify {
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = AnalyticsParam.ScreensSources.Intro,
|
analyticsSource = AnalyticsParam.ScreensSources.CreateWalletIntro,
|
||||||
shouldCheckIsAlreadyActivated = true,
|
shouldCheckIsAlreadyActivated = true,
|
||||||
cardId = null,
|
cardId = null,
|
||||||
onProgressStateChange = any(),
|
onProgressStateChange = any(),
|
||||||
|
|
@ -258,7 +258,7 @@ internal class CreateWalletStartModelTest {
|
||||||
verify { cardSdkConfigRepository.setAccessCodeRequestPolicy(isBiometricsRequestPolicy = true) }
|
verify { cardSdkConfigRepository.setAccessCodeRequestPolicy(isBiometricsRequestPolicy = true) }
|
||||||
coVerify {
|
coVerify {
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = AnalyticsParam.ScreensSources.Intro,
|
analyticsSource = AnalyticsParam.ScreensSources.CreateWalletIntro,
|
||||||
shouldCheckIsAlreadyActivated = true,
|
shouldCheckIsAlreadyActivated = true,
|
||||||
cardId = null,
|
cardId = null,
|
||||||
onProgressStateChange = any(),
|
onProgressStateChange = any(),
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,6 @@ internal class HomeModel @Inject constructor(
|
||||||
HomeUM(
|
HomeUM(
|
||||||
scanInProgress = false,
|
scanInProgress = false,
|
||||||
stories = getRestrictedStories().toImmutableList(),
|
stories = getRestrictedStories().toImmutableList(),
|
||||||
onScanClick = ::onScanClick,
|
|
||||||
onShopClick = ::onShopClick,
|
onShopClick = ::onShopClick,
|
||||||
onSearchTokensClick = ::onSearchTokensClick,
|
onSearchTokensClick = ::onSearchTokensClick,
|
||||||
onGetStartedClick = ::onGetStartedClick,
|
onGetStartedClick = ::onGetStartedClick,
|
||||||
|
|
@ -121,11 +120,6 @@ internal class HomeModel @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onScanClick() {
|
|
||||||
analyticsEventHandler.send(IntroductionProcess.ButtonScanCardLegacy())
|
|
||||||
scanCard()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onShopClick() {
|
private fun onShopClick() {
|
||||||
analyticsEventHandler.send(IntroductionProcess.ButtonBuyCards())
|
analyticsEventHandler.send(IntroductionProcess.ButtonBuyCards())
|
||||||
analyticsEventHandler.send(Shop.ScreenOpened())
|
analyticsEventHandler.send(Shop.ScreenOpened())
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import kotlinx.collections.immutable.ImmutableList
|
||||||
data class HomeUM(
|
data class HomeUM(
|
||||||
val scanInProgress: Boolean,
|
val scanInProgress: Boolean,
|
||||||
val stories: ImmutableList<Stories>,
|
val stories: ImmutableList<Stories>,
|
||||||
val onScanClick: () -> Unit,
|
|
||||||
val onShopClick: () -> Unit,
|
val onShopClick: () -> Unit,
|
||||||
val onSearchTokensClick: () -> Unit,
|
val onSearchTokensClick: () -> Unit,
|
||||||
val onGetStartedClick: () -> Unit,
|
val onGetStartedClick: () -> Unit,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
package com.tangem.features.hotwallet
|
package com.tangem.features.hotwallet
|
||||||
|
|
||||||
|
import com.tangem.core.analytics.models.AnalyticsParam
|
||||||
import com.tangem.core.decompose.factory.ComponentFactory
|
import com.tangem.core.decompose.factory.ComponentFactory
|
||||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||||
|
|
||||||
interface CreateHardwareWalletComponent : ComposableContentComponent {
|
interface CreateHardwareWalletComponent : ComposableContentComponent {
|
||||||
|
|
||||||
interface Factory : ComponentFactory<Unit, CreateHardwareWalletComponent>
|
data class Params(
|
||||||
|
val source: AnalyticsParam.ScreensSources,
|
||||||
|
)
|
||||||
|
|
||||||
|
interface Factory : ComponentFactory<Params, CreateHardwareWalletComponent>
|
||||||
}
|
}
|
||||||
|
|
@ -4,11 +4,11 @@ import com.tangem.common.core.TangemError
|
||||||
import com.tangem.common.core.TangemSdkError
|
import com.tangem.common.core.TangemSdkError
|
||||||
import com.tangem.common.routing.AppRoute
|
import com.tangem.common.routing.AppRoute
|
||||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||||
import com.tangem.core.analytics.models.AnalyticsParam
|
|
||||||
import com.tangem.core.analytics.models.Basic
|
import com.tangem.core.analytics.models.Basic
|
||||||
import com.tangem.core.analytics.utils.TrackingContextProxy
|
import com.tangem.core.analytics.utils.TrackingContextProxy
|
||||||
import com.tangem.core.decompose.di.ModelScoped
|
import com.tangem.core.decompose.di.ModelScoped
|
||||||
import com.tangem.core.decompose.model.Model
|
import com.tangem.core.decompose.model.Model
|
||||||
|
import com.tangem.core.decompose.model.ParamsContainer
|
||||||
import com.tangem.core.decompose.navigation.Router
|
import com.tangem.core.decompose.navigation.Router
|
||||||
import com.tangem.core.decompose.ui.UiMessageSender
|
import com.tangem.core.decompose.ui.UiMessageSender
|
||||||
import com.tangem.core.navigation.url.UrlOpener
|
import com.tangem.core.navigation.url.UrlOpener
|
||||||
|
|
@ -27,6 +27,7 @@ import com.tangem.domain.wallets.analytics.WalletSettingsAnalyticEvents
|
||||||
import com.tangem.domain.wallets.builder.ColdUserWalletBuilder
|
import com.tangem.domain.wallets.builder.ColdUserWalletBuilder
|
||||||
import com.tangem.domain.wallets.usecase.GenerateBuyTangemCardLinkUseCase
|
import com.tangem.domain.wallets.usecase.GenerateBuyTangemCardLinkUseCase
|
||||||
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
|
||||||
|
import com.tangem.features.hotwallet.CreateHardwareWalletComponent
|
||||||
import com.tangem.features.hotwallet.createhardwarewallet.entity.CreateHardwareWalletUM
|
import com.tangem.features.hotwallet.createhardwarewallet.entity.CreateHardwareWalletUM
|
||||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||||
import com.tangem.utils.logging.TangemLogger
|
import com.tangem.utils.logging.TangemLogger
|
||||||
|
|
@ -42,6 +43,7 @@ private const val HIDE_PROGRESS_DELAY = 400L
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
@ModelScoped
|
@ModelScoped
|
||||||
internal class CreateHardwareWalletModel @Inject constructor(
|
internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
|
paramsContainer: ParamsContainer,
|
||||||
override val dispatchers: CoroutineDispatcherProvider,
|
override val dispatchers: CoroutineDispatcherProvider,
|
||||||
private val router: Router,
|
private val router: Router,
|
||||||
private val generateBuyTangemCardLinkUseCase: GenerateBuyTangemCardLinkUseCase,
|
private val generateBuyTangemCardLinkUseCase: GenerateBuyTangemCardLinkUseCase,
|
||||||
|
|
@ -57,6 +59,8 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
private val analyticsEventHandler: AnalyticsEventHandler,
|
private val analyticsEventHandler: AnalyticsEventHandler,
|
||||||
) : Model() {
|
) : Model() {
|
||||||
|
|
||||||
|
private val params = paramsContainer.require<CreateHardwareWalletComponent.Params>()
|
||||||
|
|
||||||
val uiState: StateFlow<CreateHardwareWalletUM>
|
val uiState: StateFlow<CreateHardwareWalletUM>
|
||||||
field = MutableStateFlow(
|
field = MutableStateFlow(
|
||||||
CreateHardwareWalletUM(
|
CreateHardwareWalletUM(
|
||||||
|
|
@ -77,7 +81,7 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onBuyTangemWalletClick() {
|
private fun onBuyTangemWalletClick() {
|
||||||
analyticsEventHandler.send(Basic.ButtonBuy(source = AnalyticsParam.ScreensSources.CreateWallet))
|
analyticsEventHandler.send(Basic.ButtonBuy(source = params.source))
|
||||||
modelScope.launch {
|
modelScope.launch {
|
||||||
generateBuyTangemCardLinkUseCase
|
generateBuyTangemCardLinkUseCase
|
||||||
.invoke(GenerateBuyTangemCardLinkUseCase.Source.Upgrade).let { urlOpener.openUrl(it) }
|
.invoke(GenerateBuyTangemCardLinkUseCase.Source.Upgrade).let { urlOpener.openUrl(it) }
|
||||||
|
|
@ -86,7 +90,7 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
|
|
||||||
private fun onScanDeviceClick() {
|
private fun onScanDeviceClick() {
|
||||||
analyticsEventHandler.send(
|
analyticsEventHandler.send(
|
||||||
event = IntroductionProcess.ButtonScanCard(AnalyticsParam.ScreensSources.CreateWallet),
|
event = IntroductionProcess.ButtonScanCard(params.source),
|
||||||
)
|
)
|
||||||
scanCard()
|
scanCard()
|
||||||
}
|
}
|
||||||
|
|
@ -100,10 +104,8 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
isBiometricsRequestPolicy = shouldSaveAccessCodes,
|
isBiometricsRequestPolicy = shouldSaveAccessCodes,
|
||||||
)
|
)
|
||||||
|
|
||||||
val analyticsSource = AnalyticsParam.ScreensSources.Intro
|
|
||||||
|
|
||||||
scanCardProcessor.scan(
|
scanCardProcessor.scan(
|
||||||
analyticsSource = analyticsSource,
|
analyticsSource = params.source,
|
||||||
shouldCheckIsAlreadyActivated = true,
|
shouldCheckIsAlreadyActivated = true,
|
||||||
onProgressStateChange = { showProgress ->
|
onProgressStateChange = { showProgress ->
|
||||||
if (!showProgress) {
|
if (!showProgress) {
|
||||||
|
|
@ -136,7 +138,7 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
|
|
||||||
saveWalletUseCase(
|
saveWalletUseCase(
|
||||||
userWallet = userWallet,
|
userWallet = userWallet,
|
||||||
analyticsSource = AnalyticsParam.ScreensSources.AddNew,
|
analyticsSource = params.source,
|
||||||
).fold(
|
).fold(
|
||||||
ifLeft = { saveWalletError ->
|
ifLeft = { saveWalletError ->
|
||||||
delay(HIDE_PROGRESS_DELAY)
|
delay(HIDE_PROGRESS_DELAY)
|
||||||
|
|
@ -183,7 +185,7 @@ internal class CreateHardwareWalletModel @Inject constructor(
|
||||||
userWalletId = walletId,
|
userWalletId = walletId,
|
||||||
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
|
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(
|
||||||
scanResponse = scanResponse,
|
scanResponse = scanResponse,
|
||||||
source = AnalyticsParam.ScreensSources.AddNew,
|
source = params.source,
|
||||||
),
|
),
|
||||||
).onRight {
|
).onRight {
|
||||||
router.replaceAll(AppRoute.Wallet)
|
router.replaceAll(AppRoute.Wallet)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import dagger.assisted.AssistedInject
|
||||||
@Suppress("UnusedPrivateMember")
|
@Suppress("UnusedPrivateMember")
|
||||||
internal class DefaultCreateHardwareWalletComponent @AssistedInject constructor(
|
internal class DefaultCreateHardwareWalletComponent @AssistedInject constructor(
|
||||||
@Assisted private val context: AppComponentContext,
|
@Assisted private val context: AppComponentContext,
|
||||||
@Assisted private val params: Unit,
|
@Assisted private val params: CreateHardwareWalletComponent.Params,
|
||||||
) : CreateHardwareWalletComponent, AppComponentContext by context {
|
) : CreateHardwareWalletComponent, AppComponentContext by context {
|
||||||
|
|
||||||
private val model: CreateHardwareWalletModel = getOrCreateModel(params)
|
private val model: CreateHardwareWalletModel = getOrCreateModel(params)
|
||||||
|
|
@ -31,6 +31,9 @@ internal class DefaultCreateHardwareWalletComponent @AssistedInject constructor(
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory : CreateHardwareWalletComponent.Factory {
|
interface Factory : CreateHardwareWalletComponent.Factory {
|
||||||
override fun create(context: AppComponentContext, params: Unit): DefaultCreateHardwareWalletComponent
|
override fun create(
|
||||||
|
context: AppComponentContext,
|
||||||
|
params: CreateHardwareWalletComponent.Params,
|
||||||
|
): DefaultCreateHardwareWalletComponent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +117,7 @@ internal class UpgradeWalletModel @Inject constructor(
|
||||||
tangemSdkManager
|
tangemSdkManager
|
||||||
.scanProduct(
|
.scanProduct(
|
||||||
shouldCheckIsAlreadyActivated = true,
|
shouldCheckIsAlreadyActivated = true,
|
||||||
source = AnalyticsParam.ScreensSources.Upgrade,
|
source = AnalyticsParam.ScreensSources.CreateWallet,
|
||||||
)
|
)
|
||||||
.doOnSuccess { scanResponse ->
|
.doOnSuccess { scanResponse ->
|
||||||
checkIsWalletSuitableToBeUsedAsUpgrade(scanResponse = scanResponse) {
|
checkIsWalletSuitableToBeUsedAsUpgrade(scanResponse = scanResponse) {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ internal class WalletHardwareBackupModel @Inject constructor(
|
||||||
|
|
||||||
private fun onCreateNewWalletClick() {
|
private fun onCreateNewWalletClick() {
|
||||||
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ButtonCreateNewWallet())
|
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ButtonCreateNewWallet())
|
||||||
router.push(AppRoute.CreateHardwareWallet)
|
router.push(AppRoute.CreateHardwareWallet(source = AnalyticsParam.ScreensSources.CreateWallet))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onUpgradeCurrentWalletClick() {
|
private fun onUpgradeCurrentWalletClick() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue