Updated on 2026-08-14
This commit is contained in:
parent
e156c41369
commit
2176c243e0
12 changed files with 33 additions and 17 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ internal class DefaultCardSdkConfigRepository(
|
|||
ProductType.Note,
|
||||
ProductType.Wallet,
|
||||
ProductType.Start2Coin,
|
||||
ProductType.Wallet2,
|
||||
-> CardIdDisplayFormat.Full
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ fun Blockchain.toCoinId(): String {
|
|||
Blockchain.Dash -> "dash"
|
||||
Blockchain.Kaspa -> "kaspa"
|
||||
Blockchain.TON, Blockchain.TONTestnet -> "the-open-network"
|
||||
Blockchain.Unknown -> "unknown"
|
||||
Blockchain.Kava, Blockchain.KavaTestnet -> "kava"
|
||||
Blockchain.Ravencoin, Blockchain.RavencoinTestnet -> "ravencoin"
|
||||
Blockchain.Cosmos, Blockchain.CosmosTestnet -> "cosmos"
|
||||
|
|
@ -189,10 +188,10 @@ fun Blockchain.toCoinId(): String {
|
|||
Blockchain.Telos, Blockchain.TelosTestnet -> "telos"
|
||||
Blockchain.AlephZero, Blockchain.AlephZeroTestnet -> "aleph-zero"
|
||||
Blockchain.OctaSpace, Blockchain.OctaSpaceTestnet -> "octaspace"
|
||||
Blockchain.Chia -> "chia"
|
||||
Blockchain.ChiaTestnet -> "chia/test"
|
||||
Blockchain.Chia, Blockchain.ChiaTestnet -> "chia"
|
||||
Blockchain.Near -> "near"
|
||||
Blockchain.NearTestnet -> "near/test"
|
||||
Blockchain.Unknown -> "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class UserWalletBuilder(
|
|||
cardTypesResolver.isStart2Coin() -> "Start2Coin"
|
||||
else -> "Wallet"
|
||||
}
|
||||
ProductType.Wallet2 -> "Wallet"
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class UserWalletIdBuilder private constructor(
|
|||
ProductType.Twins -> scanResponse.secondTwinPublicKey?.hexToBytes()
|
||||
ProductType.Note,
|
||||
ProductType.Wallet,
|
||||
ProductType.Wallet2,
|
||||
ProductType.Start2Coin,
|
||||
-> null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,5 +21,5 @@ data class ScanResponse(
|
|||
typealias KeyWalletPublicKey = ByteArrayKey
|
||||
|
||||
enum class ProductType {
|
||||
Note, Twins, Wallet, Start2Coin
|
||||
Note, Twins, Wallet, Start2Coin, Wallet2
|
||||
}
|
||||
|
|
@ -156,6 +156,7 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
),
|
||||
suggestedPhraseClick = ::buttonSuggestedPhraseClick,
|
||||
buttonCreateWalletClick = {
|
||||
analyticsEventHandler.send(SeedPhraseEvents.ButtonImport)
|
||||
buttonImportWalletClick(importedMnemonicComponents, SeedPhraseSource.IMPORTED)
|
||||
},
|
||||
),
|
||||
|
|
@ -165,7 +166,7 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
|
||||
// region CheckSeedPhrase
|
||||
private fun onTextFieldChanged(field: SeedPhraseField, textFieldValue: TextFieldValue) {
|
||||
viewModelScope.launchSingle {
|
||||
launchSingle {
|
||||
updateUi { uiBuilder.checkSeedPhrase.updateTextField(uiState, field, textFieldValue) }
|
||||
|
||||
val fieldState = field.getState(uiState)
|
||||
|
|
@ -278,7 +279,6 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun buttonImportWalletClick(mnemonicComponents: List<String>?, seedPhraseSource: SeedPhraseSource) {
|
||||
analyticsEventHandler.send(SeedPhraseEvents.ButtonImport)
|
||||
mnemonicComponents ?: return
|
||||
|
||||
viewModelScope.launch(dispatchers.io) {
|
||||
|
|
@ -325,7 +325,7 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
|
||||
private fun buttonGenerateSeedPhraseClick() {
|
||||
analyticsEventHandler.send(SeedPhraseEvents.ButtonGenerateSeedPhrase)
|
||||
viewModelScope.launchSingle {
|
||||
launchSingle {
|
||||
updateUi { uiBuilder.generateMnemonicComponents(uiState) }
|
||||
delay(DELAY_GENERATE_SEED_PHRASE)
|
||||
interactor.generateMnemonic()
|
||||
|
|
@ -380,7 +380,7 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private fun buttonSuggestedPhraseClick(suggestionIndex: Int) {
|
||||
viewModelScope.launchSingle {
|
||||
launchSingle {
|
||||
val textFieldValue = uiState.importSeedPhraseState.tvSeedPhrase.textFieldValue
|
||||
val word = uiState.importSeedPhraseState.suggestionsList[suggestionIndex]
|
||||
val cursorPosition = textFieldValue.selection.end
|
||||
|
|
@ -420,7 +420,7 @@ class SeedPhraseViewModel @Inject constructor(
|
|||
SeedPhraseField.Eleventh -> uiState.checkSeedPhraseState.tvEleventhPhrase
|
||||
}
|
||||
|
||||
private fun CoroutineScope.launchSingle(block: suspend CoroutineScope.() -> Unit): Job {
|
||||
private fun launchSingle(block: suspend CoroutineScope.() -> Unit): Job {
|
||||
return viewModelScope.launch(dispatchers.single, block = block)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue