mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 22:37:56 +01:00 
			
		
		
		
	Fix chapter list live update (#7296)
This commit is contained in:
		| @@ -6,6 +6,7 @@ import eu.kanade.domain.chapter.model.Chapter | ||||
| import eu.kanade.domain.chapter.model.ChapterUpdate | ||||
| import eu.kanade.domain.chapter.repository.ChapterRepository | ||||
| import eu.kanade.tachiyomi.util.system.logcat | ||||
| import kotlinx.coroutines.flow.Flow | ||||
| import logcat.LogPriority | ||||
|  | ||||
| class ChapterRepositoryImpl( | ||||
| @@ -96,11 +97,10 @@ class ChapterRepositoryImpl( | ||||
|     } | ||||
|  | ||||
|     override suspend fun getChapterByMangaId(mangaId: Long): List<Chapter> { | ||||
|         return try { | ||||
|             handler.awaitList { chaptersQueries.getChapterByMangaId(mangaId, chapterMapper) } | ||||
|         } catch (e: Exception) { | ||||
|             logcat(LogPriority.ERROR, e) | ||||
|             emptyList() | ||||
|         } | ||||
|         return handler.awaitList { chaptersQueries.getChaptersByMangaId(mangaId, chapterMapper) } | ||||
|     } | ||||
|  | ||||
|     override suspend fun getChapterByMangaIdFlow(mangaId: Long): Flow<List<Chapter>> { | ||||
|         return handler.subscribeToList { chaptersQueries.getChaptersByMangaId(mangaId, chapterMapper) } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -47,7 +47,7 @@ class HistoryRepositoryImpl( | ||||
|             else -> throw NotImplementedError("Unknown sorting method") | ||||
|         } | ||||
|  | ||||
|         val chapters = handler.awaitList { chaptersQueries.getChapterByMangaId(mangaId, chapterMapper) } | ||||
|         val chapters = handler.awaitList { chaptersQueries.getChaptersByMangaId(mangaId, chapterMapper) } | ||||
|             .sortedWith(sortFunction) | ||||
|  | ||||
|         val currChapterIndex = chapters.indexOfFirst { chapter.id == it.id } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user