Fix merge with another crash(because of the kotlin dependency update)

This commit is contained in:
Jobobby04 2020-05-24 13:37:43 -04:00
parent e4c8de1145
commit 0316cf47ed

View File

@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -61,27 +60,25 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSea
launch(Dispatchers.Default) { launch(Dispatchers.Default) {
for (event in presenter.smartSearchChannel) { for (event in presenter.smartSearchChannel) {
withContext(NonCancellable) { if (event is SmartSearchPresenter.SearchResults.Found) {
if (event is SmartSearchPresenter.SearchResults.Found) { val transaction = if (Injekt.get<PreferencesHelper>().eh_useNewMangaInterface().get()) {
val transaction = if (Injekt.get<PreferencesHelper>().eh_useNewMangaInterface().get()) { MangaAllInOneController(event.manga, true, smartSearchConfig).withFadeTransaction()
MangaAllInOneController(event.manga, true, smartSearchConfig).withFadeTransaction()
} else {
MangaController(event.manga, true, smartSearchConfig).withFadeTransaction()
}
withContext(Dispatchers.Main) {
router.replaceTopController(transaction)
}
} else { } else {
if (event is SmartSearchPresenter.SearchResults.NotFound) { MangaController(event.manga, true, smartSearchConfig).withFadeTransaction()
applicationContext?.toast("Couldn't find the manga in the source!") }
} else { withContext(Dispatchers.Main) {
applicationContext?.toast("Error performing automatic search!") router.replaceTopController(transaction)
} }
} else {
if (event is SmartSearchPresenter.SearchResults.NotFound) {
applicationContext?.toast("Couldn't find the manga in the source!")
} else {
applicationContext?.toast("Error performing automatic search!")
}
val transaction = BrowseSourceController(source, smartSearchConfig.origTitle, smartSearchConfig).withFadeTransaction() val transaction = BrowseSourceController(source, smartSearchConfig.origTitle, smartSearchConfig).withFadeTransaction()
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
router.replaceTopController(transaction) router.replaceTopController(transaction)
}
} }
} }
} }