Updated on 2026-08-14

This commit is contained in:
Tangem 2020-12-18 16:14:16 +00:00
commit 25aafa0baf
6 changed files with 36 additions and 12 deletions

View file

@ -38,6 +38,14 @@ class TwinsHelper {
return cardIdWithoutChecksum + checkSum
}
fun getTwinCardIdForUser(cardId: String): String {
if (cardId.length < 16) return cardId
val twinCardId = cardId.substring(11..14)
val twinCardNumber = getTwinCardNumber(cardId)?.number ?: 1
return "$twinCardId #$twinCardNumber"
}
private val firstCardSeries = listOf("CB61", "CB64")
private val secondCardSeries = listOf("CB62", "CB65")
}
@ -72,7 +80,5 @@ fun Card.isTwinCard(): Boolean {
}
fun Card.getTwinCardIdForUser(): String {
val twinCardId = this.cardId.substring(11..14)
val twinCardNumber = TwinsHelper.getTwinCardNumber(this.cardId)?.number ?: 1
return "$twinCardId #$twinCardNumber"
return TwinsHelper.getTwinCardIdForUser(this.cardId)
}

View file

@ -40,6 +40,7 @@ data class TokenData(
class BalanceWidget(
val fragment: Fragment,
val data: BalanceWidgetData,
val isTwinCard: Boolean,
) {
fun setup() {
@ -100,8 +101,13 @@ class BalanceWidget(
BalanceStatus.EmptyCard -> {
fragment.l_balance.hide()
fragment.l_balance_error.show()
fragment.tv_error_title.text = fragment.getText(R.string.wallet_error_empty_card)
fragment.tv_error_descriptions.text = fragment.getText(R.string.wallet_error_empty_card_subtitle)
if (isTwinCard) {
fragment.tv_error_title.text = fragment.getText(R.string.wallet_error_empty_twin_card)
fragment.tv_error_descriptions.text = fragment.getText(R.string.wallet_error_empty_twin_card_subtitle)
} else {
fragment.tv_error_title.text = fragment.getText(R.string.wallet_error_empty_card)
fragment.tv_error_descriptions.text = fragment.getText(R.string.wallet_error_empty_card_subtitle)
}
}
BalanceStatus.NoAccount -> {
fragment.l_balance.hide()

View file

@ -132,7 +132,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
handleDialogs(state.walletDialog)
l_balance.show()
BalanceWidget(this, state.currencyData).setup()
BalanceWidget(this, state.currencyData, state.twinCardsState != null).setup()
if (state.state == ProgressState.Done) {
srl_wallet.isRefreshing = false
@ -203,7 +203,13 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
val buttonTitle = when (state.mainButton) {
is WalletMainButton.SendButton -> R.string.wallet_button_send
is WalletMainButton.CreateWalletButton -> R.string.wallet_button_create_wallet
is WalletMainButton.CreateWalletButton -> {
if (state.twinCardsState == null) {
R.string.wallet_button_create_wallet
} else {
R.string.wallet_button_create_twin_wallet
}
}
}
btnConfirm.text = getString(buttonTitle)
btnConfirm.isEnabled = state.mainButton.enabled

View file

@ -8,6 +8,7 @@ import androidx.transition.TransitionInflater
import com.squareup.picasso.Picasso
import com.tangem.tap.common.redux.navigation.AppScreen
import com.tangem.tap.common.redux.navigation.NavigationAction
import com.tangem.tap.domain.twins.TwinsHelper
import com.tangem.tap.features.wallet.redux.Artwork
import com.tangem.tap.features.wallet.redux.WalletAction
import com.tangem.tap.store
@ -34,8 +35,9 @@ class TwinsOnboardingFragment : Fragment(R.layout.fragment_twin_cards) {
store.dispatch(WalletAction.TwinsAction.SetOnboardingShown)
val secondCardId = store.state.walletState.twinCardsState?.secondCardId
val text = getString(R.string.twins_onboarding_description_format, secondCardId)
val secondCardId = store.state.walletState.twinCardsState?.secondCardId ?: ""
val secondTwinCardId = TwinsHelper.getTwinCardIdForUser(secondCardId)
val text = getString(R.string.twins_onboarding_description_format, secondTwinCardId)
tv_twin_cards_description_1.text = text
setOnClickListeners()

View file

@ -25,7 +25,7 @@
<string name="wallet_button_scan">Scan</string>
<string name="wallet_button_send">Send</string>
<string name="wallet_button_create_wallet">Create twin wallet</string>
<string name="wallet_button_create_wallet">Create wallet</string>
<string name="wallet_title">Tangem Tap</string>
<string name="wallet_choice_wallet_option_title">Choice wallet option</string>
@ -37,8 +37,8 @@
<string name="wallet_error_no_account">Account is not created</string>
<string name="wallet_error_no_account_subtitle_format">Load %1$s+ %2$s to create account</string>
<string name="wallet_error_empty_card">Create twin wallet</string>
<string name="wallet_error_empty_card_subtitle"> Generate wallet keys on both cards to start using your Twins</string>
<string name="wallet_error_empty_card">Empty card</string>
<string name="wallet_error_empty_card_subtitle">Create wallet to start using Tangem card</string>
<string name="wallet_error_unsupported_blockchain">This card is not supported</string>
<string name="wallet_error_unsupported_blockchain_subtitle">Your Tangem card was made to work with a different application. Please see the name and instructions on your card, and install the correct app</string>

View file

@ -4,6 +4,10 @@
<string name="wallet_address_chip_compatibility" translatable="false">Compatibility</string>
<string name="wallet_address_chip_legacy" translatable="false">Legacy</string>
<string name="wallet_button_create_twin_wallet" translatable="false">Create twin wallet</string>
<string name="wallet_error_empty_twin_card" translatable="false">Create twin wallet</string>
<string name="wallet_error_empty_twin_card_subtitle" translatable="false"> Generate wallet keys on both cards to start using your Twins</string>
<string name="twins_onboarding_title" translatable="false">Tangem Twin</string>
<string name="twins_onboarding_subtitle" translatable="false">One wallet. Two cards.</string>
<string name="twins_onboarding_description_format" translatable="false">This one that you are holding in your hands