From 1ecacbea51d2adb7d009d6c9701fe24663066bc2 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Apr 2025 19:30:04 +0500 Subject: [PATCH 1/4] Updated on 2026-08-14 --- .../java/com/tangem/tap/common/extensions/Store.kt | 4 ---- .../tangem/tap/common/redux/global/GlobalAction.kt | 2 -- .../java/com/tangem/tap/features/demo/DemoHelper.kt | 12 ++++++++++-- features/wallet-settings/impl/build.gradle.kts | 1 + .../preview/PreviewWalletSettingsComponent.kt | 1 + .../walletsettings/model/WalletSettingsModel.kt | 13 +++++++++++++ .../feature/walletsettings/utils/ItemsBuilder.kt | 6 +++++- 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt index b86d13b6e9..919c21972d 100644 --- a/app/src/main/java/com/tangem/tap/common/extensions/Store.kt +++ b/app/src/main/java/com/tangem/tap/common/extensions/Store.kt @@ -39,10 +39,6 @@ suspend fun Store<*>.dispatchWithMain(action: Action) { } } -fun Store<*>.dispatchNotification(resId: Int) { - dispatchOnMain(GlobalAction.ShowNotification(resId)) -} - suspend fun Store.onUserWalletSelected(userWallet: UserWallet) { state.globalState.tapWalletManager.onWalletSelected(userWallet) } diff --git a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt index 108d722975..1c984ff096 100644 --- a/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt +++ b/app/src/main/java/com/tangem/tap/common/redux/global/GlobalAction.kt @@ -7,7 +7,6 @@ import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.redux.StateDialog import com.tangem.tap.common.redux.DebugErrorAction import com.tangem.tap.common.redux.ErrorAction -import com.tangem.tap.common.redux.NotificationAction import com.tangem.tap.domain.TapError import com.tangem.tap.features.onboarding.products.wallet.redux.BackupStartedSource import org.rekotlin.Action @@ -15,7 +14,6 @@ import org.rekotlin.Action sealed class GlobalAction : Action { // notifications - data class ShowNotification(override val messageResource: Int) : GlobalAction(), NotificationAction data class ShowErrorNotification(override val error: TapError) : GlobalAction(), ErrorAction data class DebugShowErrorNotification(override val error: TapError) : GlobalAction(), DebugErrorAction diff --git a/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt b/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt index c8576de418..4895cd65b9 100644 --- a/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt +++ b/app/src/main/java/com/tangem/tap/features/demo/DemoHelper.kt @@ -1,11 +1,14 @@ package com.tangem.tap.features.demo +import com.tangem.core.ui.extensions.resourceReference +import com.tangem.core.ui.message.DialogMessage import com.tangem.domain.demo.DemoConfig import com.tangem.domain.models.scan.ScanResponse -import com.tangem.tap.common.extensions.dispatchNotification +import com.tangem.tap.common.extensions.inject import com.tangem.tap.common.redux.AppState import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction import com.tangem.tap.features.onboarding.products.wallet.redux.BackupAction +import com.tangem.tap.proxy.redux.DaggerGraphState import com.tangem.tap.store import com.tangem.wallet.R import org.rekotlin.Action @@ -37,7 +40,12 @@ object DemoHelper { } disabledActionFeatures.firstOrNull { it == action::class.java }?.let { - store.dispatchNotification(R.string.alert_demo_feature_disabled) + val uiMessageSender = store.inject(DaggerGraphState::uiMessageSender) + uiMessageSender.send( + DialogMessage( + message = resourceReference(R.string.alert_demo_feature_disabled), + ), + ) return true } diff --git a/features/wallet-settings/impl/build.gradle.kts b/features/wallet-settings/impl/build.gradle.kts index 0cfc119783..25dc7dd5c6 100644 --- a/features/wallet-settings/impl/build.gradle.kts +++ b/features/wallet-settings/impl/build.gradle.kts @@ -33,6 +33,7 @@ dependencies { implementation(projects.domain.models) implementation(projects.domain.wallets) implementation(projects.domain.wallets.models) + implementation(projects.domain.demo) /* AndroidX */ implementation(deps.androidx.fragment.ktx) diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/component/preview/PreviewWalletSettingsComponent.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/component/preview/PreviewWalletSettingsComponent.kt index 4e77769e0d..40383c55b5 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/component/preview/PreviewWalletSettingsComponent.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/component/preview/PreviewWalletSettingsComponent.kt @@ -29,6 +29,7 @@ internal class PreviewWalletSettingsComponent : WalletSettingsComponent { renameWallet = {}, forgetWallet = {}, onLinkMoreCardsClick = {}, + onReferralClick = {}, isManageTokensAvailable = true, ), ) diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt index cc48296697..33f0abba3e 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt @@ -16,6 +16,7 @@ import com.tangem.core.ui.message.DialogMessage import com.tangem.core.ui.message.EventMessageAction import com.tangem.core.ui.message.SnackbarMessage import com.tangem.domain.common.util.cardTypesResolver +import com.tangem.domain.demo.IsDemoCardUseCase import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.redux.LegacyAction @@ -56,6 +57,7 @@ internal class WalletSettingsModel @Inject constructor( private val analyticsContextProxy: AnalyticsContextProxy, private val reduxStateHolder: ReduxStateHolder, private val getShouldSaveUserWalletsSyncUseCase: ShouldSaveUserWalletsSyncUseCase, + private val isDemoCardUseCase: IsDemoCardUseCase, private val walletsRepository: WalletsRepository, private val nftFeatureToggles: NFTFeatureToggles, private val onboardingV2FeatureToggles: OnboardingV2FeatureToggles, @@ -127,6 +129,7 @@ internal class WalletSettingsModel @Inject constructor( onLinkMoreCardsClick = { onLinkMoreCardsClick(scanResponse = userWallet.scanResponse) }, + onReferralClick = { onReferralClick(userWallet) }, ) private fun openRenameWalletDialog(userWallet: UserWallet, dialogNavigation: SlotNavigation) { @@ -188,4 +191,14 @@ internal class WalletSettingsModel @Inject constructor( } } } + + private fun onReferralClick(userWallet: UserWallet) { + if (isDemoCardUseCase(userWallet.cardId)) { + messageSender.send( + DialogMessage(message = resourceReference(R.string.alert_demo_feature_disabled)), + ) + } else { + router.push(AppRoute.ReferralProgram(userWallet.walletId)) + } + } } \ No newline at end of file diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/utils/ItemsBuilder.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/utils/ItemsBuilder.kt index 75fbbc0e4b..39670ae4c1 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/utils/ItemsBuilder.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/utils/ItemsBuilder.kt @@ -37,6 +37,7 @@ internal class ItemsBuilder @Inject constructor( forgetWallet: () -> Unit, renameWallet: () -> Unit, onLinkMoreCardsClick: () -> Unit, + onReferralClick: () -> Unit, ): PersistentList = persistentListOf() .add(buildNameItem(userWalletName, isRenameWalletAvailable, renameWallet)) .run { @@ -53,6 +54,7 @@ internal class ItemsBuilder @Inject constructor( isReferralAvailable = isReferralAvailable, isManageTokensAvailable = isManageTokensAvailable, onLinkMoreCardsClick = onLinkMoreCardsClick, + onReferralClick = onReferralClick, ), ) .add(buildForgetItem(forgetWallet)) @@ -74,12 +76,14 @@ internal class ItemsBuilder @Inject constructor( onCheckedChange = onCheckedNFTChange, ) + @Suppress("LongParameterList") private fun buildCardItem( userWalletId: UserWalletId, isLinkMoreCardsAvailable: Boolean, isReferralAvailable: Boolean, isManageTokensAvailable: Boolean, onLinkMoreCardsClick: () -> Unit, + onReferralClick: () -> Unit, ) = WalletSettingsItemUM.WithItems( id = "card", description = resourceReference(R.string.settings_card_settings_footer), @@ -113,7 +117,7 @@ internal class ItemsBuilder @Inject constructor( BlockUM( text = resourceReference(R.string.details_referral_title), iconRes = R.drawable.ic_add_friends_24, - onClick = { router.push(AppRoute.ReferralProgram(userWalletId)) }, + onClick = onReferralClick, ).let(::add) } }.toImmutableList(), From 8100780f5642d2df57f132b517241eeb44f5a2fb Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Apr 2025 17:59:22 +0300 Subject: [PATCH 2/4] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 76affe35f0..103677488a 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,7 +5,7 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1043" +tangemBlockchainSdk = "releases-5.23-1045" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "releases-5.23-456" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ From 4d90ec558cba6f4543262b1afc0b0fa0c9aaca52 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Apr 2025 21:00:37 +0300 Subject: [PATCH 3/4] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 103677488a..8c55070de7 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,7 +5,7 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1045" +tangemBlockchainSdk = "releases-5.23-1048" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "releases-5.23-456" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ From 0b6bcd7998fb4fcab705307338e961afb59244df Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 24 Apr 2025 18:01:01 +0000 Subject: [PATCH 4/4] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 8c55070de7..a0bc01da42 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,9 +5,9 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1048" +tangemBlockchainSdk = "develop-1042" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds -tangemCardSdk = "releases-5.23-456" +tangemCardSdk = "develop-455" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ tangemVico = "2.0.0-alpha.25-tangem12" #tangemVico = "0.0.1" # Keep it! - used for local builds ^ @@ -21,4 +21,4 @@ card-core = { module = "com.tangem.tangem-sdk-kotlin:core", version.ref = "tange vico-compose = { group = "com.tangem.vico", name = "compose", version.ref = "tangemVico" } vico-compose-m3 = { group = "com.tangem.vico", name = "compose-m3", version.ref = "tangemVico" } -vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } +vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } \ No newline at end of file