From e31a60bd427cb8fac6948ca339e542b43ab4ac73 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 18 Feb 2021 11:19:37 +0300 Subject: [PATCH 1/9] Updated on 2026-08-14 --- .../ui/stateSubscribers/SendStateSubscriber.kt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt index 8c0c8fdf23..3476f1ae19 100644 --- a/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt +++ b/app/src/main/java/com/tangem/tap/features/send/ui/stateSubscribers/SendStateSubscriber.kt @@ -177,22 +177,6 @@ class SendStateSubscriber(fragment: BaseStoreFragment) : FragmentStateSubscriber val amountToSend = state.viewAmountValue if (!amountToSend.isFromUserInput) fg.etAmountToSend.update(amountToSend.value) -// fg.tvAmountToSendShadow.text = amountToSend -// if (amountToSend.length > 10) { -// post is needed to wait for text size changes -// fg.tvAmountToSendShadow.post { -// fg.etAmountToSend.setTextSize(TypedValue.COMPLEX_UNIT_PX, fg.tvAmountToSendShadow.textSize - 2) -// fg.etAmountToSend.update(amountToSend) -// if (!state.cursorAtTheSamePosition) fg.etAmountToSend.setSelection(amountToSend.length) -// } -// } else { -// val textSize = fg.resources.getDimension(R.dimen.text_size_amount_to_send) -// fg.tvAmountToSendShadow.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize) -// fg.etAmountToSend.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize) -// fg.etAmountToSend.update(amountToSend) -// if (!state.cursorAtTheSamePosition) fg.etAmountToSend.setSelection(amountToSend.length) -// } - fg.tvAmountCurrency.update(state.mainCurrency.currencySymbol) (fg as? SendFragment)?.saveMainCurrency(state.mainCurrency.type) From 03276ea8404f22d49d573484d6e532bf957dd26e Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 18 Feb 2021 11:33:30 +0300 Subject: [PATCH 2/9] Updated on 2026-08-14 --- .../send/redux/middlewares/AddressPayIdMiddleware.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt index ded3984926..900c790986 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt @@ -1,19 +1,17 @@ package com.tangem.tap.features.send.redux.middlewares +import androidx.core.text.isDigitsOnly import com.tangem.blockchain.common.Wallet import com.tangem.commands.common.network.Result import com.tangem.tap.common.redux.AppState import com.tangem.tap.domain.PayIdManager import com.tangem.tap.domain.isPayIdSupported -import com.tangem.tap.features.send.redux.AddressPayIdActionUi -import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction +import com.tangem.tap.features.send.redux.* import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction.AddressVerification.SetAddressError import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction.AddressVerification.SetWalletAddress import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction.Error import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction.PayIdVerification.SetPayIdError import com.tangem.tap.features.send.redux.AddressPayIdVerifyAction.PayIdVerification.SetPayIdWalletAddress -import com.tangem.tap.features.send.redux.FeeAction -import com.tangem.tap.features.send.redux.TransactionExtrasAction import com.tangem.tap.scope import com.tangem.tap.store import kotlinx.coroutines.Dispatchers @@ -50,7 +48,7 @@ internal class AddressPayIdMiddleware { private fun setAddressAndCheck(data: String, isUserInput: Boolean, dispatch: (Action) -> Unit) { val potentialPayId = data.toLowerCase() - if (PayIdManager.isPayId(potentialPayId) && isPayIdEnabled()) { + if (isPayIdEnabled() && PayIdManager.isPayId(potentialPayId)) { dispatch(SetPayIdWalletAddress(potentialPayId, "", isUserInput)) } else { dispatch(SetWalletAddress(data, isUserInput)) @@ -64,7 +62,7 @@ internal class AddressPayIdMiddleware { val addressPayId = sendState.addressPayIdState.normalFieldValue ?: return val isUserInput = sendState.addressPayIdState.viewFieldValue.isFromUserInput - if (PayIdManager.isPayId(addressPayId) && isPayIdEnabled()) { + if (isPayIdEnabled() && PayIdManager.isPayId(addressPayId)) { verifyPayId(addressPayId, wallet, isUserInput, dispatch) } else { verifyAddress(addressPayId, wallet, isUserInput, dispatch) From 176d3d5ce19b85f881f5f6825999e04811b862b8 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 18 Feb 2021 11:34:37 +0300 Subject: [PATCH 3/9] Updated on 2026-08-14 --- .../middlewares/AddressPayIdMiddleware.kt | 20 ++++++++++++------- .../tap/features/send/ui/SendFragment.kt | 11 +++++++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt index 900c790986..e9beba0bc0 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt @@ -129,6 +129,9 @@ internal class AddressPayIdMiddleware { val failReason = isValidBlockchainAddressAndNotTheSameAsWallet(wallet, supposedAddress) if (failReason == null) { + noSchemeAddress.getQueryParameter("amount")?.let { + if (it.isDigitsOnly()) dispatch(AmountAction.SetAmount(it.toBigDecimal(), false)) + } dispatch(SetWalletAddress(supposedAddress, isUserInput)) dispatch(TransactionExtrasAction.Prepare(wallet.blockchain, address, null)) } else { @@ -149,14 +152,10 @@ internal class AddressPayIdMiddleware { } } - //TODO: move to the blockchainSDK - private fun extractAddressFromShareUri(shareUri: String): String { - val sharePrefix = listOf("bitcoin:", "ethereum:", "xrpl:", "litecoin:", "bnb:") - val prefixes = sharePrefix.filter { shareUri.contains(it) } - return if (prefixes.isEmpty()) shareUri else shareUri.replace(prefixes[0], "") - } - private fun String.removeShareUriQuery(): String = this.substringBefore("?") + private fun String.getQueryParameter(name: String): String? { + return this.substringAfter("?").splitToMap("&", "=")[name] + } private fun verifyClipboard(input: String?, appState: AppState?, dispatch: DispatchFunction) { val addressPayId = input ?: return @@ -184,4 +183,11 @@ internal class AddressPayIdMiddleware { private fun isPayIdEnabled(): Boolean { return store.state.globalState.configManager?.config?.isSendingToPayIdEnabled ?: false } +} + +fun String.splitToMap(firstDelimiter: String, secondDelimiter: String): Map { + return this.split(firstDelimiter) + .map { it.split(secondDelimiter) } + .map { it.first() to it.last().toString() } + .toMap() } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/send/ui/SendFragment.kt b/app/src/main/java/com/tangem/tap/features/send/ui/SendFragment.kt index 874e744207..6dae105162 100644 --- a/app/src/main/java/com/tangem/tap/features/send/ui/SendFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/send/ui/SendFragment.kt @@ -139,9 +139,14 @@ class SendFragment : BaseStoreFragment(R.layout.fragment_send) { val scannedCode = data?.getStringExtra(ScanQrCodeActivity.SCAN_RESULT) ?: "" if (scannedCode.isEmpty()) return - store.dispatch(PasteAddressPayId(scannedCode)) - store.dispatch(TruncateOrRestore(!etAddressOrPayId.isFocused)) - store.dispatch(FeeAction.RequestFee) + // Delayed launch is needed in order for the UI to be drawn and to process the sent events. + // If do not use the delay, then etAmount error field is not displayed when + // inserting an incorrect amount by shareUri + imvQrCode.postDelayed({ + store.dispatch(PasteAddressPayId(scannedCode)) + store.dispatch(TruncateOrRestore(!etAddressOrPayId.isFocused)) + store.dispatch(FeeAction.RequestFee) + }, 200) } private fun setupAmountLayout() { From cc1b9636d2537628e3f1175a019be81cfe4d73dd Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 19 Feb 2021 10:47:44 +0300 Subject: [PATCH 4/9] Updated on 2026-08-14 --- .../tap/domain/termsOfUse/TermsOfUse.kt | 52 +++++++++++++++++++ .../features/details/redux/DetailsAction.kt | 2 + .../features/details/redux/DetailsReducer.kt | 3 +- .../features/details/redux/DetailsState.kt | 3 +- .../features/details/ui/DetailsFragment.kt | 9 ++++ .../tap/features/send/ui/SendFragment.kt | 3 ++ .../tap/features/wallet/ui/WalletFragment.kt | 2 + app/src/main/res/layout/fragment_details.xml | 17 +++++- .../main/res/values/strings_untranslated.xml | 1 + 9 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt new file mode 100644 index 0000000000..7facc2c92f --- /dev/null +++ b/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt @@ -0,0 +1,52 @@ +package com.tangem.tap.domain.termsOfUse + +import android.content.res.Resources +import androidx.core.os.ConfigurationCompat +import java.util.* + +/** +[REDACTED_AUTHOR] + */ +class TermsOfUse { + val locale: Locale = ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0) + + fun getUrl(cardId: String): String? { + val terms = CardTermsFactory.create(cardId) ?: return null + + return terms.getUrl(locale.country) + } +} + +class CardTermsOfUse( + private val urlsByRegion: Map, + private val defaultRegion: String, +) { + + fun getUrl(region: String): String? { + return urlsByRegion[region.toLowerCase()] ?: urlsByRegion[defaultRegion] + } +} + + +class CardTermsFactory { + companion object { + + fun create(cardId: String): CardTermsOfUse? { + val batch = cardId.substring(0..3) + + return when (batch) { + "CB05" -> { + CardTermsOfUse( + mapOf( + "ru" to "https://yandex.ru/", + "en" to "https://www.google.com/", + "fr" to "https://www.qwant.com", + ), + "ru" + ) + } + else -> null + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt index 2ec73c0f00..14fc7582a8 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt @@ -6,6 +6,7 @@ import com.tangem.commands.common.card.Card import com.tangem.tap.common.redux.NotificationAction import com.tangem.tap.common.redux.global.FiatCurrencyName import com.tangem.tap.domain.tasks.ScanNoteResponse +import com.tangem.tap.domain.termsOfUse.TermsOfUse import com.tangem.tap.domain.twins.TwinCardNumber import com.tangem.tap.features.details.redux.twins.CreateTwinWallet import com.tangem.tap.network.coinmarketcap.FiatCurrency @@ -19,6 +20,7 @@ sealed class DetailsAction : Action { val scanNoteResponse: ScanNoteResponse, val wallet: Wallet?, val isCreatingTwinWalletAllowed: Boolean?, + val termsOfUse: TermsOfUse, val fiatCurrencyName: FiatCurrencyName, val fiatCurrencies: List? = null, ) : DetailsAction() diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt index 805d31f8c9..c26028d141 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt @@ -73,7 +73,8 @@ private fun handlePrepareScreen(action: DetailsAction.PrepareScreen, state: Deta action.fiatCurrencyName ), securityScreenState = SecurityScreenState(currentOption = securityOption), - createTwinWalletState = twinsState + createTwinWalletState = twinsState, + cardTermsOfUseUrl = action.termsOfUse.getUrl(action.card.cardId) ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt index 4730507ebc..774ecfd6c6 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt @@ -18,7 +18,8 @@ data class DetailsState( val eraseWalletState: EraseWalletState? = null, val confirmScreenState: ConfirmScreenState? = null, val securityScreenState: SecurityScreenState? = null, - val createTwinWalletState: CreateTwinWalletState? = null + val createTwinWalletState: CreateTwinWalletState? = null, + val cardTermsOfUseUrl: String? = null ) : StateType data class CardInfo( diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt index 262482b360..caa9780539 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt @@ -1,5 +1,7 @@ package com.tangem.tap.features.details.ui +import android.content.Intent +import android.net.Uri import android.os.Bundle import android.view.View import androidx.activity.OnBackPressedCallback @@ -80,6 +82,13 @@ class DetailsFragment : Fragment(R.layout.fragment_details), StoreSubscriber + + + app:layout_constraintTop_toBottomOf="@id/tv_card_tou" /> Invalid destination tag. It won\'t be added to the transaction Invalid Memo ID. It won\'t be added to the transaction + Terms of use From 1f6b9ac469348ecd36aa8c4e644900455d42d843 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 19 Feb 2021 10:48:37 +0300 Subject: [PATCH 5/9] Updated on 2026-08-14 --- app/src/main/res/layout/fragment_details.xml | 2 +- app/src/main/res/values/strings_untranslated.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_details.xml b/app/src/main/res/layout/fragment_details.xml index 95475088a1..b2ac116aef 100644 --- a/app/src/main/res/layout/fragment_details.xml +++ b/app/src/main/res/layout/fragment_details.xml @@ -139,7 +139,7 @@ app:drawableEndCompat="@drawable/ic_angle_bracket_right" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tv_disclaimer" - android:text="@string/terms_of_use" /> + android:text="@string/details_terms_of_use" /> The wallet creation procedure consists of three steps. You must complete it to the end, otherwise you will have to start from the beginning. Tap the card #%s 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. + Terms of use The twin address was successfully created @@ -38,6 +39,5 @@ this wallet. Invalid destination tag. It won\'t be added to the transaction Invalid Memo ID. It won\'t be added to the transaction - Terms of use From 5c5d8910147c5c2d1c0a8e532dfe3adcef5febcb Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 20 Feb 2021 15:04:52 +0300 Subject: [PATCH 6/9] Updated on 2026-08-14 --- .../tangem/tap/domain/termsOfUse/CardTou.kt | 46 ++++++++++++++++ .../tap/domain/termsOfUse/TermsOfUse.kt | 52 ------------------- .../features/details/redux/DetailsAction.kt | 4 +- .../features/details/redux/DetailsReducer.kt | 2 +- .../features/details/redux/DetailsState.kt | 7 +-- .../features/details/ui/DetailsFragment.kt | 3 +- .../tap/features/send/BaseStoreFragment.kt | 4 ++ .../tap/features/send/ui/SendFragment.kt | 3 -- .../tap/features/wallet/ui/WalletFragment.kt | 4 +- app/src/main/res/layout/fragment_details.xml | 2 +- .../main/res/values/strings_untranslated.xml | 2 +- 11 files changed, 62 insertions(+), 67 deletions(-) create mode 100644 app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt delete mode 100644 app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt new file mode 100644 index 0000000000..a6050e243c --- /dev/null +++ b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt @@ -0,0 +1,46 @@ +package com.tangem.tap.domain.termsOfUse + +import android.content.res.Resources +import android.net.Uri +import androidx.core.os.ConfigurationCompat +import com.tangem.commands.common.card.Card +import java.util.* + +/** +[REDACTED_AUTHOR] + */ +class CardTou { + private val locale: Locale = ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0) + + fun getUrl(card: Card): Uri? { + val issuerName = card.cardData?.issuerName ?: return null + if (issuerName.toLowerCase() != "start2coin") return null + + val baseUrl = "https://app.tangem.com/tou/" + val regionCode = regionCode(card.cardId) ?: "fr" + val filename = filename(locale.language, regionCode) + return Uri.parse(baseUrl + filename) + } + + private fun filename(languageCode: String, regionCode: String): String { + return when { + languageCode == "fr" && regionCode == "ch" -> "Start2Coin-fr-ch-tangem.pdf" + languageCode == "de" && regionCode == "ch" -> "Start2Coin-de-ch-tangem.pdf" + languageCode == "en" && regionCode == "ch" -> "Start2Coin-en-ch-tangem.pdf" + languageCode == "it" && regionCode == "ch" -> "Start2Coin-it-ch-tangem.pdf" + languageCode == "fr" && regionCode == "fr" -> "Start2Coin-fr-fr-atangem.pdf" + languageCode == "de" && regionCode == "at" -> "Start2Coin-de-at-tangem.pdf" + languageCode.isEmpty() && regionCode == "fr" -> "Start2Coin-fr-fr-atangem.pdf" + languageCode.isEmpty() && regionCode == "ch" -> "Start2Coin-en-ch-tangem.pdf" + languageCode.isEmpty() && regionCode == "at" -> "Start2Coin-de-at-tangem.pdf" + else -> "Start2Coin-fr-fr-atangem.pdf" + } + } + + private fun regionCode(cardId: String): String? = when (cardId.substring(2..3)) { + "0" -> "fr" + "1" -> "ch" + "2" -> "at" + else -> null + } +} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt deleted file mode 100644 index 7facc2c92f..0000000000 --- a/app/src/main/java/com/tangem/tap/domain/termsOfUse/TermsOfUse.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.tangem.tap.domain.termsOfUse - -import android.content.res.Resources -import androidx.core.os.ConfigurationCompat -import java.util.* - -/** -[REDACTED_AUTHOR] - */ -class TermsOfUse { - val locale: Locale = ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0) - - fun getUrl(cardId: String): String? { - val terms = CardTermsFactory.create(cardId) ?: return null - - return terms.getUrl(locale.country) - } -} - -class CardTermsOfUse( - private val urlsByRegion: Map, - private val defaultRegion: String, -) { - - fun getUrl(region: String): String? { - return urlsByRegion[region.toLowerCase()] ?: urlsByRegion[defaultRegion] - } -} - - -class CardTermsFactory { - companion object { - - fun create(cardId: String): CardTermsOfUse? { - val batch = cardId.substring(0..3) - - return when (batch) { - "CB05" -> { - CardTermsOfUse( - mapOf( - "ru" to "https://yandex.ru/", - "en" to "https://www.google.com/", - "fr" to "https://www.qwant.com", - ), - "ru" - ) - } - else -> null - } - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt index 14fc7582a8..65a2c7dff6 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsAction.kt @@ -6,7 +6,7 @@ import com.tangem.commands.common.card.Card import com.tangem.tap.common.redux.NotificationAction import com.tangem.tap.common.redux.global.FiatCurrencyName import com.tangem.tap.domain.tasks.ScanNoteResponse -import com.tangem.tap.domain.termsOfUse.TermsOfUse +import com.tangem.tap.domain.termsOfUse.CardTou import com.tangem.tap.domain.twins.TwinCardNumber import com.tangem.tap.features.details.redux.twins.CreateTwinWallet import com.tangem.tap.network.coinmarketcap.FiatCurrency @@ -20,7 +20,7 @@ sealed class DetailsAction : Action { val scanNoteResponse: ScanNoteResponse, val wallet: Wallet?, val isCreatingTwinWalletAllowed: Boolean?, - val termsOfUse: TermsOfUse, + val cardTou: CardTou, val fiatCurrencyName: FiatCurrencyName, val fiatCurrencies: List? = null, ) : DetailsAction() diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt index c26028d141..ebb0485c03 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsReducer.kt @@ -74,7 +74,7 @@ private fun handlePrepareScreen(action: DetailsAction.PrepareScreen, state: Deta ), securityScreenState = SecurityScreenState(currentOption = securityOption), createTwinWalletState = twinsState, - cardTermsOfUseUrl = action.termsOfUse.getUrl(action.card.cardId) + cardTermsOfUseUrl = action.cardTou.getUrl(action.card) ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt index 774ecfd6c6..7995acdcdb 100644 --- a/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt +++ b/app/src/main/java/com/tangem/tap/features/details/redux/DetailsState.kt @@ -1,5 +1,6 @@ package com.tangem.tap.features.details.redux +import android.net.Uri import com.tangem.blockchain.common.Wallet import com.tangem.commands.common.card.Card import com.tangem.tap.common.entities.Button @@ -19,13 +20,13 @@ data class DetailsState( val confirmScreenState: ConfirmScreenState? = null, val securityScreenState: SecurityScreenState? = null, val createTwinWalletState: CreateTwinWalletState? = null, - val cardTermsOfUseUrl: String? = null + val cardTermsOfUseUrl: Uri? = null, ) : StateType data class CardInfo( val cardId: String, val issuer: String, - val signedHashes: Int + val signedHashes: Int, ) enum class EraseWalletState { Allowed, NotAllowedByCard, NotEmpty } @@ -34,7 +35,7 @@ data class SecurityScreenState( val currentOption: SecurityOption = SecurityOption.LongTap, val selectedOption: SecurityOption = currentOption, val allowedOptions: EnumSet = EnumSet.allOf(SecurityOption::class.java), - val buttonProceed: Button = Button(true) + val buttonProceed: Button = Button(true), ) enum class SecurityOption { LongTap, PassCode, AccessCode } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt index caa9780539..8578a60304 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/DetailsFragment.kt @@ -1,7 +1,6 @@ package com.tangem.tap.features.details.ui import android.content.Intent -import android.net.Uri import android.os.Bundle import android.view.View import androidx.activity.OnBackPressedCallback @@ -85,7 +84,7 @@ class DetailsFragment : Fragment(R.layout.fragment_details), StoreSubscriber + android:text="@string/details_row_title_card_tou" /> The wallet creation procedure consists of three steps. You must complete it to the end, otherwise you will have to start from the beginning. Tap the card #%s 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. - Terms of use + Card terms of use The twin address was successfully created From 16b756ad883d95e38b9fa5dd9130d2348a497d9a Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 20 Feb 2021 15:08:58 +0300 Subject: [PATCH 7/9] Updated on 2026-08-14 --- .../main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt index a6050e243c..8ffcf14108 100644 --- a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt +++ b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt @@ -30,9 +30,9 @@ class CardTou { languageCode == "it" && regionCode == "ch" -> "Start2Coin-it-ch-tangem.pdf" languageCode == "fr" && regionCode == "fr" -> "Start2Coin-fr-fr-atangem.pdf" languageCode == "de" && regionCode == "at" -> "Start2Coin-de-at-tangem.pdf" - languageCode.isEmpty() && regionCode == "fr" -> "Start2Coin-fr-fr-atangem.pdf" - languageCode.isEmpty() && regionCode == "ch" -> "Start2Coin-en-ch-tangem.pdf" - languageCode.isEmpty() && regionCode == "at" -> "Start2Coin-de-at-tangem.pdf" + regionCode == "fr" -> "Start2Coin-fr-fr-atangem.pdf" + regionCode == "ch" -> "Start2Coin-en-ch-tangem.pdf" + regionCode == "at" -> "Start2Coin-de-at-tangem.pdf" else -> "Start2Coin-fr-fr-atangem.pdf" } } From e346c755c6410c0024d698cf869b1040cd808eb5 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 24 Feb 2021 15:40:56 +0300 Subject: [PATCH 8/9] Updated on 2026-08-14 --- .../main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt | 8 ++++---- .../send/redux/middlewares/AddressPayIdMiddleware.kt | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt index 8ffcf14108..c5d9d91396 100644 --- a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt +++ b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt @@ -37,10 +37,10 @@ class CardTou { } } - private fun regionCode(cardId: String): String? = when (cardId.substring(2..3)) { - "0" -> "fr" - "1" -> "ch" - "2" -> "at" + private fun regionCode(cardId: String): String? = when (cardId[1]) { + '0' -> "fr" + '1' -> "ch" + '2' -> "at" else -> null } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt index e9beba0bc0..b5793affa8 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt @@ -1,6 +1,5 @@ package com.tangem.tap.features.send.redux.middlewares -import androidx.core.text.isDigitsOnly import com.tangem.blockchain.common.Wallet import com.tangem.commands.common.network.Result import com.tangem.tap.common.redux.AppState @@ -129,8 +128,8 @@ internal class AddressPayIdMiddleware { val failReason = isValidBlockchainAddressAndNotTheSameAsWallet(wallet, supposedAddress) if (failReason == null) { - noSchemeAddress.getQueryParameter("amount")?.let { - if (it.isDigitsOnly()) dispatch(AmountAction.SetAmount(it.toBigDecimal(), false)) + noSchemeAddress.getQueryParameter("amount")?.toBigDecimalOrNull()?.let { + dispatch(AmountAction.SetAmount(it, false)) } dispatch(SetWalletAddress(supposedAddress, isUserInput)) dispatch(TransactionExtrasAction.Prepare(wallet.blockchain, address, null)) From 354660e1169b704335668a29953a15a4eb3a0241 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 24 Feb 2021 19:10:50 +0300 Subject: [PATCH 9/9] Updated on 2026-08-14 --- .../send/redux/middlewares/AddressPayIdMiddleware.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt index b5793affa8..a713ed3163 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt @@ -1,5 +1,6 @@ package com.tangem.tap.features.send.redux.middlewares +import com.tangem.blockchain.common.Blockchain import com.tangem.blockchain.common.Wallet import com.tangem.commands.common.network.Result import com.tangem.tap.common.redux.AppState @@ -107,7 +108,11 @@ internal class AddressPayIdMiddleware { } private fun verifyAddress(address: String, wallet: Wallet, isUserInput: Boolean, dispatch: (Action) -> Unit) { - val addressSchemeSplit = address.split(":") + val addressSchemeSplit = if (wallet.blockchain == Blockchain.BitcoinCash) { + listOf(address) + } else { + address.split(":") + } val noSchemeAddress = when (addressSchemeSplit.size) { 1 -> address // no scheme 2 -> { // scheme @@ -141,7 +146,7 @@ internal class AddressPayIdMiddleware { private fun isValidBlockchainAddressAndNotTheSameAsWallet(wallet: Wallet, address: String): Error? { return if (wallet.blockchain.validateAddress(address)) { - if (wallet.addresses.all { it.value != address } ) { + if (wallet.addresses.all { it.value != address }) { null } else { Error.ADDRESS_SAME_AS_WALLET