Skip to content

Commit 030799a

Browse files
Fix: Move DB operations to IO dispatcher in FeedbackDetailViewModel
The `loadFeedback`, `closeFeedback`, and `addReply` functions in `FeedbackDetailViewModel` were performing database operations on the main thread, which could lead to UI unresponsiveness (ANR). This change wraps the repository calls within `viewModelScope.launch(Dispatchers.IO)` to ensure they are executed on a background thread. It also adds the necessary import for `Dispatchers`.
1 parent c93bdf5 commit 030799a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/src/main/java/org/ole/planet/myplanet/ui/feedback/FeedbackDetailViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope
55
import com.google.gson.JsonObject
66
import dagger.hilt.android.lifecycle.HiltViewModel
77
import javax.inject.Inject
8+
import kotlinx.coroutines.Dispatchers
89
import kotlinx.coroutines.flow.MutableSharedFlow
910
import kotlinx.coroutines.flow.MutableStateFlow
1011
import kotlinx.coroutines.flow.SharedFlow

0 commit comments

Comments
 (0)