Fixes for extension notifcatinos + Confirm exit for migrations
This commit is contained in:
parent
a435c00290
commit
640bd8d9ba
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
|||||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||||
import eu.kanade.tachiyomi.util.notification
|
import eu.kanade.tachiyomi.util.notification
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
import rx.schedulers.Schedulers
|
import rx.schedulers.Schedulers
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
@ -24,7 +25,6 @@ class ExtensionUpdateJob : Job() {
|
|||||||
val extensionManager: ExtensionManager = Injekt.get()
|
val extensionManager: ExtensionManager = Injekt.get()
|
||||||
extensionManager.findAvailableExtensions()
|
extensionManager.findAvailableExtensions()
|
||||||
|
|
||||||
Observable.defer {
|
|
||||||
extensionManager.getInstalledExtensionsObservable().map { list ->
|
extensionManager.getInstalledExtensionsObservable().map { list ->
|
||||||
val pendingUpdates = list.filter { it.hasUpdate }
|
val pendingUpdates = list.filter { it.hasUpdate }
|
||||||
if (pendingUpdates.isNotEmpty()) {
|
if (pendingUpdates.isNotEmpty()) {
|
||||||
@ -56,8 +56,9 @@ class ExtensionUpdateJob : Job() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Result.SUCCESS
|
Result.SUCCESS
|
||||||
}
|
}.take(1)
|
||||||
}.subscribeOn(Schedulers.io())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe({
|
.subscribe({
|
||||||
}, {
|
}, {
|
||||||
Timber.e(it)
|
Timber.e(it)
|
||||||
|
@ -14,6 +14,7 @@ import androidx.core.graphics.ColorUtils
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
|
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -130,6 +131,13 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
sourceManager.get(value) as? CatalogueSource }
|
sourceManager.get(value) as? CatalogueSource }
|
||||||
if (config == null) return
|
if (config == null) return
|
||||||
for(manga in mangas) {
|
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) {
|
if(!manga.searchResult.initialized && manga.migrationJob.isActive) {
|
||||||
val mangaObj = manga.manga()
|
val mangaObj = manga.manga()
|
||||||
|
|
||||||
@ -243,9 +251,11 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
|
|
||||||
override fun updateCount() {
|
override fun updateCount() {
|
||||||
launchUI {
|
launchUI {
|
||||||
|
if (router.backstack.last().controller() == this@MigrationListController) {
|
||||||
setTitle()
|
setTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
@ -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) {
|
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||||
inflater.inflate(R.menu.migration_list, menu)
|
inflater.inflate(R.menu.migration_list, menu)
|
||||||
}
|
}
|
||||||
|
@ -436,9 +436,11 @@
|
|||||||
<string name="skipping_x">(skipping %1$d)</string>
|
<string name="skipping_x">(skipping %1$d)</string>
|
||||||
<string name="x_migrations">%1$s manga migrated</string>
|
<string name="x_migrations">%1$s manga migrated</string>
|
||||||
<string name="no">No</string>
|
<string name="no">No</string>
|
||||||
|
<string name="yes">Yes</string>
|
||||||
<string name="error_fetching_migration">No chapters found, this manga cannot be used for
|
<string name="error_fetching_migration">No chapters found, this manga cannot be used for
|
||||||
migration</string>
|
migration</string>
|
||||||
<string name="no_alternatives_found">No Alternatives Found</string>
|
<string name="no_alternatives_found">No Alternatives Found</string>
|
||||||
|
<string name="stop_migration">Stop migrating?</string>
|
||||||
|
|
||||||
<!-- Tracking Screen -->
|
<!-- Tracking Screen -->
|
||||||
<string name="manga_tracking_tab">Tracking</string>
|
<string name="manga_tracking_tab">Tracking</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user