diff --git a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/DefaultLegacyWalletConnectRepository.kt b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/DefaultLegacyWalletConnectRepository.kt index 776836a294..b9b647d647 100644 --- a/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/DefaultLegacyWalletConnectRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/walletconnect2/data/DefaultLegacyWalletConnectRepository.kt @@ -19,6 +19,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import timber.log.Timber +@Suppress("LargeClass") internal class DefaultLegacyWalletConnectRepository( private val application: Application, private val wcRequestDeserializer: WcJrpcRequestsDeserializer, @@ -72,19 +73,23 @@ internal class DefaultLegacyWalletConnectRepository( } } - WalletKit.initialize(Wallet.Params.Init(core = CoreClient)) { error -> - Timber.e("Error while initializing Web3Wallet: $error") - scope.launch { - _events.emit( - WalletConnectEvents.SessionApprovalError( - WalletConnectError.ExternalApprovalError(error.throwable.message), - ), - ) - } - } - - val walletDelegate = defineWalletDelegate() - WalletKit.setWalletDelegate(walletDelegate) + WalletKit.initialize( + Wallet.Params.Init(core = CoreClient), + onSuccess = { + val walletDelegate = defineWalletDelegate() + WalletKit.setWalletDelegate(walletDelegate) + }, + onError = { error -> + Timber.e("Error while initializing Web3Wallet: $error") + scope.launch { + _events.emit( + WalletConnectEvents.SessionApprovalError( + WalletConnectError.ExternalApprovalError(error.throwable.message), + ), + ) + } + }, + ) } private fun defineWalletDelegate(): WalletKit.WalletDelegate { diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/datastore/RuntimeStateStore.kt b/core/datasource/src/main/java/com/tangem/datasource/local/datastore/RuntimeStateStore.kt index 428169c98e..b28130b286 100644 --- a/core/datasource/src/main/java/com/tangem/datasource/local/datastore/RuntimeStateStore.kt +++ b/core/datasource/src/main/java/com/tangem/datasource/local/datastore/RuntimeStateStore.kt @@ -2,6 +2,7 @@ package com.tangem.datasource.local.datastore import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.update /** * Runtime store @@ -16,6 +17,8 @@ interface RuntimeStateStore { /** Store [value] */ suspend fun store(value: T) + suspend fun update(function: (T) -> T) + companion object { /** @@ -32,6 +35,10 @@ interface RuntimeStateStore { override suspend fun store(value: T) { flow.value = value } + + override suspend fun update(function: (T) -> T) { + flow.update(function) + } } } } \ No newline at end of file diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt index 220b5c82ca..7aeca782bf 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/transactions/TransactionList.kt @@ -1,6 +1,5 @@ package com.tangem.core.ui.components.transactions -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -119,13 +118,12 @@ private fun PendingTxsBlock(pendingTxs: ImmutableList, isBalan } } -@OptIn(ExperimentalFoundationApi::class) private fun LazyListScope.nonContentItem(state: EmptyTransactionsBlockState, modifier: Modifier = Modifier) { item(key = state::class.java, contentType = state::class.java) { EmptyTransactionBlock( state = state, modifier = modifier - .animateItemPlacement() + .animateItem(fadeInSpec = null, fadeOutSpec = null) .padding(horizontal = TangemTheme.dimens.spacing16, vertical = TangemTheme.dimens.spacing12) .fillMaxWidth(), ) diff --git a/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt b/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt index 1b4083ad77..c6e3354caa 100644 --- a/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt +++ b/data/wallets/src/main/java/com/tangem/data/wallets/DefaultWalletsRepository.kt @@ -20,13 +20,14 @@ import com.tangem.utils.coroutines.runCatching import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch internal class DefaultWalletsRepository( private val appPreferencesStore: AppPreferencesStore, private val tangemTechApi: TangemTechApi, private val userWalletsStore: UserWalletsStore, - private val seedPhraseNotificationVisibilityStore: RuntimeStateStore, + private val seedPhraseNotificationVisibilityStore: RuntimeStateStore>, private val dispatchers: CoroutineDispatcherProvider, ) : WalletsRepository { @@ -59,7 +60,9 @@ internal class DefaultWalletsRepository( override fun seedPhraseNotificationStatus(userWalletId: UserWalletId): Flow { return channelFlow { launch { - seedPhraseNotificationVisibilityStore.get().collectLatest(::send) + seedPhraseNotificationVisibilityStore.get() + .map { it.getOrDefault(key = userWalletId, defaultValue = false) } + .collectLatest(::send) } fetchSeedPhraseNotificationStatus(userWalletId) @@ -81,7 +84,7 @@ internal class DefaultWalletsRepository( ) } - seedPhraseNotificationVisibilityStore.store(value = status) + updateNotificationVisibility(id = userWalletId, value = status) } override suspend fun notifiedSeedPhraseNotification(userWalletId: UserWalletId) { @@ -101,7 +104,7 @@ internal class DefaultWalletsRepository( ).getOrThrow() } - seedPhraseNotificationVisibilityStore.store(value = false) + updateNotificationVisibility(id = userWalletId, value = false) } override suspend fun declineSeedPhraseNotification(userWalletId: UserWalletId) { @@ -112,7 +115,7 @@ internal class DefaultWalletsRepository( ).getOrThrow() } - seedPhraseNotificationVisibilityStore.store(value = false) + updateNotificationVisibility(id = userWalletId, value = false) } override suspend fun markWallet2WasCreated(userWalletId: UserWalletId) { @@ -122,4 +125,12 @@ internal class DefaultWalletsRepository( ) } } + + private suspend fun updateNotificationVisibility(id: UserWalletId, value: Boolean) { + return seedPhraseNotificationVisibilityStore.update { + it.toMutableMap().apply { + this[id] = value + } + } + } } \ No newline at end of file diff --git a/data/wallets/src/main/java/com/tangem/data/wallets/di/WalletsDataModule.kt b/data/wallets/src/main/java/com/tangem/data/wallets/di/WalletsDataModule.kt index 20cf86eaa0..778257f353 100644 --- a/data/wallets/src/main/java/com/tangem/data/wallets/di/WalletsDataModule.kt +++ b/data/wallets/src/main/java/com/tangem/data/wallets/di/WalletsDataModule.kt @@ -31,7 +31,7 @@ internal object WalletsDataModule { appPreferencesStore = appPreferencesStore, tangemTechApi = tangemTechApi, userWalletsStore = userWalletsStore, - seedPhraseNotificationVisibilityStore = RuntimeStateStore(defaultValue = false), + seedPhraseNotificationVisibilityStore = RuntimeStateStore(defaultValue = emptyMap()), dispatchers = dispatchers, ) } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/common/Notifications.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/common/Notifications.kt index 501c61649f..87d8645108 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/common/Notifications.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/common/Notifications.kt @@ -1,6 +1,5 @@ package com.tangem.features.send.impl.presentation.ui.common -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.foundation.lazy.itemsIndexed @@ -10,7 +9,6 @@ import com.tangem.core.ui.components.notifications.Notification import com.tangem.core.ui.res.TangemTheme import kotlinx.collections.immutable.ImmutableList -@OptIn(ExperimentalFoundationApi::class) internal fun LazyListScope.notifications( notifications: ImmutableList, modifier: Modifier = Modifier, @@ -31,7 +29,7 @@ internal fun LazyListScope.notifications( config = item.config, modifier = modifier .padding(top = topPadding) - .animateItemPlacement(), + .animateItem(fadeInSpec = null, fadeOutSpec = null), containerColor = when (item) { is NotificationUM.Error.TokenExceedsBalance, is NotificationUM.Warning.NetworkFeeUnreachable, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/Wallet2CobrandImage.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/Wallet2CobrandImage.kt index 80663dd7de..5f66d5f11c 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/Wallet2CobrandImage.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/Wallet2CobrandImage.kt @@ -85,6 +85,12 @@ internal enum class Wallet2CobrandImage( batchIds = setOf("AF32"), ), + GetsMine( + cards2ResId = R.drawable.ill_gets_mine_card2_120_106, + cards3ResId = R.drawable.ill_gets_mine_card3_120_106, + batchIds = setOf("BB000008"), + ), + Grim( cards2ResId = R.drawable.ill_grim_card2_120_106, cards3ResId = R.drawable.ill_grim_card3_120_106, @@ -194,6 +200,12 @@ internal enum class Wallet2CobrandImage( batchIds = setOf("AF07"), ), + USA( + cards2ResId = R.drawable.ill_usa_card2_120_106, + cards3ResId = R.drawable.ill_usa_card3_120_106, + batchIds = setOf("AF91"), + ), + VeChain( cards2ResId = R.drawable.ill_vechain_card2_120_106, cards3ResId = R.drawable.ill_vechain_card3_120_106, @@ -218,4 +230,10 @@ internal enum class Wallet2CobrandImage( cards3ResId = R.drawable.ill_white_card3_120_106, batchIds = setOf("AF15"), ), + + Winter( + cards2ResId = R.drawable.ill_winter_card2_120_106, + cards3ResId = R.drawable.ill_winter_card3_120_106, + batchIds = setOf("AF85", "AF86", "AF87", "AF990013", "AF990012", "AF990011"), + ), } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletActionButtons.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletActionButtons.kt index e661d9994e..caba2bb717 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletActionButtons.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletActionButtons.kt @@ -35,7 +35,7 @@ internal fun LazyListScope.lazyActions( item(key = ACTIONS_CONTENT_TYPE + selectedWalletIndex, contentType = ACTIONS_CONTENT_TYPE) { HorizontalActionChips( buttons = actions.map(WalletManageButton::config).toImmutableList(), - modifier = modifier.animateItem(), + modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null), contentPadding = PaddingValues(horizontal = TangemTheme.dimens.spacing16), ) } @@ -62,7 +62,7 @@ internal fun LazyListScope.actions( modifier = modifier .padding(horizontal = 16.dp) .fillMaxWidth() - .animateItem(), + .animateItem(fadeInSpec = null, fadeOutSpec = null), horizontalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing8), verticalAlignment = Alignment.CenterVertically, ) { diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletNotifications.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletNotifications.kt index de41263c1e..81ea0beb94 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletNotifications.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/common/WalletNotifications.kt @@ -30,25 +30,25 @@ internal fun LazyListScope.notifications(configs: ImmutableList { OkxPromoNotification( config = it.config, - modifier = modifier.animateItem(), + modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null), ) } is WalletNotification.RingPromo -> { RingPromoNotification( config = it.config, - modifier = modifier.animateItem(), + modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null), ) } is WalletNotification.NoteMigration -> { NoteMigrationNotification( config = it.config, - modifier = modifier.animateItem(), + modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null), ) } else -> { Notification( config = it.config, - modifier = modifier.animateItem(), + modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null), iconTint = when (it) { is WalletNotification.Critical -> TangemTheme.colors.icon.warning is WalletNotification.Informational -> TangemTheme.colors.icon.accent diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyContent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyContent.kt index e4293a0ec9..dd27fcfa85 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyContent.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/multicurrency/MultiCurrencyContent.kt @@ -78,7 +78,7 @@ private fun LazyListScope.nonContentItem(modifier: Modifier = Modifier) { ) { Column( modifier = modifier - .animateItem() + .animateItem(fadeInSpec = null, fadeOutSpec = null) .padding(top = TangemTheme.dimens.spacing96), verticalArrangement = Arrangement.spacedBy(space = TangemTheme.dimens.spacing16), horizontalAlignment = Alignment.CenterHorizontally, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/SingleCurrencyMarketPriceBlock.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/SingleCurrencyMarketPriceBlock.kt index 12d9b505b7..7e3b3b1f0e 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/SingleCurrencyMarketPriceBlock.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/ui/components/singlecurrency/SingleCurrencyMarketPriceBlock.kt @@ -1,6 +1,5 @@ package com.tangem.feature.wallet.presentation.wallet.ui.components.singlecurrency -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.lazy.LazyListScope import androidx.compose.ui.Modifier import com.tangem.core.ui.components.marketprice.MarketPriceBlock @@ -14,12 +13,11 @@ import com.tangem.core.ui.components.marketprice.MarketPriceBlockState * [REDACTED_AUTHOR] */ -@OptIn(ExperimentalFoundationApi::class) internal fun LazyListScope.marketPriceBlock(state: MarketPriceBlockState, modifier: Modifier = Modifier) { item( key = MarketPriceBlockState::class.java, contentType = MarketPriceBlockState::class.java, ) { - MarketPriceBlock(state = state, modifier = modifier.animateItemPlacement()) + MarketPriceBlock(state = state, modifier = modifier.animateItem(fadeInSpec = null, fadeOutSpec = null)) } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card2_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card2_120_106.webp new file mode 100644 index 0000000000..a03ba458fe Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card2_120_106.webp differ diff --git a/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card3_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card3_120_106.webp new file mode 100644 index 0000000000..3972ab0e8c Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_gets_mine_card3_120_106.webp differ diff --git a/features/wallet/impl/src/main/res/drawable/ill_usa_card2_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_usa_card2_120_106.webp new file mode 100644 index 0000000000..66d4424a6d Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_usa_card2_120_106.webp differ diff --git a/features/wallet/impl/src/main/res/drawable/ill_usa_card3_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_usa_card3_120_106.webp new file mode 100644 index 0000000000..5bec154ca9 Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_usa_card3_120_106.webp differ diff --git a/features/wallet/impl/src/main/res/drawable/ill_winter_card2_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_winter_card2_120_106.webp new file mode 100644 index 0000000000..8fc68f56b1 Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_winter_card2_120_106.webp differ diff --git a/features/wallet/impl/src/main/res/drawable/ill_winter_card3_120_106.webp b/features/wallet/impl/src/main/res/drawable/ill_winter_card3_120_106.webp new file mode 100644 index 0000000000..1387583dfd Binary files /dev/null and b/features/wallet/impl/src/main/res/drawable/ill_winter_card3_120_106.webp differ