Updated on 2026-08-14
This commit is contained in:
parent
2c78e27915
commit
f0e07c4dcd
21 changed files with 69 additions and 89 deletions
|
|
@ -12,9 +12,9 @@ import com.tangem.blockchain.common.WalletManagerFactory
|
|||
import com.tangem.blockchain.network.BlockchainSdkRetrofitBuilder
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.datasource.api.common.MoshiConverter
|
||||
import com.tangem.datasource.config.models.Config
|
||||
import com.tangem.datasource.config.ConfigManager
|
||||
import com.tangem.datasource.config.FeaturesLocalLoader
|
||||
import com.tangem.datasource.config.models.Config
|
||||
import com.tangem.datasource.utils.AndroidAssetReader
|
||||
import com.tangem.datasource.utils.AssetReader
|
||||
import com.tangem.domain.DomainLayer
|
||||
|
|
@ -152,7 +152,6 @@ class TapApplication : Application(), ImageLoaderFactory {
|
|||
)
|
||||
}
|
||||
|
||||
|
||||
userTokensRepository = UserTokensRepository.init(
|
||||
context = this,
|
||||
tangemTechService = store.state.domainNetworks.tangemTechService,
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ open class ShimmerRecyclerAdapter(
|
|||
|
||||
class ShimmerVH(viewGroup: ViewGroup) : RecyclerView.ViewHolder(viewGroup)
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
data class ShimmerData(private val any: String = "")
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.tangem.tap.features.details.ui.details
|
||||
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPay
|
||||
import com.tangem.tap.common.analytics.events.Settings
|
||||
import com.tangem.tap.common.feedback.FeedbackEmail
|
||||
import com.tangem.tap.common.feedback.SupportInfo
|
||||
|
|
@ -9,7 +8,6 @@ import com.tangem.tap.common.redux.AppState
|
|||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
import com.tangem.tap.features.details.redux.DetailsAction
|
||||
import com.tangem.tap.features.details.redux.DetailsState
|
||||
import com.tangem.tap.features.disclaimer.redux.DisclaimerAction
|
||||
import com.tangem.tap.features.home.LocaleRegionProvider
|
||||
|
|
|
|||
|
|
@ -12,39 +12,39 @@ import com.tangem.tap.preferencesStorage
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class OnboardingSaltPayHelper {
|
||||
companion object {
|
||||
object OnboardingSaltPayHelper {
|
||||
|
||||
suspend fun isOnboardingCase(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> {
|
||||
return try {
|
||||
val updatedStep = manager.update(SaltPayActivationStep.None, null).successOr { return it }
|
||||
suspend fun isOnboardingCase(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> {
|
||||
return try {
|
||||
val updatedStep = manager.update(SaltPayActivationStep.None, null).successOr { return it }
|
||||
|
||||
val cardStorage = preferencesStorage.usedCardsPrefStorage
|
||||
val activationIsFinished = cardStorage.isActivationFinished(scanResponse.card.cardId)
|
||||
if (updatedStep == SaltPayActivationStep.Success && !activationIsFinished) {
|
||||
cardStorage.activationFinished(scanResponse.card.cardId)
|
||||
}
|
||||
val isActivationCase = updatedStep != SaltPayActivationStep.Success
|
||||
val isBackupCase = scanResponse.card.backupStatus?.isActive == false
|
||||
Result.Success(isActivationCase || isBackupCase)
|
||||
} catch (ex: Exception) {
|
||||
Result.Failure(ex)
|
||||
} catch (error: SaltPayActivationError) {
|
||||
Result.Failure(error)
|
||||
val cardStorage = preferencesStorage.usedCardsPrefStorage
|
||||
val activationIsFinished = cardStorage.isActivationFinished(scanResponse.card.cardId)
|
||||
if (updatedStep == SaltPayActivationStep.Success && !activationIsFinished) {
|
||||
cardStorage.activationFinished(scanResponse.card.cardId)
|
||||
}
|
||||
val isActivationCase = updatedStep != SaltPayActivationStep.Success
|
||||
val isBackupCase = scanResponse.card.backupStatus?.isActive == false
|
||||
Result.Success(isActivationCase || isBackupCase)
|
||||
} catch (ex: Exception) {
|
||||
Result.Failure(ex)
|
||||
} catch (error: SaltPayActivationError) {
|
||||
Result.Failure(error)
|
||||
}
|
||||
|
||||
fun testProceedToOnboarding(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> = Result.Success(true)
|
||||
|
||||
fun testProceedToMainScreen(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> = Result.Success(false)
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
fun testProceedToOnboarding(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> = Result.Success(true)
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
fun testProceedToMainScreen(
|
||||
scanResponse: ScanResponse,
|
||||
manager: SaltPayActivationManager,
|
||||
): Result<Boolean> = Result.Success(false)
|
||||
}
|
||||
|
|
@ -164,6 +164,7 @@ class GnosisRegistrator(
|
|||
return transferFromHardcodeWay(amountToClaim, signer)
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private suspend fun transferFromStandardWay(amountToClaim: BigDecimal, signer: TransactionSigner): Result<Unit> {
|
||||
val amount = Amount(token, amountToClaim)
|
||||
val feeAmount = walletManager.getFeeToTransferFrom(amount, addressTreasureSafe)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
@file:Suppress("MaximumLineLength")
|
||||
|
||||
package com.tangem.tap.features.onboarding.products.wallet.saltPay
|
||||
|
||||
import android.net.Uri
|
||||
|
|
@ -37,10 +39,20 @@ import com.tangem.tap.common.extensions.safeUpdate
|
|||
import com.tangem.tap.domain.getFirstToken
|
||||
import com.tangem.tap.domain.model.builders.UserWalletIdBuilder
|
||||
import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPayActivationError
|
||||
import com.tangem.tap.store
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import com.tangem.tap.store
|
||||
import java.math.BigDecimal
|
||||
import kotlin.ByteArray
|
||||
import kotlin.Exception
|
||||
import kotlin.IllegalStateException
|
||||
import kotlin.NullPointerException
|
||||
import kotlin.String
|
||||
import kotlin.Suppress
|
||||
import kotlin.Unit
|
||||
import kotlin.UnsupportedOperationException
|
||||
import kotlin.byteArrayOf
|
||||
import kotlin.minus
|
||||
import com.tangem.blockchain.extensions.Result as BlockchainResult
|
||||
|
||||
/**
|
||||
|
|
@ -295,6 +307,7 @@ class SaltPayActivationManagerFactory(
|
|||
)
|
||||
}
|
||||
|
||||
@Suppress("UnusedPrivateMember")
|
||||
private fun createDummyActivationManager(
|
||||
saltPayConfig: SaltPayConfig,
|
||||
wmFactory: WalletManagerFactory,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ object SaltPayExceptionHandler {
|
|||
is TangemSdkError -> {
|
||||
when (throwable) {
|
||||
is TangemSdkError.NetworkError -> {
|
||||
val message = (throwable).customMessage
|
||||
val message = throwable.customMessage
|
||||
store.dispatchDialogShow(AppDialog.SimpleOkErrorDialog(message))
|
||||
}
|
||||
else -> Unit
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ internal class SaveWalletBottomSheetFragment : ComposeBottomSheetFragment<SaveWa
|
|||
|
||||
@Composable
|
||||
override fun ScreenContent(
|
||||
modifier: Modifier,
|
||||
state: SaveWalletScreenState,
|
||||
modifier: Modifier,
|
||||
) {
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
val errorMessage by rememberUpdatedState(newValue = state.error?.resolveReference())
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ internal class SprinklrActivity : ComposeActivity<SprinklrScreenState>() {
|
|||
}
|
||||
|
||||
@Composable
|
||||
override fun ScreenContent(modifier: Modifier, state: SprinklrScreenState) {
|
||||
override fun ScreenContent(
|
||||
state: SprinklrScreenState,
|
||||
modifier: Modifier,
|
||||
) {
|
||||
BackHandler(onBack = state.onNavigateBack)
|
||||
SprinklrScreenContent(
|
||||
modifier = modifier
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ import kotlinx.coroutines.launch
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
private class AddCustomTokenScreen // for simple search
|
||||
@Suppress("UnusedPrivateClass")
|
||||
private class AddCustomTokenScreen // for simple search
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.tangem.tap.features.wallet.redux
|
|||
import android.graphics.Bitmap
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchain.common.TransactionData
|
||||
import com.tangem.blockchain.common.Wallet
|
||||
import com.tangem.blockchain.common.WalletManager
|
||||
import com.tangem.blockchain.common.address.AddressType
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import coil.size.Scale
|
|||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.core.ui.fragments.setStatusBarColor
|
||||
import com.tangem.core.ui.utils.OneTouchClickListener
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPay
|
||||
import com.tangem.feature.swap.domain.SwapInteractor
|
||||
import com.tangem.tap.MainActivity
|
||||
import com.tangem.tap.common.analytics.events.MainScreen
|
||||
|
|
@ -226,7 +225,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
}
|
||||
|
||||
private fun setupCardImage(state: WalletState, isSaltPay: Boolean) {
|
||||
//TODO: SaltPay: remove hardCode
|
||||
// TODO: SaltPay: remove hardCode
|
||||
if (isSaltPay) {
|
||||
binding.ivCard.load(R.drawable.img_salt_pay_visa) {
|
||||
scale(Scale.FIT)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.tangem.tap.features.wallet.ui.wallet.saltPay
|
|||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.skydoves.androidveil.VeilLayout
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.domain.common.extensions.debounce
|
||||
import com.tangem.domain.common.extensions.withMainContext
|
||||
|
|
@ -252,9 +251,4 @@ class SaltPayWalletView : WalletView() {
|
|||
}
|
||||
super.onViewDestroy()
|
||||
}
|
||||
}
|
||||
|
||||
private fun VeilLayout.changeVeilState(show: Boolean) {
|
||||
if (show) this.veil()
|
||||
else this.unVeil()
|
||||
}
|
||||
|
|
@ -74,5 +74,6 @@ data class HistoryTransactionData(
|
|||
return date
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
private fun String.reduceAddress(): String = "${substring(0..5)}...${substring(length - 4)}"
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package com.tangem.tap.features.wallet.ui.wallet.saltPay.rv
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
open class ShimmerRecyclerAdapter(
|
||||
private val viewHolderViewFactory: (ViewGroup) -> ViewGroup,
|
||||
) : ListAdapter<ShimmerData, ShimmerVH>(DiffUtilCallback) {
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return if (currentList.isEmpty()) 0 else currentList[position].hashCode().toLong()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ShimmerVH {
|
||||
return ShimmerVH(viewHolderViewFactory.invoke(parent))
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ShimmerVH, position: Int) {}
|
||||
|
||||
object DiffUtilCallback : DiffUtil.ItemCallback<ShimmerData>() {
|
||||
override fun areContentsTheSame(oldItem: ShimmerData, newItem: ShimmerData) = oldItem == newItem
|
||||
override fun areItemsTheSame(oldItem: ShimmerData, newItem: ShimmerData) = oldItem == newItem
|
||||
}
|
||||
}
|
||||
|
||||
class ShimmerVH(viewGroup: ViewGroup) : RecyclerView.ViewHolder(viewGroup)
|
||||
|
||||
data class ShimmerData(private val any: String = "")
|
||||
|
|
@ -20,9 +20,10 @@ import com.tangem.wallet.databinding.ItemSaltPayTxHistoryDateBinding
|
|||
*/
|
||||
internal class TxHistoryAdapter : ListAdapter<HistoryItemData, BaseTxHistoryVH>(DiffUtilCallback) {
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return if (currentList.isEmpty()) 0L
|
||||
else currentList[position].itemId
|
||||
override fun getItemId(position: Int): Long = if (currentList.isEmpty()) {
|
||||
0L
|
||||
} else {
|
||||
currentList[position].itemId
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseTxHistoryVH {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ internal class WalletSelectorBottomSheetFragment : ComposeBottomSheetFragment<Wa
|
|||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
override fun ScreenContent(
|
||||
modifier: Modifier,
|
||||
state: WalletSelectorScreenState,
|
||||
modifier: Modifier,
|
||||
) {
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
val errorMessage by rememberUpdatedState(newValue = state.error?.resolveReference())
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ internal class WelcomeFragment : ComposeFragment<WelcomeScreenState>() {
|
|||
|
||||
@Composable
|
||||
override fun ScreenContent(
|
||||
modifier: Modifier,
|
||||
state: WelcomeScreenState,
|
||||
modifier: Modifier,
|
||||
) {
|
||||
val snackbarHostState = remember { SnackbarHostState() }
|
||||
val errorMessage by rememberUpdatedState(newValue = state.error?.resolveReference())
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ abstract class ComposeBottomSheetFragment<ScreenState> : BottomSheetDialogFragme
|
|||
setContent {
|
||||
TangemTheme {
|
||||
ScreenContent(
|
||||
state = provideState().value,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.let {
|
||||
|
|
@ -59,7 +60,6 @@ abstract class ComposeBottomSheetFragment<ScreenState> : BottomSheetDialogFragme
|
|||
color = TangemTheme.colors.background.plain,
|
||||
shape = TangemTheme.shapes.bottomSheet,
|
||||
),
|
||||
state = provideState().value,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,22 +24,24 @@ internal interface ComposeScreen<ScreenState> {
|
|||
}
|
||||
|
||||
ScreenContent(
|
||||
state = provideState().value,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(color = backgroundColor),
|
||||
state = provideState().value,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("TopLevelComposableFunctions")
|
||||
@Composable
|
||||
fun provideState(): State<ScreenState>
|
||||
|
||||
@Suppress("TopLevelComposableFunctions")
|
||||
@Composable
|
||||
fun ScreenContent(
|
||||
modifier: Modifier,
|
||||
state: ScreenState,
|
||||
modifier: Modifier,
|
||||
)
|
||||
}
|
||||
|
|
@ -61,6 +61,7 @@ object SaltPayWorkaround {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
fun isSaltPayCardId(cardId: String): Boolean = isVisaBatchId(cardId.take(4)) || isWalletCardId(cardId)
|
||||
|
||||
fun isVisaBatchId(batchId: String): Boolean = visaBatches.contains(batchId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue