Deal with SY for the coroutine function changes

This commit is contained in:
Jobobby04
2021-01-10 19:36:24 -05:00
parent 0edff11353
commit a0ac2daad1
27 changed files with 146 additions and 159 deletions
@@ -7,29 +7,26 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.elvishew.xlog.XLog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.controller.DialogController
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.lang.launchUI
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class ConfiguringDialogController : DialogController() {
private var materialDialog: MaterialDialog? = null
val scope = CoroutineScope(Job() + Dispatchers.Main)
val scope = MainScope()
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
if (savedViewState == null) {
scope.launch(Dispatchers.IO) {
scope.launchIO {
try {
EHConfigurator(activity!!).configureAll()
launchUI {
activity?.toast(activity?.getString(R.string.eh_settings_successfully_uploaded))
}
} catch (e: Exception) {
withContext(Dispatchers.Main) {
launchUI {
activity?.let {
MaterialDialog(it)
.title(R.string.eh_settings_configuration_failed)