Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-12 18:09:04 +08:00
parent e156c41369
commit 2176c243e0
12 changed files with 33 additions and 17 deletions

View file

@ -133,9 +133,9 @@ sealed class AnalyticsParam {
}
sealed class WalletCreationType(val value: String) {
object PrivateKey : WalletCreationType("Private key")
object NewSeed : WalletCreationType("New seed")
object SeedImport : WalletCreationType("Seed import")
object PrivateKey : WalletCreationType(value = "Private Key")
object NewSeed : WalletCreationType(value = "New Seed")
object SeedImport : WalletCreationType(value = "Seed Import")
}
companion object Key {
@ -152,7 +152,8 @@ sealed class AnalyticsParam {
const val ERROR_DESCRIPTION = "Error Description"
const val ERROR_CODE = "Error Code"
const val ERROR_KEY = "Error Key"
const val CREATION_TYPE = "Creation type"
const val CREATION_TYPE = "Creation Type"
const val SEED_PHRASE_LENGTH = "Seed Phrase Length"
const val DAPP_NAME = "DApp Name"
const val DAPP_URL = "DApp Url"
const val METHOD_NAME = "Method Name"

View file

@ -23,9 +23,14 @@ sealed class Onboarding(
class ButtonCreateWallet : CreateWallet("Button - Create Wallet")
class WalletCreatedSuccessfully(
creationType: AnalyticsParam.WalletCreationType = AnalyticsParam.WalletCreationType.PrivateKey,
seedPhraseLength: Int? = null,
) : CreateWallet(
event = "Wallet Created Successfully",
params = mapOf(AnalyticsParam.CREATION_TYPE to creationType.value),
params = buildMap {
put(AnalyticsParam.CREATION_TYPE, creationType.value)
if (seedPhraseLength != null) put(AnalyticsParam.SEED_PHRASE_LENGTH, seedPhraseLength.toString())
},
)
}

View file

@ -45,6 +45,7 @@ class CardContextInterceptor(
ProductType.Note -> "Note"
ProductType.Twins -> "Twin"
ProductType.Wallet -> "Wallet"
ProductType.Wallet2 -> "Wallet 2.0"
ProductType.Start2Coin -> "Start2Coin"
else -> if (DemoHelper.isDemoCard(scanResponse)) {
if (DemoHelper.isTestDemoCard(scanResponse)) {

View file

@ -209,7 +209,9 @@ private class ScanWalletProcessor(
session: CardSession,
callback: (result: CompletionResult<ScanResponse>) -> Unit,
) {
val productType = ProductType.Wallet
val isWallet2 = card.settings.isKeysImportAllowed || card.firmwareVersion >= FirmwareVersion.KeysImportAvailable
val productType = if (isWallet2) ProductType.Wallet2 else ProductType.Wallet
val config = CardConfig.createConfig(card)
scope.launch {
val scanResponse = ScanResponse(

View file

@ -53,7 +53,7 @@ object OnboardingHelper {
fun whereToNavigate(scanResponse: ScanResponse): AppScreen {
return when (scanResponse.productType) {
ProductType.Note -> AppScreen.OnboardingNote
ProductType.Wallet -> if (scanResponse.card.settings.isBackupAllowed) {
ProductType.Wallet, ProductType.Wallet2 -> if (scanResponse.card.settings.isBackupAllowed) {
AppScreen.OnboardingWallet
} else {
AppScreen.OnboardingOther

View file

@ -237,7 +237,12 @@ private fun handleWallet2Action(action: OnboardingWallet2Action) {
SeedPhraseSource.IMPORTED -> AnalyticsParam.WalletCreationType.SeedImport
SeedPhraseSource.GENERATED -> AnalyticsParam.WalletCreationType.NewSeed
}
Analytics.send(Onboarding.CreateWallet.WalletCreatedSuccessfully(creationType))
Analytics.send(
event = Onboarding.CreateWallet.WalletCreatedSuccessfully(
creationType = creationType,
seedPhraseLength = action.mnemonicComponents.size,
),
)
val response = CreateWalletResponse(
card = result.data.card,
derivedKeys = result.data.derivedKeys,