Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-28 13:03:59 +04:00
parent 44fc5b9610
commit fc7b758aff
7 changed files with 220 additions and 11 deletions

View file

@ -120,7 +120,6 @@ internal class OnrampSuccessComponentModel @Inject constructor(
expressTxStatusTaskScheduler.scheduleTask(
modelScope,
PeriodicTask(
isDelayFirst = false,
delay = EXPRESS_STATUS_UPDATE_DELAY,
task = {
runSuspendCatching {

View file

@ -151,10 +151,14 @@ internal class SwapAmountModel @Inject constructor(
}
fun onStart() {
val isDelayFirst = params !is SwapAmountComponentParams.AmountBlockParams
val initialDelay = if (params is SwapAmountComponentParams.AmountBlockParams) {
BLOCK_INITIAL_QUOTE_DELAY
} else {
QUOTES_UPDATE_DELAY
}
quoteTaskScheduler.scheduleTask(
scope = modelScope,
task = loadQuotesTask(isDelayFirst = isDelayFirst),
task = loadQuotesTask(initialDelay = initialDelay),
)
subscribeOnAutoupdateEnabling()
}
@ -850,10 +854,10 @@ internal class SwapAmountModel @Inject constructor(
)
}
private fun loadQuotesTask(isDelayFirst: Boolean = true): PeriodicTask<Unit> {
private fun loadQuotesTask(initialDelay: Long = QUOTES_UPDATE_DELAY): PeriodicTask<Unit> {
return PeriodicTask(
delay = QUOTES_UPDATE_DELAY,
isDelayFirst = isDelayFirst,
initialDelay = initialDelay,
task = {
runCatching { loadQuotes(isSilentReload = true) }
},
@ -933,5 +937,6 @@ internal class SwapAmountModel @Inject constructor(
private companion object {
const val DEBOUNCE_AMOUNT_DELAY = 500L
const val QUOTES_UPDATE_DELAY = 10000L
const val BLOCK_INITIAL_QUOTE_DELAY = 1000L
}
}

View file

@ -195,7 +195,6 @@ internal class ExpressTransactionsModel @Inject constructor(
expressTxStatusTaskScheduler.scheduleTask(
scope = modelScope,
task = PeriodicTask(
isDelayFirst = false,
delay = EXPRESS_STATUS_UPDATE_DELAY,
task = {
try {

View file

@ -390,7 +390,6 @@ internal class TokenDetailsModel @Inject constructor(
expressTxStatusTaskScheduler.scheduleTask(
scope = modelScope,
task = PeriodicTask(
isDelayFirst = false,
delay = EXPRESS_STATUS_UPDATE_DELAY,
task = {
runSuspendCatching {

View file

@ -398,7 +398,6 @@ internal class WalletModel @Inject constructor(
expressTxStatusTaskScheduler.scheduleTask(
modelScope,
PeriodicTask(
isDelayFirst = false,
delay = EXPRESS_STATUS_UPDATE_DELAY,
task = {
runCatching {