Skip to content

Commit

Permalink
Fix bug in Balance Auto Hide for BalanceCexViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
omurovch committed Jun 27, 2023
1 parent 42ec916 commit 79ed3d5
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ import io.horizontalsystems.bankwallet.core.imageUrl
import io.horizontalsystems.bankwallet.core.providers.CexAsset
import io.horizontalsystems.bankwallet.core.providers.CexProviderManager
import io.horizontalsystems.bankwallet.core.providers.ICexProvider
import io.horizontalsystems.bankwallet.modules.balance.*
import io.horizontalsystems.bankwallet.modules.balance.BalanceSortType
import io.horizontalsystems.bankwallet.modules.balance.BalanceViewHelper
import io.horizontalsystems.bankwallet.modules.balance.BalanceViewType
import io.horizontalsystems.bankwallet.modules.balance.BalanceViewTypeManager
import io.horizontalsystems.bankwallet.modules.balance.BalanceXRateRepository
import io.horizontalsystems.bankwallet.modules.balance.DeemedValue
import io.horizontalsystems.bankwallet.modules.balance.ITotalBalance
import io.horizontalsystems.bankwallet.modules.balance.TotalBalance
import io.horizontalsystems.bankwallet.modules.balance.TotalService
import io.horizontalsystems.marketkit.models.CoinPrice
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -77,6 +85,13 @@ class BalanceCexViewModel(
}
}

viewModelScope.launch {
totalBalance.stateFlow.collect {
refreshViewItems()
emitState()
}
}

totalBalance.start(viewModelScope)
balanceCexRepository.start()
}
Expand Down Expand Up @@ -213,13 +228,6 @@ class BalanceCexViewModel(
balanceCexRepository.stop()
}

override fun toggleBalanceVisibility() {
totalBalance.toggleBalanceVisibility()
refreshViewItems()

emitState()
}

fun onSelectSortType(sortType: BalanceSortType) {
this.sortType = sortType
localStorage.sortType = sortType
Expand Down

0 comments on commit 79ed3d5

Please sign in to comment.