Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-27 18:03:07 +03:00
commit 18ad4ea55a
4 changed files with 11 additions and 38 deletions

View file

@ -9,6 +9,7 @@ import com.tangem.datasource.config.models.Config
import com.tangem.domain.common.LogConfig
import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ScanResponse
import com.tangem.tap.*
import com.tangem.tap.common.analytics.events.Basic
import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.extensions.dispatchDebugErrorNotification
@ -25,11 +26,7 @@ import com.tangem.tap.network.exchangeServices.ExchangeService
import com.tangem.tap.network.exchangeServices.mercuryo.MercuryoEnvironment
import com.tangem.tap.network.exchangeServices.mercuryo.MercuryoService
import com.tangem.tap.network.exchangeServices.moonpay.MoonPayService
import com.tangem.tap.preferencesStorage
import com.tangem.tap.proxy.redux.DaggerGraphState
import com.tangem.tap.scope
import com.tangem.tap.store
import com.tangem.tap.walletCurrenciesManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
@ -130,8 +127,7 @@ private fun handleAction(action: Action, appState: () -> AppState?) {
scope.launch {
val scanResponseProvider: () -> ScanResponse? = {
store.state.globalState.scanResponse
?: store.state.globalState.onboardingState.onboardingManager?.scanResponse
userWalletsListManager.selectedUserWalletSync?.scanResponse
}
val cardProvider: () -> CardDTO? = { scanResponseProvider.invoke()?.card }

View file

@ -8,7 +8,7 @@ import com.tangem.common.card.EncryptionMode
import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.crypto.hdWallet.bip32.ExtendedPublicKey
import com.tangem.operations.attestation.Attestation
import java.util.*
import java.util.Date
import com.tangem.common.card.FirmwareVersion as SdkFirmwareVersion
// TODO: Move to :domain:card:models
@ -69,9 +69,7 @@ data class CardDTO(
if (isPasscodeSet != other.isPasscodeSet) return false
if (supportedCurves != other.supportedCurves) return false
if (wallets != other.wallets) return false
if (attestation != other.attestation) return false
return true
return attestation == other.attestation
}
override fun hashCode(): Int {
@ -210,9 +208,7 @@ data class CardDTO(
if (other !is Issuer) return false
if (name != other.name) return false
if (!publicKey.contentEquals(other.publicKey)) return false
return true
return publicKey.contentEquals(other.publicKey)
}
override fun hashCode(): Int {
@ -234,7 +230,7 @@ data class CardDTO(
val hasBackup: Boolean,
val derivedKeys: Map<DerivationPath, ExtendedPublicKey>,
val extendedPublicKey: ExtendedPublicKey?,
val isImported: Boolean,
val isImported: Boolean = false,
) {
constructor(wallet: CardWallet) : this(
publicKey = wallet.publicKey,
@ -268,9 +264,7 @@ data class CardDTO(
if (remainingSignatures != other.remainingSignatures) return false
if (index != other.index) return false
if (hasBackup != other.hasBackup) return false
if (isImported != other.isImported) return false
return true
return isImported == other.isImported
}
override fun hashCode(): Int {

View file

@ -75,8 +75,6 @@ private fun CounterAndAwards(purchasedWalletCount: Int, expectedAwards: Expected
if (expectedAwards != null) {
Awards(expectedAwards)
} else if (purchasedWalletCount != 0) {
EmptyUpcomingPayments()
}
}
}
@ -96,7 +94,7 @@ private fun Counter(purchasedWalletCount: Int, expectedAwards: ExpectedAwards?)
),
endTextColor = TangemTheme.colors.text.primary1,
endTextStyle = TangemTheme.typography.body2,
cornersToRound = if (isExpectedAwardsPresent || purchasedWalletCount != 0) {
cornersToRound = if (isExpectedAwardsPresent) {
CornersToRound.TOP_2
} else {
CornersToRound.ALL_4
@ -160,23 +158,6 @@ private fun Awards(expectedAwards: ExpectedAwards) {
}
}
@Composable
private fun EmptyUpcomingPayments() {
Divider(
color = TangemTheme.colors.stroke.primary,
thickness = TangemTheme.dimens.size0_5,
)
AwardText(
startText = stringResource(id = R.string.referral_expected_awards),
startTextColor = TangemTheme.colors.text.tertiary,
startTextStyle = TangemTheme.typography.subtitle2,
endText = "",
endTextColor = TangemTheme.colors.text.tertiary,
endTextStyle = TangemTheme.typography.body2,
cornersToRound = CornersToRound.BOTTOM_2,
)
}
@Composable
private fun LessMoreButton(isExpanded: MutableState<Boolean>) {
Surface(

View file

@ -76,6 +76,7 @@ import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.math.BigDecimal
import javax.inject.Inject
import kotlin.properties.Delegates
@ -507,7 +508,8 @@ internal class WalletViewModel @Inject constructor(
viewModelScope.launch(dispatchers.main) {
val userWallet = state.walletsListConfig.wallets[index]
launch(dispatchers.io) {
withContext(dispatchers.io) {
selectWalletUseCase(userWallet.id)
}