mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Add ID search workaround for MAL tracking
This commit is contained in:
		@@ -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())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user