Skip to content

Commit

Permalink
Fix bug in Balance Auto Hide
Browse files Browse the repository at this point in the history
- coming from background not hiding balance items
  • Loading branch information
omurovch committed Jun 27, 2023
1 parent 25cf29b commit 42ec916
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class BalanceViewModel(
}
}

viewModelScope.launch {
totalBalance.stateFlow.collect {
refreshViewItems(service.balanceItemsFlow.value)
}
}

viewModelScope.launch {
balanceViewTypeManager.balanceViewTypeFlow.collect {
handleUpdatedBalanceViewType(it)
Expand Down Expand Up @@ -126,17 +132,6 @@ class BalanceViewModel(
service.clear()
}

override fun toggleBalanceVisibility() {
totalBalance.toggleBalanceVisibility()
viewModelScope.launch {
service.balanceItemsFlow.value?.let { refreshViewItems(it) }
}
}

override fun toggleTotalType() {
totalBalance.toggleTotalType()
}

fun onItem(viewItem: BalanceViewItem) {
viewModelScope.launch {
expandedWallet = when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import androidx.compose.runtime.setValue
import io.horizontalsystems.bankwallet.core.App
import io.horizontalsystems.bankwallet.core.managers.BalanceHiddenManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch


interface ITotalBalance {
val balanceHidden: Boolean
val totalUiState: TotalUIState
val stateFlow: StateFlow<TotalService.State>

fun toggleBalanceVisibility()
fun toggleTotalType()
Expand All @@ -29,6 +31,9 @@ class TotalBalance(
override var totalUiState by mutableStateOf(createTotalUIState())
private set

override val stateFlow: StateFlow<TotalService.State>
get() = totalService.stateFlow

fun start(viewModelScope: CoroutineScope) {
viewModelScope.launch {
totalService.stateFlow.collect {
Expand Down

0 comments on commit 42ec916

Please sign in to comment.