Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-31 16:26:45 +04:00
parent 821c6b5697
commit 9a7cc4e717
4 changed files with 116 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package com.tangem.tap.features.main
import android.os.Build
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.tangem.blockchainsdk.BlockchainSDKFactory
@ -39,6 +40,7 @@ import com.tangem.domain.wallets.usecase.GetSavedWalletsCountUseCase
import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase
import com.tangem.domain.wallets.usecase.UpdateRemoteWalletsInfoUseCase
import com.tangem.feature.swap.analytics.StoriesEvents
import com.tangem.security.DeviceSecurityInfoProvider
import com.tangem.tap.network.exchangeServices.SellService
import com.tangem.tap.proxy.AppStateHolder
import com.tangem.tap.routing.configurator.AppRouterConfig
@ -83,6 +85,7 @@ internal class MainViewModel @Inject constructor(
private val getSelectedWalletUseCase: GetSelectedWalletUseCase,
private val appRouterConfig: AppRouterConfig,
private val sellService: SellService,
private val deviceSecurityInfoProvider: DeviceSecurityInfoProvider,
getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase,
) : ViewModel() {
@ -123,6 +126,7 @@ internal class MainViewModel @Inject constructor(
deleteDeprecatedLogsUseCase()
sendKeyboardIdentifierEvent()
sendMediaTekVulnerabilityEvent()
preloadImages()
}
@ -341,7 +345,6 @@ internal class MainViewModel @Inject constructor(
listenToFlipsUseCase.changeUpdateEnabled(isUpdateEnabled = true)
}
@Suppress("NullableToStringCall")
private fun sendKeyboardIdentifierEvent() {
viewModelScope.launch {
val keyboardId = keyboardValidator.getKeyboardId()
@ -364,6 +367,27 @@ internal class MainViewModel @Inject constructor(
}
}
private fun sendMediaTekVulnerabilityEvent() {
viewModelScope.launch(dispatchers.io) {
val isVulnerable = deviceSecurityInfoProvider.isVulnerableToMediaTekExploit
if (isVulnerable) {
analyticsEventHandler.send(
event = TechAnalyticsEvent.MediaTekVulnerability(
model = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) Build.SOC_MODEL else "unknown",
manufacturer = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
Build.SOC_MANUFACTURER
} else {
"unknown"
},
hardware = Build.HARDWARE,
patch = Build.VERSION.SECURITY_PATCH,
),
)
}
}
}
// Preload stories to display on startup before navigation to targeted screen
private fun preloadImages() {
try {