mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-25 09:10:53 +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.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
import im.vector.app.core.files.LocalFilesHelper
|
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.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
@ -39,6 +40,9 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
|||||||
private val activeSessionHolder: ActiveSessionHolder,
|
private val activeSessionHolder: ActiveSessionHolder,
|
||||||
private val errorFormatter: ErrorFormatter) {
|
private val errorFormatter: ErrorFormatter) {
|
||||||
|
|
||||||
|
private val sessionScope: CoroutineScope
|
||||||
|
get() = activeSessionHolder.getActiveSession().coroutineScope
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class Data(
|
data class Data(
|
||||||
override val eventId: String,
|
override val eventId: String,
|
||||||
@ -76,7 +80,7 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
|||||||
thumbnailView.isVisible = true
|
thumbnailView.isVisible = true
|
||||||
loadingView.isVisible = true
|
loadingView.isVisible = true
|
||||||
|
|
||||||
GlobalScope.launch {
|
sessionScope.launch {
|
||||||
val result = runCatching {
|
val result = runCatching {
|
||||||
activeSessionHolder.getActiveSession().fileService()
|
activeSessionHolder.getActiveSession().fileService()
|
||||||
.downloadFile(
|
.downloadFile(
|
||||||
@ -119,7 +123,7 @@ class VideoContentRenderer @Inject constructor(private val localFilesHelper: Loc
|
|||||||
thumbnailView.isVisible = true
|
thumbnailView.isVisible = true
|
||||||
loadingView.isVisible = true
|
loadingView.isVisible = true
|
||||||
|
|
||||||
GlobalScope.launch {
|
sessionScope.launch {
|
||||||
val result = runCatching {
|
val result = runCatching {
|
||||||
activeSessionHolder.getActiveSession().fileService()
|
activeSessionHolder.getActiveSession().fileService()
|
||||||
.downloadFile(
|
.downloadFile(
|
||||||
|
Loading…
Reference in New Issue
Block a user