Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-04 15:24:59 +02:00
parent a291a9a8c0
commit 1bae7d2277
49 changed files with 514 additions and 219 deletions

View file

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>MultilineLambdaItParameter:ReferralInteractorImpl.kt$ReferralInteractorImpl${ Timber.e("Failed to derive public keys: $it") throw it.mapToDomainError() }</ID>
<ID>ObjectExtendsThrowable:ReferralError.kt$ReferralError$SdkError : ReferralError</ID>
<ID>ObjectExtendsThrowable:ReferralError.kt$ReferralError$UserCancelledException : ReferralError</ID>
<ID>UselessCallOnNotNull:ReferralInteractorImpl.kt$ReferralInteractorImpl$listOfNotNull(cryptoCurrency)</ID>
</CurrentIssues>
</SmellBaseline>

View file

@ -72,9 +72,9 @@ internal class ReferralInteractorImpl(
manageCryptoCurrenciesUseCase(accountId = portfolioId.accountId, add = cryptoCurrency)
}
is PortfolioId.Wallet -> {
derivePublicKeysUseCase(userWallet.walletId, listOfNotNull(cryptoCurrency)).getOrElse {
Timber.e("Failed to derive public keys: $it")
throw it.mapToDomainError()
derivePublicKeysUseCase(userWallet.walletId, listOf(cryptoCurrency)).getOrElse { throwable ->
Timber.e("Failed to derive public keys: $throwable")
throw throwable.mapToDomainError()
}
addCryptoCurrenciesUseCase(
@ -118,9 +118,9 @@ internal class ReferralInteractorImpl(
private fun Throwable.mapToDomainError(): ReferralError {
if (this !is TangemSdkError) return ReferralError.DataError(this)
return if (this is TangemSdkError.UserCancelled) {
ReferralError.UserCancelledException
ReferralError.UserCancelledException()
} else {
ReferralError.SdkError
ReferralError.SdkError()
}
}
}

View file

@ -1,8 +1,8 @@
package com.tangem.feature.referral.domain.errors
sealed class ReferralError : Exception() {
data object UserCancelledException : ReferralError()
data object SdkError : ReferralError()
class UserCancelledException : ReferralError()
class SdkError : ReferralError()
data class DataError(val throwable: Throwable) : ReferralError()
class DataError(val throwable: Throwable) : ReferralError()
}