mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Add ID search workaround for MAL tracking
This commit is contained in:
parent
3df98d576e
commit
a49adbd09c
@ -76,6 +76,12 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
||||
}
|
||||
|
||||
override fun search(query: String): Observable<List<TrackSearch>> {
|
||||
if (query.startsWith("my:")) {
|
||||
query.substringAfter("my:").toIntOrNull()?.let { id ->
|
||||
return runAsObservable({ listOf(api.getMangaDetails(id)) })
|
||||
}
|
||||
}
|
||||
|
||||
return runAsObservable({ api.search(query) })
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getMangaDetails(id: Int): TrackSearch {
|
||||
suspend fun getMangaDetails(id: Int): TrackSearch {
|
||||
return withContext(Dispatchers.IO) {
|
||||
val url = "$baseApiUrl/manga".toUri().buildUpon()
|
||||
.appendPath(id.toString())
|
||||
|
Loading…
Reference in New Issue
Block a user