From 97becdb7e3ca077999789eb100613c48adfc498b Mon Sep 17 00:00:00 2001 From: tarsin Date: Wed, 29 Mar 2023 18:29:40 +0800 Subject: [PATCH] Fix to use NonCancellable coroutine ctx Now that it's suspend --- .../com/hippo/ehviewer/ui/fragment/DownloadFragment.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.kt b/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.kt index c1c951d58..245906879 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/fragment/DownloadFragment.kt @@ -29,7 +29,7 @@ import com.hippo.ehviewer.ui.keepNoMediaFileStatus import com.hippo.ehviewer.ui.scene.BaseScene import com.hippo.unifile.UniFile import com.hippo.util.ExceptionUtils -import eu.kanade.tachiyomi.util.lang.launchIO +import eu.kanade.tachiyomi.util.lang.launchNonCancellable class DownloadFragment : BasePreferenceFragment() { private var mDownloadLocation: Preference? = null @@ -44,7 +44,7 @@ class DownloadFragment : BasePreferenceFragment() { val uniFile = UniFile.fromTreeUri(activity, treeUri) if (uniFile != null) { Settings.putDownloadLocation(uniFile) - lifecycleScope.launchIO { + lifecycleScope.launchNonCancellable { keepNoMediaFileStatus() } onUpdateDownloadLocation() @@ -100,7 +100,7 @@ class DownloadFragment : BasePreferenceFragment() { val uniFile = UniFile.fromFile(AppConfig.getDefaultDownloadDir()) if (uniFile != null) { Settings.putDownloadLocation(uniFile) - lifecycleScope.launchIO { + lifecycleScope.launchNonCancellable { keepNoMediaFileStatus() } onUpdateDownloadLocation() @@ -133,7 +133,7 @@ class DownloadFragment : BasePreferenceFragment() { val key = preference.key if (Settings.KEY_MEDIA_SCAN == key) { if (newValue is Boolean) { - lifecycleScope.launchIO { + lifecycleScope.launchNonCancellable { keepNoMediaFileStatus() } }