mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Allow extensions to open manga or chapter by URL (#9996)
* open manga and chapter using URL * removing unnnecessary logs * Resolving comments * Resolving comments
This commit is contained in:
		@@ -0,0 +1,17 @@
 | 
			
		||||
package tachiyomi.domain.chapter.interactor
 | 
			
		||||
 | 
			
		||||
import tachiyomi.domain.chapter.model.Chapter
 | 
			
		||||
import tachiyomi.domain.chapter.repository.ChapterRepository
 | 
			
		||||
 | 
			
		||||
class GetChapterByUrlAndMangaId(
 | 
			
		||||
    private val chapterRepository: ChapterRepository,
 | 
			
		||||
) {
 | 
			
		||||
 | 
			
		||||
    suspend fun await(url: String, sourceId: Long): Chapter? {
 | 
			
		||||
        return try {
 | 
			
		||||
            chapterRepository.getChapterByUrlAndMangaId(url, sourceId)
 | 
			
		||||
        } catch (e: Exception) {
 | 
			
		||||
            null
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
package tachiyomi.domain.manga.interactor
 | 
			
		||||
 | 
			
		||||
import tachiyomi.domain.manga.model.Manga
 | 
			
		||||
import tachiyomi.domain.manga.repository.MangaRepository
 | 
			
		||||
 | 
			
		||||
class GetMangaByUrlAndSourceId(
 | 
			
		||||
    private val mangaRepository: MangaRepository,
 | 
			
		||||
) {
 | 
			
		||||
    suspend fun awaitManga(url: String, sourceId: Long): Manga? {
 | 
			
		||||
        return mangaRepository.getMangaByUrlAndSourceId(url, sourceId)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user