Updated on 2026-08-14
This commit is contained in:
parent
d2d9669097
commit
207da4af08
5 changed files with 62 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package com.tangem.tap
|
|||
import com.tangem.TangemSdkLogger
|
||||
import com.tangem.blockchainsdk.BlockchainSDKFactory
|
||||
import com.tangem.blockchainsdk.signer.TransactionSignerFactory
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.common.routing.AppRouter
|
||||
import com.tangem.core.analytics.filter.OneTimeEventFilter
|
||||
import com.tangem.core.configtoggle.blockchain.ExcludedBlockchainsManager
|
||||
|
|
@ -119,4 +120,6 @@ interface ApplicationEntryPoint {
|
|||
fun getOnboardingV2FeatureToggles(): OnboardingV2FeatureToggles
|
||||
|
||||
fun getCoroutineDispatcherProvider(): CoroutineDispatcherProvider
|
||||
|
||||
fun getExcludedBlockchains(): ExcludedBlockchains
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import com.tangem.TangemSdkLogger
|
|||
import com.tangem.blockchain.network.BlockchainSdkRetrofitBuilder
|
||||
import com.tangem.blockchainsdk.BlockchainSDKFactory
|
||||
import com.tangem.blockchainsdk.signer.TransactionSignerFactory
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.common.routing.AppRouter
|
||||
import com.tangem.core.analytics.Analytics
|
||||
import com.tangem.core.analytics.api.ParamsInterceptor
|
||||
|
|
@ -189,6 +190,9 @@ abstract class TangemApplication : Application(), ImageLoaderFactory {
|
|||
|
||||
private val dispatchers: CoroutineDispatcherProvider
|
||||
get() = entryPoint.getCoroutineDispatcherProvider()
|
||||
|
||||
private val excludedBlockchains: ExcludedBlockchains
|
||||
get() = entryPoint.getExcludedBlockchains()
|
||||
// endregion
|
||||
|
||||
override fun onCreate() {
|
||||
|
|
@ -269,6 +273,7 @@ abstract class TangemApplication : Application(), ImageLoaderFactory {
|
|||
onrampFeatureToggles = onrampFeatureToggles,
|
||||
environmentConfigStorage = environmentConfigStorage,
|
||||
onboardingV2FeatureToggles = onboardingV2FeatureToggles,
|
||||
excludedBlockchains = excludedBlockchains,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.tap.proxy.redux
|
|||
|
||||
import com.tangem.blockchainsdk.BlockchainSDKFactory
|
||||
import com.tangem.blockchainsdk.signer.TransactionSignerFactory
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.common.routing.AppRouter
|
||||
import com.tangem.core.navigation.share.ShareManager
|
||||
import com.tangem.core.navigation.url.UrlOpener
|
||||
|
|
@ -71,4 +72,5 @@ data class DaggerGraphState(
|
|||
val onrampFeatureToggles: OnrampFeatureToggles? = null,
|
||||
val environmentConfigStorage: EnvironmentConfigStorage? = null,
|
||||
val onboardingV2FeatureToggles: OnboardingV2FeatureToggles? = null,
|
||||
val excludedBlockchains: ExcludedBlockchains? = null,
|
||||
) : StateType
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.tangem.blockchainsdk.di
|
||||
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.core.configtoggle.blockchain.ExcludedBlockchainsManager
|
||||
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 ExcludedBlockchainsModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
fun bindExcludedBlockchains(excludedBlockchainsManager: ExcludedBlockchainsManager): ExcludedBlockchains {
|
||||
return ExcludedBlockchains(excludedBlockchainsManager)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.tangem.blockchainsdk.utils
|
||||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.core.configtoggle.blockchain.ExcludedBlockchainsManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class ExcludedBlockchains @Inject internal constructor(
|
||||
private val excludedBlockchainsManager: ExcludedBlockchainsManager,
|
||||
) : Set<Blockchain> {
|
||||
|
||||
private val excludedBlockchains: Set<Blockchain> by lazy(mode = LazyThreadSafetyMode.NONE) {
|
||||
excludedBlockchainsManager.excludedBlockchainsIds.fold(mutableSetOf()) { acc, blockchainId ->
|
||||
val blockchain = Blockchain.fromId(blockchainId)
|
||||
acc.add(blockchain)
|
||||
|
||||
blockchain.getTestnetVersion()?.let { acc.add(it) }
|
||||
|
||||
acc
|
||||
}
|
||||
}
|
||||
|
||||
override val size: Int
|
||||
get() = excludedBlockchains.size
|
||||
|
||||
override fun contains(element: Blockchain): Boolean = excludedBlockchains.contains(element)
|
||||
|
||||
override fun containsAll(elements: Collection<Blockchain>): Boolean = excludedBlockchains.containsAll(elements)
|
||||
|
||||
override fun isEmpty(): Boolean = excludedBlockchains.isEmpty()
|
||||
|
||||
override fun iterator(): Iterator<Blockchain> = excludedBlockchains.iterator()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue