Updated on 2026-08-14

This commit is contained in:
Tangem 2023-01-18 18:05:18 +08:00
parent e98780ff93
commit 479d142807
283 changed files with 2338 additions and 2730 deletions

View file

@ -1,55 +0,0 @@
//package com.tangem.tap.domain.tasks
//
//import com.tangem.common.CompletionResult
//import com.tangem.common.core.CardSession
//import com.tangem.common.core.CardSessionRunnable
//import com.tangem.common.core.CompletionCallback
//import com.tangem.common.hdWallet.DerivationPath
//import com.tangem.common.hdWallet.ExtendedPublicKey
//import com.tangem.operations.CommandResponse
//import com.tangem.operations.derivation.DeriveWalletPublicKeysTask
//import com.tangem.tap.common.extensions.ByteArrayKey
//
//class ExtendedPublicKeyList(
// items: Collection<ExtendedPublicKey>
//): ArrayList<ExtendedPublicKey>(items), CommandResponse
//
//
//class DerivationTaskResponse(
// val entries: Map<ByteArrayKey, ExtendedPublicKeyList>
//): CommandResponse
//
//class DerivationTask(
// private val derivations: Map<ByteArrayKey, List<DerivationPath>>
//) : CardSessionRunnable<DerivationTaskResponse> {
//
// val response: MutableMap<ByteArrayKey, ExtendedPublicKeyList> = mutableMapOf()
//
// override fun run(session: CardSession, callback: CompletionCallback<DerivationTaskResponse>) {
// derive(keys = derivations.keys.toList(), index = 0, session = session, callback = callback)
// }
//
// private fun derive(
// keys: List<ByteArrayKey>,
// index: Int,
// session: CardSession,
// callback: CompletionCallback<DerivationTaskResponse>
// ) {
// if (index == keys.count()) {
// callback(CompletionResult.Success(DerivationTaskResponse(response.toMap())))
// return
// }
//
// val key = keys[index]
// val paths = derivations[key]!!
// DeriveWalletPublicKeysTask(key.bytes, paths).run(session) { result ->
// when (result) {
// is CompletionResult.Success -> {
// response[key] = result.data[key]
// derive(keys = keys, index = index + 1, session = session, callback = callback)
// }
// is CompletionResult.Failure -> callback(CompletionResult.Failure(result.error))
// }
// }
// }
//}

View file

@ -8,7 +8,7 @@ import com.tangem.common.extensions.guard
import com.tangem.operations.backup.ResetBackupCommand
import com.tangem.operations.wallet.PurgeWalletCommand
class ResetToFactorySettingsTask() : CardSessionRunnable<Card> {
class ResetToFactorySettingsTask : CardSessionRunnable<Card> {
override fun run(session: CardSession, callback: (result: CompletionResult<Card>) -> Unit) {
deleteWallets(session, callback)

View file

@ -170,7 +170,8 @@ private class ScanWalletProcessor(
) {
val activationInProgress = preferencesStorage.usedCardsPrefStorage.isActivationInProgress(card.cardId)
if ((card.backupStatus == CardDTO.BackupStatus.NoBackup && card.wallets.isNotEmpty())
@Suppress("ComplexCondition")
if (card.backupStatus == CardDTO.BackupStatus.NoBackup && card.wallets.isNotEmpty()
&& (activationInProgress || card.isSaltPay)
) {
StartPrimaryCardLinkingTask().run(session) { linkingResult ->
@ -266,7 +267,7 @@ private class ScanWalletProcessor(
}
if (additionalBlockchainsToDerive != null) {
blockchainsToDerive.addAll(
additionalBlockchainsToDerive.map { BlockchainNetwork(it, card) }
additionalBlockchainsToDerive.map { BlockchainNetwork(it, card) },
)
}
if (!card.useOldStyleDerivation) {
@ -307,6 +308,7 @@ private class ScanWalletProcessor(
}
}
@Suppress("MagicNumber")
private class ScanTwinProcessor : ProductCommandProcessor<ScanResponse> {
override fun proceed(
card: CardDTO,