Remove usage of GlobalScope

This commit is contained in:
Benoit Marty 2021-05-14 15:24:04 +02:00
parent 1e708b113b
commit 0437814479
1 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import dagger.assisted.AssistedInject
import dagger.assisted.AssistedFactory
import im.vector.app.R
import im.vector.app.core.resources.StringProvider
import kotlinx.coroutines.GlobalScope
import im.vector.app.features.session.coroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.query.QueryStringValue
@ -465,7 +465,8 @@ class WidgetPostAPIHandler @AssistedInject constructor(@Assisted private val roo
}
private fun launchWidgetAPIAction(widgetPostAPIMediator: WidgetPostAPIMediator, eventData: JsonDict, block: suspend () -> Unit): Job {
return GlobalScope.launch {
// We should probably use a scope tight to the lifecycle here...
return session.coroutineScope.launch {
kotlin.runCatching {
block()
}.fold(