diff --git a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalMiddleware.kt b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalMiddleware.kt index 2092947970..b27f2e9aa5 100644 --- a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalMiddleware.kt @@ -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 } diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt index c59c926791..2616cdf4e0 100644 --- a/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt +++ b/domain/models/src/main/kotlin/com/tangem/domain/models/scan/CardDTO.kt @@ -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, 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 { diff --git a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ParticipateBottomBlock.kt b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ParticipateBottomBlock.kt index fb387358c1..57337c925a 100644 --- a/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ParticipateBottomBlock.kt +++ b/features/referral/presentation/src/main/java/com/tangem/feature/referral/ui/ParticipateBottomBlock.kt @@ -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) { Surface( diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt index 2b99a83f0a..e294047072 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt @@ -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) }