From 092ad9d6c4b7410f4f7a0a58602b95e4cf8bd3a3 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 24 May 2024 15:33:50 +0400 Subject: [PATCH] Updated on 2026-08-14 --- app/build.gradle.kts | 1 + .../di/domain/WalletConnectDomainModule.kt | 22 +++++++++++++++++++ domain/wallet-connect/.gitignore | 1 + domain/wallet-connect/build.gradle.kts | 10 +++++++++ .../CheckIsWalletConnectAvailableUseCase.kt | 14 ++++++++++++ .../repository/WalletConnectRepository.kt | 8 +++++++ settings.gradle.kts | 1 + 7 files changed, 57 insertions(+) create mode 100644 app/src/main/java/com/tangem/tap/di/domain/WalletConnectDomainModule.kt create mode 100644 domain/wallet-connect/.gitignore create mode 100644 domain/wallet-connect/build.gradle.kts create mode 100644 domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/CheckIsWalletConnectAvailableUseCase.kt create mode 100644 domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/repository/WalletConnectRepository.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7103b16c66..5c4aaaac37 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -68,6 +68,7 @@ dependencies { implementation(projects.domain.qrScanning) implementation(projects.domain.qrScanning.models) implementation(projects.domain.staking) + implementation(projects.domain.walletConnect) implementation(projects.common) implementation(projects.core.analytics) diff --git a/app/src/main/java/com/tangem/tap/di/domain/WalletConnectDomainModule.kt b/app/src/main/java/com/tangem/tap/di/domain/WalletConnectDomainModule.kt new file mode 100644 index 0000000000..e542ddc5fd --- /dev/null +++ b/app/src/main/java/com/tangem/tap/di/domain/WalletConnectDomainModule.kt @@ -0,0 +1,22 @@ +package com.tangem.tap.di.domain + +import com.tangem.domain.walletconnect.CheckIsWalletConnectAvailableUseCase +import com.tangem.domain.walletconnect.repository.WalletConnectRepository +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +internal object WalletConnectDomainModule { + + @Provides + @Singleton + fun providesCheckIsWalletConnectAvailableUseCase( + walletConnectRepository: WalletConnectRepository, + ): CheckIsWalletConnectAvailableUseCase { + return CheckIsWalletConnectAvailableUseCase(walletConnectRepository = walletConnectRepository) + } +} \ No newline at end of file diff --git a/domain/wallet-connect/.gitignore b/domain/wallet-connect/.gitignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/domain/wallet-connect/.gitignore @@ -0,0 +1 @@ +/build diff --git a/domain/wallet-connect/build.gradle.kts b/domain/wallet-connect/build.gradle.kts new file mode 100644 index 0000000000..af72640fab --- /dev/null +++ b/domain/wallet-connect/build.gradle.kts @@ -0,0 +1,10 @@ +plugins { + alias(deps.plugins.kotlin.jvm) + id("configuration") +} + +dependencies { + /* Project - Domain */ + implementation(projects.domain.core) + implementation(projects.domain.wallets.models) +} \ No newline at end of file diff --git a/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/CheckIsWalletConnectAvailableUseCase.kt b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/CheckIsWalletConnectAvailableUseCase.kt new file mode 100644 index 0000000000..698fc71f7c --- /dev/null +++ b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/CheckIsWalletConnectAvailableUseCase.kt @@ -0,0 +1,14 @@ +package com.tangem.domain.walletconnect + +import arrow.core.Either +import com.tangem.domain.walletconnect.repository.WalletConnectRepository +import com.tangem.domain.wallets.models.UserWalletId + +class CheckIsWalletConnectAvailableUseCase( + private val walletConnectRepository: WalletConnectRepository, +) { + + suspend operator fun invoke(userWalletId: UserWalletId): Either { + return Either.catch { walletConnectRepository.checkIsAvailable(userWalletId) } + } +} \ No newline at end of file diff --git a/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/repository/WalletConnectRepository.kt b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/repository/WalletConnectRepository.kt new file mode 100644 index 0000000000..8e2605d780 --- /dev/null +++ b/domain/wallet-connect/src/main/kotlin/com/tangem/domain/walletconnect/repository/WalletConnectRepository.kt @@ -0,0 +1,8 @@ +package com.tangem.domain.walletconnect.repository + +import com.tangem.domain.wallets.models.UserWalletId + +interface WalletConnectRepository { + + suspend fun checkIsAvailable(userWalletId: UserWalletId): Boolean +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 6412e9236b..6977617dc4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -191,6 +191,7 @@ include(":domain:feedback") include(":domain:qr-scanning") include(":domain:qr-scanning:models") include(":domain:staking") +include(":domain:wallet-connect") // endregion Domain modules // region Data modules