Updated on 2026-08-14

This commit is contained in:
Tangem 2025-06-20 14:07:58 +03:00
parent fc8c6a8fb8
commit c1469cb09b
2 changed files with 8 additions and 9 deletions

View file

@ -165,6 +165,7 @@ internal class StakingModel @Inject constructor(
}
private var isInitialInfoAnalyticSent: Boolean = false
private var isBalanceUpdatedAfterStart: Boolean = false
private val balanceUpdater by lazy(LazyThreadSafetyMode.NONE) {
stakingBalanceUpdater.create(
@ -421,7 +422,7 @@ internal class StakingModel @Inject constructor(
override fun onRefreshSwipe(isRefreshing: Boolean) {
stateController.update(SetInitialLoadingStateTransformer(isRefreshing))
coroutineScope.launch {
balanceUpdater.updatePullToRefresh()
balanceUpdater.partialUpdate()
}.invokeOnCompletion {
stateController.update(SetInitialLoadingStateTransformer(false))
}
@ -1011,7 +1012,11 @@ internal class StakingModel @Inject constructor(
when {
isInitState() -> {
updateInitialData(status)
balanceUpdater.updateAfterNavigationToInitial()
if (!isBalanceUpdatedAfterStart) {
isBalanceUpdatedAfterStart = true
balanceUpdater.partialUpdate()
}
}
isAssentState() -> {
getFee()

View file

@ -51,7 +51,7 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
}
}
suspend fun updatePullToRefresh() {
suspend fun partialUpdate() {
coroutineScope {
listOf(
async {
@ -64,12 +64,6 @@ internal class StakingBalanceUpdater @AssistedInject constructor(
}
}
suspend fun updateAfterNavigationToInitial() {
coroutineScope {
async { updateStakingActions() }.await()
}
}
private suspend fun fetchCurrencyStatus(delayMillis: Long = 0L) {
delay(delayMillis)
fetchCurrencyStatusUseCase(