Updated on 2026-08-14
This commit is contained in:
commit
8148f32272
642 changed files with 10717 additions and 5789 deletions
|
|
@ -1,19 +0,0 @@
|
|||
package com.tangem.tap.network.auth
|
||||
|
||||
import com.tangem.datasource.api.common.visa.TangemVisaAuthProvider
|
||||
import com.tangem.domain.visa.model.VisaCardActivationStatus
|
||||
import com.tangem.domain.visa.model.getAuthHeader
|
||||
import com.tangem.domain.wallets.legacy.UserWalletsListManager
|
||||
import javax.inject.Inject
|
||||
|
||||
internal class DefaultVisaAuthProvider @Inject constructor(
|
||||
private val userWalletsListManager: UserWalletsListManager,
|
||||
) : TangemVisaAuthProvider {
|
||||
|
||||
override suspend fun getAuthHeader(cardId: String): String {
|
||||
val card = userWalletsListManager.userWalletsSync.firstOrNull { it.cardId == cardId }
|
||||
val status = card?.scanResponse?.visaCardActivationStatus as? VisaCardActivationStatus.Activated
|
||||
?: return "Error in the app!"
|
||||
return status.visaAuthTokens.getAuthHeader()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,17 @@
|
|||
package com.tangem.tap.network.auth.di
|
||||
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.common.visa.TangemVisaAuthProvider
|
||||
import com.tangem.datasource.local.config.environment.EnvironmentConfigStorage
|
||||
import com.tangem.datasource.local.preferences.AppPreferencesStore
|
||||
import com.tangem.datasource.local.userwallet.UserWalletsStore
|
||||
import com.tangem.domain.wallets.legacy.UserWalletsListManager
|
||||
import com.tangem.lib.auth.ExpressAuthProvider
|
||||
import com.tangem.lib.auth.StakeKitAuthProvider
|
||||
import com.tangem.tap.network.auth.*
|
||||
import com.tangem.tap.network.auth.DefaultAppVersionProvider
|
||||
import com.tangem.tap.network.auth.DefaultAuthProvider
|
||||
import com.tangem.tap.network.auth.DefaultExpressAuthProvider
|
||||
import com.tangem.tap.network.auth.DefaultStakeKitAuthProvider
|
||||
import com.tangem.tap.network.auth.DefaultVisaAuthProvider
|
||||
import com.tangem.utils.version.AppVersionProvider
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
|
@ -55,13 +51,4 @@ internal class AuthModule {
|
|||
fun provideAppVersionProvider(): AppVersionProvider {
|
||||
return DefaultAppVersionProvider()
|
||||
}
|
||||
}
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
internal interface AuthBindModule {
|
||||
|
||||
@Binds
|
||||
@Singleton
|
||||
fun bindVisaAuthProvider(authStorage: DefaultVisaAuthProvider): TangemVisaAuthProvider
|
||||
}
|
||||
|
|
@ -26,6 +26,7 @@ import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
|||
import com.tangem.utils.coroutines.runCatching
|
||||
import com.tangem.utils.isNullOrZero
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
|
|
@ -135,11 +136,13 @@ internal class DefaultRampManager(
|
|||
cryptoCurrency: CryptoCurrency,
|
||||
): ExchangeableState {
|
||||
return withContext(dispatchers.io) {
|
||||
when (val asset = expressServiceLoader.getInitializationStatus(userWalletId).value) {
|
||||
val initializationStatus = expressServiceLoader.getInitializationStatus(userWalletId).firstOrNull()
|
||||
?: return@withContext ExchangeableState.Loading
|
||||
when (initializationStatus) {
|
||||
is Lce.Error -> ExchangeableState.Error
|
||||
is Lce.Loading -> ExchangeableState.Loading
|
||||
is Lce.Content -> {
|
||||
val foundAsset = asset.getOrNull()?.find { cryptoCurrency.findAssetPredicate(it) }
|
||||
val foundAsset = initializationStatus.getOrNull()?.find { cryptoCurrency.findAssetPredicate(it) }
|
||||
foundAsset?.exchangeAvailable?.toExchangeableState() ?: ExchangeableState.AssetNotFound
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ internal val Blockchain.mercuryoNetwork: String?
|
|||
Blockchain.Bitrock, Blockchain.BitrockTestnet -> null
|
||||
Blockchain.Sonic, Blockchain.SonicTestnet -> null
|
||||
Blockchain.ApeChain, Blockchain.ApeChainTestnet -> null
|
||||
Blockchain.Scroll, Blockchain.ScrollTestnet -> null
|
||||
Blockchain.ZkLinkNova, Blockchain.ZkLinkNovaTestnet -> null
|
||||
Blockchain.KaspaTestnet -> null
|
||||
}
|
||||
}
|
||||
|
|
@ -154,5 +154,7 @@ internal val Blockchain.moonPaySupportedCurrency: MoonPaySupportedCurrency?
|
|||
Bitrock, BitrockTestnet -> null
|
||||
Sonic, SonicTestnet -> null
|
||||
ApeChain, ApeChainTestnet -> null
|
||||
Scroll, ScrollTestnet -> null
|
||||
ZkLinkNova, ZkLinkNovaTestnet -> null
|
||||
KaspaTestnet -> null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue