From d2f4c43526769ff8928d273d2e95e29fc5688bbc Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 14 Jun 2022 22:31:39 -0400 Subject: [PATCH] Minor cleanup --- .../kanade/tachiyomi/source/SourceManager.kt | 1 + .../ui/base/presenter/BasePresenter.kt | 25 ------------------- .../kanade/tachiyomi/ui/main/MainActivity.kt | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt index e471ccfcaa..2f3dbbe3cf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt @@ -104,6 +104,7 @@ class SourceManager(private val context: Context) { } return StubSource(SourceData(id, "", "")) } + @Suppress("OverridingDeprecatedMember") open inner class StubSource(val sourceData: SourceData) : Source { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt index 3a68f6479b..d55d169cce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/BasePresenter.kt @@ -7,7 +7,6 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel import nucleus.presenter.RxPresenter -import nucleus.presenter.delivery.Delivery import rx.Observable open class BasePresenter : RxPresenter() { @@ -67,28 +66,4 @@ open class BasePresenter : RxPresenter() { * @param onError function to execute when the observable throws an error. */ fun Observable.subscribeReplay(onNext: (V, T) -> Unit, onError: ((V, Throwable) -> Unit) = { _, _ -> }) = compose(deliverReplay()).subscribe(split(onNext, onError)).apply { add(this) } - - /** - * Subscribes an observable with [DeliverWithView] and adds it to the presenter's lifecycle - * subscription list. - * - * @param onNext function to execute when the observable emits an item. - * @param onError function to execute when the observable throws an error. - */ - fun Observable.subscribeWithView(onNext: (V, T) -> Unit, onError: ((V, Throwable) -> Unit) = { _, _ -> }) = compose(DeliverWithView(view())).subscribe(split(onNext, onError)).apply { add(this) } - - /** - * A deliverable that only emits to the view if attached, otherwise the event is ignored. - */ - class DeliverWithView(private val view: Observable) : Observable.Transformer> { - - override fun call(observable: Observable): Observable> { - return observable - .materialize() - .filter { notification -> !notification.isOnCompleted } - .flatMap { notification -> - view.take(1).filter { it != null }.map { Delivery(it, notification) } - } - } - } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 0fa44486fb..18c50a6f85 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -368,7 +368,7 @@ class MainActivity : BaseActivity() { try { ExtensionGithubApi().checkForUpdates( this@MainActivity, - fromAvailableExtensionList = true + fromAvailableExtensionList = true, )?.let { pendingUpdates -> preferences.extensionUpdatesCount().set(pendingUpdates.size) }