Using viewscope in about

This commit is contained in:
Jays2Kings 2021-04-26 15:05:10 -04:00
parent 0b4019a1cb
commit f5b5be9e0b

View File

@ -18,9 +18,7 @@ import eu.kanade.tachiyomi.util.lang.toTimestampString
import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.isOnline
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.openInBrowser import eu.kanade.tachiyomi.util.view.openInBrowser
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import timber.log.Timber import timber.log.Timber
@ -44,11 +42,6 @@ class AboutController : SettingsController() {
preferences.dateFormat() preferences.dateFormat()
} }
/**
* The subscribtion service of the obtained release object
*/
private val scope = CoroutineScope(Job() + Dispatchers.IO)
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply { override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
@ -157,7 +150,7 @@ class AboutController : SettingsController() {
if (activity == null) return if (activity == null) return
activity?.toast(R.string.searching_for_updates) activity?.toast(R.string.searching_for_updates)
scope.launch { viewScope.launch {
val result = try { val result = try {
updateChecker.checkForUpdate() updateChecker.checkForUpdate()
} catch (error: Exception) { } catch (error: Exception) {