From 1e708b113b28966d4636fd3acd139c827469c3b8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 May 2021 15:20:22 +0200 Subject: [PATCH] Remove usage of GlobalScope --- .../app/features/settings/VectorSettingsGeneralFragment.kt | 3 +-- .../app/features/spaces/SpaceSettingsMenuBottomSheet.kt | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt index 334464e304..adab8f8630 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt @@ -52,7 +52,6 @@ import im.vector.app.features.MainActivityArgs import im.vector.app.features.workers.signout.SignOutUiWorker import io.reactivex.android.schedulers.AndroidSchedulers import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.matrix.android.sdk.api.failure.isInvalidPassword @@ -224,7 +223,7 @@ class VectorSettingsGeneralFragment @Inject constructor( it.summary = TextUtils.formatFileSize(requireContext(), size.toLong()) it.onPreferenceClickListener = Preference.OnPreferenceClickListener { - GlobalScope.launch(Dispatchers.Main) { + lifecycleScope.launch(Dispatchers.Main) { // On UI Thread displayLoadingView() diff --git a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt index 1586b16ff6..01a0ba4b56 100644 --- a/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt +++ b/vector/src/main/java/im/vector/app/features/spaces/SpaceSettingsMenuBottomSheet.kt @@ -36,11 +36,11 @@ import im.vector.app.features.powerlevel.PowerLevelsObservableFactory import im.vector.app.features.rageshake.BugReporter import im.vector.app.features.rageshake.ReportType import im.vector.app.features.roomprofile.RoomProfileActivity +import im.vector.app.features.session.coroutineScope import im.vector.app.features.settings.VectorPreferences import im.vector.app.features.spaces.manage.ManageType import im.vector.app.features.spaces.manage.SpaceManageActivity import io.reactivex.android.schedulers.AndroidSchedulers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.parcelize.Parcelize import org.matrix.android.sdk.api.session.events.model.EventType @@ -140,7 +140,7 @@ class SpaceSettingsMenuBottomSheet : VectorBaseBottomSheetDialogFragment - GlobalScope.launch { + session.coroutineScope.launch { try { session.getRoom(spaceArgs.spaceId)?.leave(null) } catch (failure: Throwable) {