Updated on 2026-08-14

This commit is contained in:
Tangem 2021-11-11 12:07:25 +03:00
parent 560bf8c98d
commit 1bff5f5bd2
2 changed files with 10 additions and 2 deletions

View file

@ -6,12 +6,13 @@ import com.tangem.common.KeyPair
import com.tangem.common.card.EllipticCurve
import com.tangem.common.core.CardSession
import com.tangem.common.core.CardSessionRunnable
import com.tangem.common.core.TangemSdkError
import com.tangem.common.core.TangemError
import com.tangem.common.extensions.hexToBytes
import com.tangem.operations.wallet.CreateWalletCommand
import com.tangem.operations.wallet.CreateWalletResponse
import com.tangem.operations.wallet.PurgeWalletCommand
import com.tangem.tap.domain.extensions.getSingleWallet
import com.tangem.wallet.R
class CreateSecondTwinWalletTask(
private val firstPublicKey: String,
@ -25,7 +26,7 @@ class CreateSecondTwinWalletTask(
val publicKey = card?.getSingleWallet()?.publicKey
if (publicKey != null) {
if (!card.cardId.startsWith(TwinsHelper.getPairCardSeries(firstCardId) ?: "")) {
callback(CompletionResult.Failure(TangemSdkError.WrongCardType()))
callback(CompletionResult.Failure(WrongTwinCard()))
return
}
@ -65,4 +66,10 @@ class CreateSecondTwinWalletTask(
}
}
}
private class WrongTwinCard : TangemError {
override val code: Int = 50005
override var customMessage: String = code.toString()
override val messageResId = R.string.twins_wrong_card_error
}
}

View file

@ -29,6 +29,7 @@
<string name="twins_recreate_subtitle" translatable="false">The wallet creation procedure consists of three steps. You must complete it to the end, otherwise you will have to start from the beginning.</string>
<string name="twins_recreate_button_format" translatable="false">Tap the card #%s</string>
<string name="twins_recreate_alert" translatable="false">You have already started the process of recreating twin wallet. If you interrupt it, you won\'t be able to use your twin cards until you start it again and complete recreating the wallet.</string>
<string name="twins_wrong_card_error" translatable="false">You\'ve tapped the same card. To create twin wallet you need to tap a second twin card.</string>
<string name="notification_twins_recreate_success" translatable="false">The twin address was successfully created</string>