Updated on 2026-08-14
This commit is contained in:
parent
a291a9a8c0
commit
1bae7d2277
49 changed files with 514 additions and 219 deletions
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>BooleanPropertyNaming:DefaultFeedbackRepository.kt$DefaultFeedbackRepository$private val useNewUserWalletsRepository: Boolean</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -26,7 +26,7 @@ import java.io.File
|
|||
*
|
||||
* @property appLogsStore app logs store
|
||||
* @property userWalletsListManager user wallets list manager
|
||||
* @property useNewUserWalletsRepository flag to use new user wallets repository
|
||||
* @property shouldUseNewUserWalletsRepository flag to use new user wallets repository
|
||||
* @property userWalletsListRepository user wallets repository
|
||||
* @property walletManagersStore wallet managers store
|
||||
* @property emailSender email sender
|
||||
|
|
@ -37,7 +37,7 @@ import java.io.File
|
|||
@Suppress("LongParameterList")
|
||||
internal class DefaultFeedbackRepository(
|
||||
private val appLogsStore: AppLogsStore,
|
||||
private val useNewUserWalletsRepository: Boolean,
|
||||
private val shouldUseNewUserWalletsRepository: Boolean,
|
||||
private val userWalletsListRepository: UserWalletsListRepository,
|
||||
private val userWalletsListManager: UserWalletsListManager,
|
||||
private val walletManagersStore: WalletManagersStore,
|
||||
|
|
@ -126,7 +126,7 @@ internal class DefaultFeedbackRepository(
|
|||
}
|
||||
|
||||
private suspend fun getUserWalletById(userWalletId: UserWalletId): UserWallet? {
|
||||
return if (useNewUserWalletsRepository) {
|
||||
return if (shouldUseNewUserWalletsRepository) {
|
||||
userWalletsListRepository.userWalletsSync().find { it.walletId == userWalletId }
|
||||
} else {
|
||||
userWalletsListManager.userWalletsSync.find { it.walletId == userWalletId }
|
||||
|
|
@ -134,7 +134,7 @@ internal class DefaultFeedbackRepository(
|
|||
}
|
||||
|
||||
private fun totalUserWallets(): Int {
|
||||
return if (useNewUserWalletsRepository) {
|
||||
return if (shouldUseNewUserWalletsRepository) {
|
||||
userWalletsListRepository.userWallets.value?.size ?: 0
|
||||
} else {
|
||||
userWalletsListManager.walletsCount
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ internal object FeedbackModule {
|
|||
emailSender = emailSender,
|
||||
appVersionProvider = appVersionProvider,
|
||||
userWalletsListRepository = userWalletsListRepository,
|
||||
useNewUserWalletsRepository = hotWalletFeatureToggles.isHotWalletEnabled,
|
||||
shouldUseNewUserWalletsRepository = hotWalletFeatureToggles.isHotWalletEnabled,
|
||||
getSelectedWalletUseCase = getSelectedWalletUseCase,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>SuspendFunSwallowedCancellation:DefaultPromoRepository.kt$DefaultPromoRepository$runCatching</ID>
|
||||
<ID>SuspendFunWithFlowReturnType:DefaultPromoRepository.kt$DefaultPromoRepository$suspend</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -19,6 +19,7 @@ import com.tangem.domain.promo.models.StoryContent
|
|||
import com.tangem.feature.referral.domain.ReferralRepository
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import com.tangem.utils.coroutines.runCatching
|
||||
import com.tangem.utils.coroutines.runSuspendCatching
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
|
|
@ -42,7 +43,7 @@ internal class DefaultPromoRepository(
|
|||
.distinctUntilChanged()
|
||||
.map { shouldShow ->
|
||||
when (promoId) {
|
||||
PromoId.Referral -> runCatching {
|
||||
PromoId.Referral -> runSuspendCatching {
|
||||
!referralRepository.isReferralParticipant(userWalletId) && shouldShow
|
||||
}.getOrDefault(false)
|
||||
PromoId.Sepa -> {
|
||||
|
|
@ -81,7 +82,7 @@ internal class DefaultPromoRepository(
|
|||
appPreferencesStore.store(PreferencesKeys.getShouldShowPromoKey(promoId = promoId.name), false)
|
||||
}
|
||||
|
||||
override suspend fun isMarketsStakingNotificationHideClicked(): Flow<Boolean> {
|
||||
override fun isMarketsStakingNotificationHideClicked(): Flow<Boolean> {
|
||||
return appPreferencesStore.get(
|
||||
key = PreferencesKeys.MARKETS_STAKING_NOTIFICATION_HIDE_CLICKED_KEY,
|
||||
default = false,
|
||||
|
|
@ -105,7 +106,7 @@ internal class DefaultPromoRepository(
|
|||
val storedPromo = promoStoriesStore.getSyncOrNull(storyId = id)
|
||||
// Get last stored promo by id if possible or get from network
|
||||
val story = if (storedPromo == null && refresh) {
|
||||
val storyContent = runCatching {
|
||||
val storyContent = runSuspendCatching {
|
||||
// Important to return
|
||||
withTimeoutOrNull(STORIES_LOAD_DELAY) {
|
||||
tangemApi.getStoryById(storyId = id).getOrThrow()
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>CastNullableToNonNullableType:DefaultTransactionRepository.kt$DefaultTransactionRepository$as</ID>
|
||||
<ID>NoNameShadowing:DefaultTransactionRepository.kt$DefaultTransactionRepository$amount</ID>
|
||||
<ID>NoNameShadowing:DefaultTransactionRepository.kt$DefaultTransactionRepository$destination</ID>
|
||||
<ID>NullableBooleanCheck:DefaultWalletAddressServiceRepository.kt$DefaultWalletAddressServiceRepository$(walletManager as? NearWalletManager)?.validateAddress(address) ?: false</ID>
|
||||
<ID>NullableToStringCall:DefaultTransactionRepository.kt$DefaultTransactionRepository$${walletManager?.wallet?.blockchain}</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -38,7 +38,7 @@ import timber.log.Timber
|
|||
import java.math.BigDecimal
|
||||
import java.math.BigInteger
|
||||
|
||||
@Suppress("LargeClass")
|
||||
@Suppress("LargeClass", "NullableToStringCall")
|
||||
internal class DefaultTransactionRepository(
|
||||
private val tangemTechApi: TangemTechApi,
|
||||
private val walletManagersFacade: WalletManagersFacade,
|
||||
|
|
@ -64,12 +64,12 @@ internal class DefaultTransactionRepository(
|
|||
|
||||
val extras = txExtras ?: getMemoExtras(networkId = network.rawId, memo)
|
||||
|
||||
val destination = if (amount.type is AmountType.TokenYieldSupply) {
|
||||
val patchedDestination = if (amount.type is AmountType.TokenYieldSupply) {
|
||||
walletManager.getYieldModuleAddress()
|
||||
} else {
|
||||
destination
|
||||
}
|
||||
val amount = if (amount.type is AmountType.TokenYieldSupply) {
|
||||
val patchedAmount = if (amount.type is AmountType.TokenYieldSupply) {
|
||||
amount.copy(value = BigDecimal.ZERO)
|
||||
} else {
|
||||
amount
|
||||
|
|
@ -77,17 +77,17 @@ internal class DefaultTransactionRepository(
|
|||
|
||||
return@withContext if (fee != null) {
|
||||
walletManager.createTransaction(
|
||||
amount = amount,
|
||||
amount = patchedAmount,
|
||||
fee = fee,
|
||||
destination = destination,
|
||||
destination = patchedDestination,
|
||||
).copy(
|
||||
extras = extras,
|
||||
)
|
||||
} else {
|
||||
TransactionData.Uncompiled(
|
||||
amount = amount,
|
||||
amount = patchedAmount,
|
||||
sourceAddress = walletManager.wallet.address,
|
||||
destinationAddress = destination,
|
||||
destinationAddress = patchedDestination,
|
||||
extras = extras,
|
||||
fee = null,
|
||||
)
|
||||
|
|
@ -288,7 +288,7 @@ internal class DefaultTransactionRepository(
|
|||
blockchain = blockchain,
|
||||
derivationPath = network.derivationPath.value,
|
||||
)
|
||||
(walletManager as TransactionSender).send(txData, signer)
|
||||
(requireNotNull(walletManager) as TransactionSender).send(txData, signer)
|
||||
}
|
||||
|
||||
override suspend fun sendMultipleTransactions(
|
||||
|
|
@ -304,7 +304,7 @@ internal class DefaultTransactionRepository(
|
|||
blockchain = blockchain,
|
||||
derivationPath = network.derivationPath.value,
|
||||
)
|
||||
(walletManager as TransactionSender).sendMultiple(txsData, signer, sendMode)
|
||||
(requireNotNull(walletManager) as TransactionSender).sendMultiple(txsData, signer, sendMode)
|
||||
}
|
||||
|
||||
override fun createTransactionDataExtras(
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class DefaultWalletAddressServiceRepository(
|
|||
blockchain = blockchain,
|
||||
derivationPath = network.derivationPath.value,
|
||||
) ?: return@withContext false
|
||||
(walletManager as? NearWalletManager)?.validateAddress(address) ?: false
|
||||
(walletManager as? NearWalletManager)?.validateAddress(address) == true
|
||||
} else {
|
||||
blockchain.validateAddress(address)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue