diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt index 5dfc7462f..906edc040 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/TrackService.kt @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.network.NetworkHelper import okhttp3.OkHttpClient -import rx.Observable import uy.kohesive.injekt.injectLazy abstract class TrackService(val id: Int) { @@ -48,7 +47,7 @@ abstract class TrackService(val id: Int) { abstract suspend fun bind(track: Track): Track - abstract fun search(query: String): Observable> + abstract suspend fun search(query: String): List abstract suspend fun refresh(track: Track): Track diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt index 416641800..6cdc17889 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/Anilist.kt @@ -6,11 +6,9 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch -import eu.kanade.tachiyomi.util.lang.runAsObservable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import rx.Observable import uy.kohesive.injekt.injectLazy class Anilist(private val context: Context, id: Int) : TrackService(id) { @@ -160,8 +158,8 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) { } } - override fun search(query: String): Observable> { - return runAsObservable({ api.search(query) }) + override suspend fun search(query: String): List { + return api.search(query) } override suspend fun refresh(track: Track): Track { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt index 7973d78c6..ff54e6eab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/Bangumi.kt @@ -6,11 +6,9 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch -import eu.kanade.tachiyomi.util.lang.runAsObservable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import rx.Observable import uy.kohesive.injekt.injectLazy class Bangumi(private val context: Context, id: Int) : TrackService(id) { @@ -57,8 +55,8 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) { } } - override fun search(query: String): Observable> { - return runAsObservable({ api.search(query) }) + override suspend fun search(query: String): List { + return api.search(query) } override suspend fun refresh(track: Track): Track { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt index 279c969ce..36f0db94a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/Kitsu.kt @@ -6,11 +6,9 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch -import eu.kanade.tachiyomi.util.lang.runAsObservable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import rx.Observable import uy.kohesive.injekt.injectLazy import java.text.DecimalFormat @@ -91,8 +89,8 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) { } } - override fun search(query: String): Observable> { - return runAsObservable({ api.search(query) }) + override suspend fun search(query: String): List { + return api.search(query) } override suspend fun refresh(track: Track): Track { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index 416957031..dc7d3b5da 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -6,11 +6,9 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch -import eu.kanade.tachiyomi.util.lang.runAsObservable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import rx.Observable import uy.kohesive.injekt.injectLazy class MyAnimeList(private val context: Context, id: Int) : TrackService(id) { @@ -83,14 +81,14 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) { } } - override fun search(query: String): Observable> { + override suspend fun search(query: String): List { if (query.startsWith(SEARCH_ID_PREFIX)) { query.substringAfter(SEARCH_ID_PREFIX).toIntOrNull()?.let { id -> - return runAsObservable({ listOf(api.getMangaDetails(id)) }) + return listOf(api.getMangaDetails(id)) } } - return runAsObservable({ api.search(query) }) + return api.search(query) } override suspend fun refresh(track: Track): Track { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt index 99b8ae396..eebe0eb46 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/Shikimori.kt @@ -6,11 +6,9 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.data.track.model.TrackSearch -import eu.kanade.tachiyomi.util.lang.runAsObservable import kotlinx.serialization.decodeFromString import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json -import rx.Observable import uy.kohesive.injekt.injectLazy class Shikimori(private val context: Context, id: Int) : TrackService(id) { @@ -65,8 +63,8 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) { } } - override fun search(query: String): Observable> { - return runAsObservable({ api.search(query) }) + override suspend fun search(query: String): List { + return api.search(query) } override suspend fun refresh(track: Track): Track { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt index d93ea1757..8f854eaed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackPresenter.kt @@ -79,7 +79,7 @@ class TrackPresenter( fun search(query: String, service: TrackService) { searchSubscription?.let { remove(it) } - searchSubscription = service.search(query) + searchSubscription = runAsObservable({ service.search(query) }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribeLatestCache(