Skip to content

Commit 91e0a8b

Browse files
committed
fix: use main dispatcher to collect state
1 parent f8cb834 commit 91e0a8b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class WalletViewModel @Inject constructor(
7272
collectStates()
7373
}
7474

75-
private fun collectStates() { // This is necessary to avoid a bigger refactor in all application
76-
viewModelScope.launch(bgDispatcher) {
75+
private fun collectStates() {
76+
viewModelScope.launch {
7777
walletState.collect { state ->
7878
walletExists = state.walletExists
7979
_uiState.update {
@@ -93,7 +93,7 @@ class WalletViewModel @Inject constructor(
9393
}
9494
}
9595

96-
viewModelScope.launch(bgDispatcher) {
96+
viewModelScope.launch {
9797
lightningState.collect { state ->
9898
_uiState.update {
9999
it.copy(
@@ -111,7 +111,7 @@ class WalletViewModel @Inject constructor(
111111
private fun triggerBackupRestore() {
112112
restoreState = RestoreState.RestoringBackups
113113

114-
viewModelScope.launch(bgDispatcher) {
114+
viewModelScope.launch {
115115
backupRepo.performFullRestoreFromLatestBackup()
116116
// data backup is not critical and mostly for user convenience so there is no reason to propagate errors up
117117
restoreState = RestoreState.BackupRestoreCompleted

0 commit comments

Comments
 (0)