Explorar o código

Add ID search workaround for MAL tracking

arkon %!s(int64=4) %!d(string=hai) anos
pai
achega
a49adbd09c

+ 6 - 0
app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt

@@ -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) })
     }
 

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeListApi.kt

@@ -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())