Updated on 2026-08-14
This commit is contained in:
commit
b6a268645e
11 changed files with 160 additions and 73 deletions
|
|
@ -109,8 +109,16 @@ private fun handlePrivacyAction(action: DetailsAction.AppSettings, state: Detail
|
|||
isHidingEnabled = action.hideBalance,
|
||||
),
|
||||
)
|
||||
// state should be copied to avoid concurrent modifications from different sources
|
||||
is DetailsAction.AppSettings.Prepare -> state.copy(
|
||||
appSettingsState = action.state,
|
||||
appSettingsState = state.appSettingsState.copy(
|
||||
saveWallets = action.state.saveWallets,
|
||||
saveAccessCodes = action.state.saveAccessCodes,
|
||||
isBiometricsAvailable = action.state.isBiometricsAvailable,
|
||||
isHidingEnabled = action.state.isHidingEnabled,
|
||||
selectedAppCurrency = action.state.selectedAppCurrency,
|
||||
selectedThemeMode = action.state.selectedThemeMode,
|
||||
),
|
||||
)
|
||||
is DetailsAction.AppSettings.EnrollBiometrics,
|
||||
is DetailsAction.AppSettings.CheckBiometricsStatus,
|
||||
|
|
|
|||
|
|
@ -51,19 +51,11 @@ interface TangemTechApi {
|
|||
|
||||
/** Returns referral status by [walletId] */
|
||||
@GET("referral/{walletId}")
|
||||
suspend fun getReferralStatus(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("walletId") walletId: String,
|
||||
): ReferralResponse
|
||||
suspend fun getReferralStatus(@Path("walletId") walletId: String): ReferralResponse
|
||||
|
||||
/** Make user referral, requires [StartReferralBody] */
|
||||
@POST("referral")
|
||||
suspend fun startReferral(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body startReferralBody: StartReferralBody,
|
||||
): ReferralResponse
|
||||
suspend fun startReferral(@Body startReferralBody: StartReferralBody): ReferralResponse
|
||||
|
||||
@GET("quotes")
|
||||
suspend fun getQuotes(
|
||||
|
|
@ -79,55 +71,35 @@ interface TangemTechApi {
|
|||
): ApiResponse<PromotionInfoResponse>
|
||||
|
||||
@GET("settings/{wallet_id}")
|
||||
suspend fun getUserTokensSettings(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
): ApiResponse<UserTokensSettingsResponse>
|
||||
suspend fun getUserTokensSettings(@Path("wallet_id") walletId: String): ApiResponse<UserTokensSettingsResponse>
|
||||
|
||||
@PUT("settings/{wallet_id}")
|
||||
suspend fun saveUserTokensSettings(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
@Body userTokensSettings: UserTokensSettingsResponse,
|
||||
): ApiResponse<Unit>
|
||||
|
||||
@POST("user-network-account")
|
||||
suspend fun createUserNetworkAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body body: CreateUserNetworkAccountBody,
|
||||
): ApiResponse<CreateUserNetworkAccountResponse>
|
||||
|
||||
@POST("account")
|
||||
suspend fun createUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Body body: CreateUserTokensAccountBody,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}")
|
||||
suspend fun updateUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
@Body body: UpdateUserTokensAccountBody,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}/archive")
|
||||
suspend fun archiveUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
suspend fun archiveUserTokensAccount(@Path("account_id") accountId: Int): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@PUT("account/{account_id}/unarchive")
|
||||
suspend fun restoreUserTokensAccount(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("account_id") accountId: Int,
|
||||
): ApiResponse<UserTokensAccountResponse>
|
||||
suspend fun restoreUserTokensAccount(@Path("account_id") accountId: Int): ApiResponse<UserTokensAccountResponse>
|
||||
|
||||
@GET("features")
|
||||
suspend fun getFeatures(): ApiResponse<FeaturesResponse>
|
||||
|
|
|
|||
|
|
@ -7,16 +7,10 @@ import retrofit2.http.*
|
|||
interface TangemTechApiV2 {
|
||||
|
||||
@GET("user-tokens/{wallet_id}")
|
||||
suspend fun getUserTokens(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
): ApiResponse<UserTokensResponseV2>
|
||||
suspend fun getUserTokens(@Path("wallet_id") walletId: String): ApiResponse<UserTokensResponseV2>
|
||||
|
||||
@PUT("user-tokens/{wallet_id}")
|
||||
suspend fun saveUserTokens(
|
||||
@Header("card_public_key") cardPublicKey: String,
|
||||
@Header("card_id") cardId: String,
|
||||
@Path("wallet_id") walletId: String,
|
||||
@Body userTokens: UserTokensResponseV2,
|
||||
): ApiResponse<Unit>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.tangem.datasource.utils
|
|||
|
||||
import android.os.Build
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.utils.RequestHeader.CacheControlHeader.checkHeaderValueOrEmpty
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.version.AppVersionProvider
|
||||
import java.util.Locale
|
||||
|
|
@ -27,8 +28,24 @@ sealed class RequestHeader(vararg pairs: Pair<String, Provider<String>>) {
|
|||
class AppVersionPlatformHeaders(appVersionProvider: AppVersionProvider) : RequestHeader(
|
||||
"version" to Provider(appVersionProvider::versionName),
|
||||
"platform" to Provider { "android" },
|
||||
"language" to Provider { Locale.getDefault().language },
|
||||
"timezone" to Provider { TimeZone.getDefault().displayName },
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}" },
|
||||
"language" to Provider { Locale.getDefault().language.checkHeaderValueOrEmpty() },
|
||||
"timezone" to Provider {
|
||||
TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT).checkHeaderValueOrEmpty()
|
||||
},
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}".checkHeaderValueOrEmpty() },
|
||||
)
|
||||
|
||||
/**
|
||||
* Use it to avoid crash in okhttp headers
|
||||
*/
|
||||
fun String.checkHeaderValueOrEmpty(): String {
|
||||
for (i in this.indices) {
|
||||
val c = this[i]
|
||||
val charCondition = c == '\t' || c in '\u0020'..'\u007e'
|
||||
if (!charCondition) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
|
@ -127,9 +127,11 @@ internal class ProdApiConfigsManagerTest(private val model: Model) {
|
|||
"refcode" to Provider { EXPRESS_REF_CODE },
|
||||
"version" to Provider { VERSION_NAME },
|
||||
"platform" to Provider { "android" },
|
||||
"language" to Provider { Locale.getDefault().language },
|
||||
"timezone" to Provider { TimeZone.getDefault().displayName },
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}" },
|
||||
"language" to Provider { Locale.getDefault().language.checkHeaderValueOrEmpty() },
|
||||
"timezone" to Provider {
|
||||
TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT).checkHeaderValueOrEmpty()
|
||||
},
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}".checkHeaderValueOrEmpty() },
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -146,9 +148,11 @@ internal class ProdApiConfigsManagerTest(private val model: Model) {
|
|||
"card_public_key" to Provider { APP_CARD_PUBLIC_KEY },
|
||||
"version" to Provider { VERSION_NAME },
|
||||
"platform" to Provider { "android" },
|
||||
"language" to Provider { Locale.getDefault().language },
|
||||
"timezone" to Provider { TimeZone.getDefault().displayName },
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}" },
|
||||
"language" to Provider { Locale.getDefault().language.checkHeaderValueOrEmpty() },
|
||||
"timezone" to Provider {
|
||||
TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT).checkHeaderValueOrEmpty()
|
||||
},
|
||||
"device" to Provider { "${Build.MANUFACTURER} ${Build.MODEL}".checkHeaderValueOrEmpty() },
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
@ -167,5 +171,16 @@ internal class ProdApiConfigsManagerTest(private val model: Model) {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun String.checkHeaderValueOrEmpty(): String {
|
||||
for (i in this.indices) {
|
||||
val c = this[i]
|
||||
val charCondition = c == '\t' || c in '\u0020'..'\u007e'
|
||||
if (!charCondition) {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.domain.tokens.model.analytics
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -77,4 +78,43 @@ sealed class TokenScreenAnalyticsEvent(
|
|||
event = "Staking Clicked",
|
||||
params = mapOf("Token" to token),
|
||||
)
|
||||
|
||||
class NoticeActionInactive(token: String, tokenAction: TokenAction, reason: String) : TokenScreenAnalyticsEvent(
|
||||
"Notice - Action Inactive",
|
||||
params = buildMap {
|
||||
put("Token", token)
|
||||
put("Action", tokenAction.action)
|
||||
if (reason.isNotEmpty()) {
|
||||
put("Reason", reason)
|
||||
}
|
||||
},
|
||||
) {
|
||||
sealed class TokenAction(val action: String) {
|
||||
data object BuyAction : TokenAction("Buy")
|
||||
data object SellAction : TokenAction("Sell")
|
||||
data object SwapAction : TokenAction("Swap")
|
||||
data object SendAction : TokenAction("Send")
|
||||
data object ReceiveAction : TokenAction("Receive")
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val UNAVAILABLE = "Unavailable"
|
||||
private const val EMPTY = "Empty"
|
||||
private const val PENDING = "Pending"
|
||||
|
||||
fun ScenarioUnavailabilityReason.toReasonAnalyticsText(): String {
|
||||
return when (this) {
|
||||
is ScenarioUnavailabilityReason.BuyUnavailable -> UNAVAILABLE
|
||||
is ScenarioUnavailabilityReason.EmptyBalance -> EMPTY
|
||||
ScenarioUnavailabilityReason.None -> ""
|
||||
is ScenarioUnavailabilityReason.NotExchangeable -> UNAVAILABLE
|
||||
is ScenarioUnavailabilityReason.NotSupportedBySellService -> UNAVAILABLE
|
||||
is ScenarioUnavailabilityReason.PendingTransaction -> PENDING
|
||||
is ScenarioUnavailabilityReason.StakingUnavailable -> UNAVAILABLE
|
||||
ScenarioUnavailabilityReason.UnassociatedAsset -> UNAVAILABLE
|
||||
ScenarioUnavailabilityReason.Unreachable -> ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,6 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.data.common.currency.CryptoCurrencyFactory
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.api.tangemTech.models.StartReferralBody
|
||||
import com.tangem.datasource.demo.DemoModeDatasource
|
||||
|
|
@ -24,7 +23,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
private val referralConverter: ReferralConverter,
|
||||
private val coroutineDispatcher: CoroutineDispatcherProvider,
|
||||
private val demoModeDatasource: DemoModeDatasource,
|
||||
private val authProvider: AuthProvider,
|
||||
private val userWalletsStore: UserWalletsStore,
|
||||
) : ReferralRepository {
|
||||
|
||||
|
|
@ -35,8 +33,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
return withContext(coroutineDispatcher.io) {
|
||||
referralConverter.convert(
|
||||
referralApi.getReferralStatus(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
walletId = walletId,
|
||||
),
|
||||
)
|
||||
|
|
@ -52,8 +48,6 @@ internal class ReferralRepositoryImpl @Inject constructor(
|
|||
return withContext(coroutineDispatcher.io) {
|
||||
referralConverter.convert(
|
||||
referralApi.startReferral(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
startReferralBody = StartReferralBody(
|
||||
walletId = walletId,
|
||||
networkId = networkId,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.tangem.feature.referral.di
|
||||
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.demo.DemoModeDatasource
|
||||
import com.tangem.datasource.local.userwallet.UserWalletsStore
|
||||
|
|
@ -25,7 +24,6 @@ class ReferralRepositoryModule {
|
|||
referralConverter: ReferralConverter,
|
||||
coroutineDispatcherProvider: CoroutineDispatcherProvider,
|
||||
demoModeDatasource: DemoModeDatasource,
|
||||
authProvider: AuthProvider,
|
||||
userWalletsStore: UserWalletsStore,
|
||||
): ReferralRepository {
|
||||
return ReferralRepositoryImpl(
|
||||
|
|
@ -33,7 +31,6 @@ class ReferralRepositoryModule {
|
|||
referralConverter = referralConverter,
|
||||
coroutineDispatcher = coroutineDispatcherProvider,
|
||||
demoModeDatasource = demoModeDatasource,
|
||||
authProvider = authProvider,
|
||||
userWalletsStore = userWalletsStore,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.tangem.domain.tokens.model.ScenarioUnavailabilityReason
|
|||
import com.tangem.domain.tokens.model.analytics.TokenExchangeAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.analytics.TokenReceiveAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent
|
||||
import com.tangem.domain.tokens.model.analytics.TokenScreenAnalyticsEvent.Companion.toReasonAnalyticsText
|
||||
import com.tangem.domain.tokens.model.analytics.TokenSwapPromoAnalyticsEvent
|
||||
import com.tangem.domain.tokens.repository.QuotesRepository
|
||||
import com.tangem.domain.transaction.error.AssociateAssetError
|
||||
|
|
@ -446,7 +447,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
override fun onBuyClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.ButtonBuy(cryptoCurrency.symbol))
|
||||
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction.BuyAction,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
showErrorIfDemoModeOrElse {
|
||||
val status = cryptoCurrencyStatus ?: return@showErrorIfDemoModeOrElse
|
||||
|
|
@ -482,7 +490,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
override fun onSendClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.ButtonSend(cryptoCurrency.symbol))
|
||||
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction.SendAction,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
sendCurrency(status = cryptoCurrencyStatus ?: return)
|
||||
}
|
||||
|
|
@ -551,7 +566,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
override fun onReceiveClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
val networkAddress = cryptoCurrencyStatus?.value?.networkAddress ?: return
|
||||
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction.ReceiveAction,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
viewModelScope.launch(dispatchers.main) {
|
||||
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.ButtonReceive(cryptoCurrency.symbol))
|
||||
|
|
@ -571,7 +593,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onStakeClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = null,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
openStaking()
|
||||
}
|
||||
|
|
@ -603,7 +632,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
override fun onSellClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.ButtonSell(cryptoCurrency.symbol))
|
||||
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction.SellAction,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
showErrorIfDemoModeOrElse {
|
||||
val status = cryptoCurrencyStatus ?: return@showErrorIfDemoModeOrElse
|
||||
|
|
@ -620,7 +656,14 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
override fun onSwapClick(unavailabilityReason: ScenarioUnavailabilityReason) {
|
||||
analyticsEventsHandler.send(TokenScreenAnalyticsEvent.ButtonExchange(cryptoCurrency.symbol))
|
||||
|
||||
if (handleUnavailabilityReason(unavailabilityReason)) return
|
||||
if (handleUnavailabilityReason(
|
||||
unavailabilityReason = unavailabilityReason,
|
||||
tokenSymbol = cryptoCurrency.symbol,
|
||||
tokenAction = TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction.SwapAction,
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
appRouter.push(AppRoute.Swap(currency = cryptoCurrency, userWalletId = userWalletId))
|
||||
}
|
||||
|
|
@ -854,8 +897,21 @@ internal class TokenDetailsViewModel @Inject constructor(
|
|||
internalUiState.value = stateFactory.getStateWithUpdatedBalanceSegmentedButtonConfig(config)
|
||||
}
|
||||
|
||||
private fun handleUnavailabilityReason(unavailabilityReason: ScenarioUnavailabilityReason): Boolean {
|
||||
private fun handleUnavailabilityReason(
|
||||
unavailabilityReason: ScenarioUnavailabilityReason,
|
||||
tokenSymbol: String,
|
||||
tokenAction: TokenScreenAnalyticsEvent.NoticeActionInactive.TokenAction?,
|
||||
): Boolean {
|
||||
if (unavailabilityReason == ScenarioUnavailabilityReason.None) return false
|
||||
if (tokenAction != null) {
|
||||
analyticsEventsHandler.send(
|
||||
TokenScreenAnalyticsEvent.NoticeActionInactive(
|
||||
token = tokenSymbol,
|
||||
tokenAction = tokenAction,
|
||||
reason = unavailabilityReason.toReasonAnalyticsText(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
internalUiState.value = stateFactory.getStateWithActionButtonErrorDialog(unavailabilityReason)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.BlockchainSdkError
|
||||
import com.tangem.blockchain.extensions.Result
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.common.response.getOrThrow
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.api.tangemTech.models.CreateUserNetworkAccountBody
|
||||
|
||||
internal class DefaultAccountCreator(
|
||||
private val authProvider: AuthProvider,
|
||||
private val tangemTechApi: TangemTechApi,
|
||||
) : AccountCreator {
|
||||
|
||||
|
|
@ -22,8 +20,6 @@ internal class DefaultAccountCreator(
|
|||
)
|
||||
return try {
|
||||
val response = tangemTechApi.createUserNetworkAccount(
|
||||
cardPublicKey = authProvider.getCardPublicKey(),
|
||||
cardId = authProvider.getCardId(),
|
||||
body = request,
|
||||
).getOrThrow()
|
||||
Result.Success(response.data.accountId)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.tangem.blockchainsdk.featuretoggles.DefaultBlockchainSDKFeatureToggle
|
|||
import com.tangem.blockchainsdk.loader.BlockchainProvidersResponseLoader
|
||||
import com.tangem.blockchainsdk.store.DefaultRuntimeStore
|
||||
import com.tangem.core.featuretoggle.manager.FeatureTogglesManager
|
||||
import com.tangem.datasource.api.common.AuthProvider
|
||||
import com.tangem.datasource.api.tangemTech.TangemTechApi
|
||||
import com.tangem.datasource.local.config.environment.EnvironmentConfigStorage
|
||||
import com.tangem.datasource.local.preferences.AppPreferencesStore
|
||||
|
|
@ -45,14 +44,13 @@ internal object BlockchainSDKFactoryModule {
|
|||
@Provides
|
||||
@Singleton
|
||||
fun provideWalletManagerFactoryCreator(
|
||||
authProvider: AuthProvider,
|
||||
tangemTechApi: TangemTechApi,
|
||||
appPreferencesStore: AppPreferencesStore,
|
||||
blockchainSDKLogger: BlockchainSDKLogger,
|
||||
featureTogglesManager: FeatureTogglesManager,
|
||||
): WalletManagerFactoryCreator {
|
||||
return WalletManagerFactoryCreator(
|
||||
accountCreator = DefaultAccountCreator(authProvider, tangemTechApi),
|
||||
accountCreator = DefaultAccountCreator(tangemTechApi),
|
||||
blockchainDataStorage = DefaultBlockchainDataStorage(appPreferencesStore),
|
||||
blockchainSDKLogger = blockchainSDKLogger,
|
||||
blockchainSDKFeatureToggles = DefaultBlockchainSDKFeatureToggles(featureTogglesManager),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue