Updated on 2026-08-14
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
|
@ -73,6 +73,7 @@ class PayIdManager {
|
|||
Blockchain.BitcoinCash,
|
||||
Blockchain.Binance,
|
||||
Blockchain.RSK,
|
||||
Blockchain.Tezos
|
||||
)
|
||||
|
||||
fun isPayId(value: String?): Boolean = value?.contains(payIdRegExp) ?: false
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.tangem.wallet.R
|
|||
|
||||
interface TapErrors
|
||||
|
||||
interface ArgError{
|
||||
interface ArgError {
|
||||
val args: List<Any>?
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ sealed class TapError(
|
|||
) : Throwable(), TapErrors, ArgError {
|
||||
|
||||
object UnknownError : TapError(R.string.send_error_unknown)
|
||||
data class CustomError(val customMessage: String) : TapError(R.string.common_custom_string, listOf(customMessage))
|
||||
object PayIdAlreadyCreated : TapError(R.string.wallet_create_payid_error_already_created)
|
||||
object PayIdCreatingError : TapError(R.string.wallet_create_payid_error_message)
|
||||
object PayIdEmptyField : TapError(R.string.wallet_create_payid_empty)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import com.tangem.tap.common.redux.global.GlobalAction
|
|||
import com.tangem.tap.domain.extensions.amountToCreateAccount
|
||||
import com.tangem.tap.domain.extensions.isNoAccountError
|
||||
import com.tangem.tap.domain.tasks.ScanNoteResponse
|
||||
import com.tangem.tap.features.wallet.redux.PayIdState
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
import com.tangem.tap.network.NetworkConnectivity
|
||||
import com.tangem.tap.network.coinmarketcap.CoinMarketCapService
|
||||
|
|
@ -25,6 +24,7 @@ import java.math.BigDecimal
|
|||
class TapWalletManager {
|
||||
private val payIdManager = PayIdManager()
|
||||
private val coinMarketCapService = CoinMarketCapService()
|
||||
private var tapWorkarounds: TapWorkarounds? = null
|
||||
|
||||
suspend fun loadWalletData() {
|
||||
val walletManager = store.state.globalState.scanNoteResponse?.walletManager
|
||||
|
|
@ -78,6 +78,7 @@ class TapWalletManager {
|
|||
}
|
||||
|
||||
suspend fun onCardScanned(data: ScanNoteResponse) {
|
||||
tapWorkarounds = TapWorkarounds(data.card)
|
||||
withContext(Dispatchers.Main) {
|
||||
store.dispatch(WalletAction.ResetState)
|
||||
store.dispatch(GlobalAction.SaveScanNoteResponse(data))
|
||||
|
|
@ -142,7 +143,6 @@ class TapWalletManager {
|
|||
private suspend fun loadPayIdIfNeeded(): Result<String?>? {
|
||||
val scanNoteResponse = store.state.globalState.scanNoteResponse
|
||||
if (!TapConfig.usePayId ||
|
||||
store.state.walletState.payIdData.payIdState == PayIdState.Disabled ||
|
||||
scanNoteResponse?.walletManager?.wallet?.blockchain?.isPayIdSupported() == false) {
|
||||
return null
|
||||
}
|
||||
|
|
@ -160,7 +160,11 @@ class TapWalletManager {
|
|||
is Result.Success -> {
|
||||
val payId = result.data
|
||||
if (payId == null) {
|
||||
store.dispatch(WalletAction.LoadPayId.NotCreated)
|
||||
if (tapWorkarounds?.isPayIdCreationEnabled() == false) {
|
||||
store.dispatch(WalletAction.DisablePayId)
|
||||
} else {
|
||||
store.dispatch(WalletAction.LoadPayId.NotCreated)
|
||||
}
|
||||
} else {
|
||||
store.dispatch(WalletAction.LoadPayId.Success(payId))
|
||||
}
|
||||
|
|
|
|||
17
app/src/main/java/com/tangem/tap/domain/TapWorkarounds.kt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package com.tangem.tap.domain
|
||||
|
||||
import com.tangem.commands.Card
|
||||
|
||||
class TapWorkarounds(val card: Card) {
|
||||
|
||||
private val isStart2Coin: Boolean = card.cardData?.issuerName == START_2_COIN_ISSUER
|
||||
|
||||
fun isPayIdCreationEnabled(): Boolean {
|
||||
if (isStart2Coin) return false
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val START_2_COIN_ISSUER = "start2coin"
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +89,8 @@ private fun verifyAndSendTransaction(
|
|||
}
|
||||
}
|
||||
is Throwable -> {
|
||||
val message = (result.error as Throwable).message
|
||||
val throwable = result.error as Throwable
|
||||
val message = throwable.message
|
||||
when {
|
||||
message == null -> {
|
||||
dispatch(SendAction.SendError(TapError.UnknownError))
|
||||
|
|
@ -98,8 +99,9 @@ private fun verifyAndSendTransaction(
|
|||
// user was cancelled the operation by closing the Sdk bottom sheet
|
||||
}
|
||||
else -> {
|
||||
Timber.e(result.error)
|
||||
dispatch(SendAction.SendError(TapError.BlockchainInternalError))
|
||||
Timber.e(throwable)
|
||||
FirebaseCrashlytics.getInstance().recordException(throwable)
|
||||
dispatch(SendAction.SendError(TapError.CustomError(message)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ sealed class WalletAction : Action {
|
|||
object Failure : WalletAction()
|
||||
}
|
||||
|
||||
object DisablePayId: WalletAction()
|
||||
|
||||
data class LoadArtwork(val card: Card, val artworkId: String?) : WalletAction() {
|
||||
data class Success(val artwork: Artwork) : WalletAction()
|
||||
object Failure : WalletAction()
|
||||
|
|
|
|||
|
|
@ -176,6 +176,9 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
|
|||
is WalletAction.LoadPayId.NotCreated -> newState = newState.copy(
|
||||
payIdData = PayIdData(PayIdState.NotCreated, null)
|
||||
)
|
||||
is WalletAction.DisablePayId -> newState = newState.copy(
|
||||
payIdData = PayIdData(PayIdState.Disabled, null)
|
||||
)
|
||||
is WalletAction.CreatePayId, is WalletAction.CreatePayId.Failure ->
|
||||
newState = newState.copy(
|
||||
walletDialog = WalletDialog.CreatePayIdDialog(CreatingPayIdState.EnterPayId)
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
|
@ -9,6 +9,7 @@
|
|||
<string name="common_done">Done</string>
|
||||
<string name="common_cancel">Cancel</string>
|
||||
<string name="common_accept">Accept</string>
|
||||
<string name="common_custom_string" translatable="false">%s</string>
|
||||
|
||||
<string name="common_camera_denied_alert_title">Camera access denied</string>
|
||||
<string name="common_camera_denied_alert_message">You have not given access to your camera, please adjust your privacy settings</string>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ext.versions = [
|
||||
kotlin : '1.4.0',
|
||||
build_gradle: '4.0.1',
|
||||
build_gradle: '4.1.0',
|
||||
]
|
||||
|
|
|
|||
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#Thu Jun 11 11:33:17 MSK 2020
|
||||
#Wed Oct 21 13:51:19 MSK 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
||||
|
|
|
|||