fix ANR caused by direct message badge (#4182)

Saw an ANR (app not responding) error being reported in the Play console
and then found this. Sorry but `runBlocking` in production code is an
absolute no go.
This commit is contained in:
Konrad Pozniak 2023-12-21 19:02:28 +01:00 committed by GitHub
commit 9781e43441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -66,7 +66,6 @@ import com.mikepenz.iconics.utils.sizeDp
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
import kotlin.time.DurationUnit
import kotlin.time.toDuration
@ -132,7 +131,7 @@ class ConversationsFragment :
binding.progressBar.hide()
if (loadState.isAnyLoading()) {
runBlocking {
lifecycleScope.launch {
eventHub.dispatch(ConversationsLoadingEvent(accountManager.activeAccount?.accountId ?: ""))
}
}