mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-24 16:51:07 +01:00
Remove usage of GlobalScope
This commit is contained in:
parent
555eada37a
commit
4112d28127
@ -25,8 +25,9 @@ import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.error.ErrorFormatter
|
||||
import im.vector.app.core.files.LocalFilesHelper
|
||||
import im.vector.app.features.session.coroutineScope
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.parcelize.Parcelize
|
||||
@ -39,6 +40,9 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
||||
private val activeSessionHolder: ActiveSessionHolder,
|
||||
private val errorFormatter: ErrorFormatter) {
|
||||
|
||||
private val sessionScope: CoroutineScope
|
||||
get() = activeSessionHolder.getActiveSession().coroutineScope
|
||||
|
||||
@Parcelize
|
||||
data class Data(
|
||||
override val eventId: String,
|
||||
@ -76,7 +80,7 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
||||
thumbnailView.isVisible = true
|
||||
loadingView.isVisible = true
|
||||
|
||||
GlobalScope.launch {
|
||||
sessionScope.launch {
|
||||
val result = runCatching {
|
||||
activeSessionHolder.getActiveSession().fileService()
|
||||
.downloadFile(
|
||||
@ -119,7 +123,7 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
||||
thumbnailView.isVisible = true
|
||||
loadingView.isVisible = true
|
||||
|
||||
GlobalScope.launch {
|
||||
sessionScope.launch {
|
||||
val result = runCatching {
|
||||
activeSessionHolder.getActiveSession().fileService()
|
||||
.downloadFile(
|
||||
|
Loading…
Reference in New Issue
Block a user