Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-14 14:23:17 +03:00
parent ebc4350919
commit 7e23a3a63b
18 changed files with 336 additions and 42 deletions

View file

@ -41,6 +41,7 @@ import com.tangem.domain.settings.IncrementAppLaunchCounterUseCase
import com.tangem.domain.settings.usercountry.FetchUserCountryUseCase
import com.tangem.domain.staking.FetchStakingTokensUseCase
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.requireColdWallet
import com.tangem.domain.wallets.usecase.AssociateWalletsWithApplicationIdUseCase
import com.tangem.domain.wallets.usecase.GetSavedWalletChangesUseCase
@ -200,7 +201,12 @@ internal class MainViewModel @Inject constructor(
userWalletsListManager.selectedUserWallet
.distinctUntilChanged()
.onEach { userWallet ->
Analytics.setContext(userWallet.requireColdWallet().scanResponse) // TODO [REDACTED_TASK_KEY]
when (userWallet) {
is UserWallet.Cold -> Analytics.setContext(userWallet.scanResponse)
is UserWallet.Hot -> {
// TODO [REDACTED_TASK_KEY]
}
}
}
.flowOn(dispatchers.io)
.launchIn(viewModelScope)

View file

@ -9,13 +9,23 @@ import com.tangem.domain.wallets.models.requireColdWallet
internal class DefaultAuthProvider(private val userWalletsListManager: UserWalletsListManager) : AuthProvider {
override fun getCardPublicKey(): String {
return userWalletsListManager.selectedUserWalletSync
?.requireColdWallet()?.scanResponse?.card?.cardPublicKey?.toHexString() ?: ""
val userWallet = userWalletsListManager.selectedUserWalletSync
return when (userWallet) {
is UserWallet.Cold -> userWallet.scanResponse.card.cardPublicKey.toHexString()
is UserWallet.Hot -> userWallet.wallets?.firstOrNull()?.publicKey?.toHexString() ?: ""
null -> ""
}
}
override fun getCardId(): String {
return userWalletsListManager.selectedUserWalletSync
?.requireColdWallet()?.scanResponse?.card?.cardId ?: ""
val userWallet = userWalletsListManager.selectedUserWalletSync
if (userWallet !is UserWallet.Cold) {
return ""
}
return userWallet.requireColdWallet().scanResponse.card.cardId
}
override fun getCardsPublicKeys(): Map<String, String> {