From 0316cf47ed865156c00f636fe6401df909739d65 Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sun, 24 May 2020 13:37:43 -0400 Subject: [PATCH] Fix merge with another crash(because of the kotlin dependency update) --- .../ui/smartsearch/SmartSearchController.kt | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/exh/ui/smartsearch/SmartSearchController.kt b/app/src/main/java/exh/ui/smartsearch/SmartSearchController.kt index 66a29f25f..be0dce9f4 100644 --- a/app/src/main/java/exh/ui/smartsearch/SmartSearchController.kt +++ b/app/src/main/java/exh/ui/smartsearch/SmartSearchController.kt @@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job -import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.cancel import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -61,27 +60,25 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController().eh_useNewMangaInterface().get()) { - MangaAllInOneController(event.manga, true, smartSearchConfig).withFadeTransaction() - } else { - MangaController(event.manga, true, smartSearchConfig).withFadeTransaction() - } - withContext(Dispatchers.Main) { - router.replaceTopController(transaction) - } + if (event is SmartSearchPresenter.SearchResults.Found) { + val transaction = if (Injekt.get().eh_useNewMangaInterface().get()) { + MangaAllInOneController(event.manga, true, smartSearchConfig).withFadeTransaction() } else { - if (event is SmartSearchPresenter.SearchResults.NotFound) { - applicationContext?.toast("Couldn't find the manga in the source!") - } else { - applicationContext?.toast("Error performing automatic search!") - } + MangaController(event.manga, true, smartSearchConfig).withFadeTransaction() + } + withContext(Dispatchers.Main) { + 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() - withContext(Dispatchers.Main) { - router.replaceTopController(transaction) - } + val transaction = BrowseSourceController(source, smartSearchConfig.origTitle, smartSearchConfig).withFadeTransaction() + withContext(Dispatchers.Main) { + router.replaceTopController(transaction) } } }