diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt
index 6ab0597f5b75..49b0453824f3 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionUpdateJob.kt
@@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.notification
import rx.Observable
+import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
import timber.log.Timber
import uy.kohesive.injekt.Injekt
@@ -24,7 +25,6 @@ class ExtensionUpdateJob : Job() {
val extensionManager: ExtensionManager = Injekt.get()
extensionManager.findAvailableExtensions()
- Observable.defer {
extensionManager.getInstalledExtensionsObservable().map { list ->
val pendingUpdates = list.filter { it.hasUpdate }
if (pendingUpdates.isNotEmpty()) {
@@ -56,8 +56,9 @@ class ExtensionUpdateJob : Job() {
}
}
Result.SUCCESS
- }
- }.subscribeOn(Schedulers.io())
+ }.take(1)
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribeOn(Schedulers.io())
.subscribe({
}, {
Timber.e(it)
diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt
index 24754100e8b4..272d2fb1ee5c 100644
--- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt
+++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt
@@ -14,6 +14,7 @@ import androidx.core.graphics.ColorUtils
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import com.afollestad.materialdialogs.MaterialDialog
+import com.bluelinelabs.conductor.ControllerChangeHandler
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.database.models.Manga
@@ -130,6 +131,13 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
sourceManager.get(value) as? CatalogueSource }
if (config == null) return
for(manga in mangas) {
+ if (migrationsJob?.isCancelled == true) {
+ break
+ }
+ // in case it was removed
+ if (manga.mangaId !in config.mangaIds) {
+ continue
+ }
if(!manga.searchResult.initialized && manga.migrationJob.isActive) {
val mangaObj = manga.manga()
@@ -243,7 +251,9 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
override fun updateCount() {
launchUI {
- setTitle()
+ if (router.backstack.last().controller() == this@MigrationListController) {
+ setTitle()
+ }
}
}
@@ -369,6 +379,24 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
}
}
+ override fun handleBack(): Boolean {
+ activity?.let {
+ MaterialDialog.Builder(it).title(R.string.stop_migration)
+ .positiveText(R.string.yes)
+ .negativeText(R.string.no)
+ .onPositive { _, _ ->
+ router.popCurrentController()
+ migrationsJob?.cancel()
+ }
+ .show()
+ }
+ return true
+ }
+
+ override fun onDestroyView(view: View) {
+ super.onDestroyView(view)
+ }
+
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.migration_list, menu)
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index dbfa7e535eba..f094e259e37b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -436,9 +436,11 @@
(skipping %1$d)
%1$s manga migrated
No
+ Yes
No chapters found, this manga cannot be used for
migration
No Alternatives Found
+ Stop migrating?
Tracking