Updated on 2026-08-14
This commit is contained in:
parent
bf9dbc3535
commit
5c8e3cc3d3
5 changed files with 6 additions and 31 deletions
|
|
@ -38,7 +38,6 @@ import com.tangem.tap.domain.tasks.product.CreateProductWalletTaskResponse
|
|||
import com.tangem.tap.domain.tasks.product.ResetToFactorySettingsTask
|
||||
import com.tangem.tap.domain.tasks.product.ScanProductTask
|
||||
import com.tangem.tap.domain.tokens.UserTokensRepository
|
||||
import com.tangem.tap.domain.userWalletList.di.USER_WALLETS_BIOMETRIC_KEY_NAME
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.isActive
|
||||
|
|
@ -119,16 +118,6 @@ class TangemSdkManager(private val tangemSdk: TangemSdk, private val context: Co
|
|||
.map { CardDTO(it) }
|
||||
}
|
||||
|
||||
suspend fun unlockBiometricKeys(): CompletionResult<Unit> {
|
||||
return biometricManager.authenticate(
|
||||
mode = BiometricManager.AuthenticationMode.Keys(
|
||||
USER_WALLETS_BIOMETRIC_KEY_NAME,
|
||||
tangemSdk.config.userCodesBiometricKeyName,
|
||||
),
|
||||
)
|
||||
.map { /* no-op */ }
|
||||
}
|
||||
|
||||
suspend fun saveAccessCode(accessCode: String, cardsIds: Set<String>): CompletionResult<Unit> {
|
||||
return createUserCodeRepository().save(
|
||||
cardIds = cardsIds,
|
||||
|
|
@ -137,20 +126,10 @@ class TangemSdkManager(private val tangemSdk: TangemSdk, private val context: Co
|
|||
stringValue = accessCode,
|
||||
),
|
||||
)
|
||||
.map {
|
||||
biometricManager.unauthenticate(
|
||||
keyName = tangemSdk.config.userCodesBiometricKeyName,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun clearSavedUserCodes(): CompletionResult<Unit> {
|
||||
return createUserCodeRepository().clear()
|
||||
.map {
|
||||
biometricManager.unauthenticate(
|
||||
keyName = tangemSdk.config.userCodesBiometricKeyName,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun setPasscode(cardId: String?): CompletionResult<SuccessResponse> {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class CreateProductWalletTask(
|
|||
private val type: ProductType,
|
||||
) : CardSessionRunnable<CreateProductWalletTaskResponse> {
|
||||
|
||||
override val allowsAccessCodeFromRepository: Boolean = false
|
||||
override val allowsRequestAccessCodeFromRepository: Boolean = false
|
||||
|
||||
override fun run(
|
||||
session: CardSession,
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ScanProductTask(
|
|||
private val additionalBlockchainsToDerive: Collection<Blockchain>? = null,
|
||||
) : CardSessionRunnable<ScanResponse> {
|
||||
|
||||
override val allowsAccessCodeFromRepository: Boolean
|
||||
override val allowsRequestAccessCodeFromRepository: Boolean
|
||||
get() = !additionalBlockchainsToDerive.isNullOrEmpty()
|
||||
|
||||
override fun run(
|
||||
|
|
|
|||
|
|
@ -234,7 +234,6 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
|||
|
||||
when (action) {
|
||||
is BackupAction.StartBackup -> {
|
||||
tangemSdkManager.setAccessCodeRequestPolicy(useBiometricsForAccessCode = false)
|
||||
Analytics.send(Onboarding.Backup.Started())
|
||||
backupService.discardSavedBackup()
|
||||
val primaryCard = scanResponse?.primaryCard
|
||||
|
|
|
|||
|
|
@ -138,13 +138,10 @@ internal class SaveWalletMiddleware {
|
|||
): CompletionResult<Unit> {
|
||||
return when {
|
||||
accessCode != null -> {
|
||||
tangemSdkManager.unlockBiometricKeys()
|
||||
.flatMap {
|
||||
tangemSdkManager.saveAccessCode(
|
||||
accessCode = accessCode,
|
||||
cardsIds = cardsInWallet,
|
||||
)
|
||||
}
|
||||
tangemSdkManager.saveAccessCode(
|
||||
accessCode = accessCode,
|
||||
cardsIds = cardsInWallet,
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
CompletionResult.Success(Unit)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue