mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-27 11:37:51 +02:00
Deduplicate entries when browsing (#1957)
This commit is contained in:
@ -20,6 +20,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
- Significantly improve browsing speed (near instantaneous) ([@AntsyLich](https://github.com/AntsyLich)) ([#1946](https://github.com/mihonapp/mihon/pull/1946))
|
- Significantly improve browsing speed (near instantaneous) ([@AntsyLich](https://github.com/AntsyLich)) ([#1946](https://github.com/mihonapp/mihon/pull/1946))
|
||||||
|
- Deduplicate entries when browsing ([@AntsyLich](https://github.com/AntsyLich)) ([#1957](https://github.com/mihonapp/mihon/pull/1957))
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Fix Bangumi search results including novels ([@MajorTanya](https://github.com/MajorTanya)) ([#1885](https://github.com/mihonapp/mihon/pull/1885))
|
- Fix Bangumi search results including novels ([@MajorTanya](https://github.com/MajorTanya)) ([#1885](https://github.com/mihonapp/mihon/pull/1885))
|
||||||
|
@ -165,7 +165,9 @@ abstract class SearchScreenModel(
|
|||||||
source.getSearchManga(1, query, source.getFilterList())
|
source.getSearchManga(1, query, source.getFilterList())
|
||||||
}
|
}
|
||||||
|
|
||||||
val titles = page.mangas.map { it.toDomainManga(source.id) }
|
val titles = page.mangas
|
||||||
|
.map { it.toDomainManga(source.id) }
|
||||||
|
.distinctBy { it.url }
|
||||||
.let { networkToLocalManga(it) }
|
.let { networkToLocalManga(it) }
|
||||||
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
|
@ -39,6 +39,8 @@ abstract class BaseSourcePagingSource(
|
|||||||
private val networkToLocalManga: NetworkToLocalManga = Injekt.get(),
|
private val networkToLocalManga: NetworkToLocalManga = Injekt.get(),
|
||||||
) : SourcePagingSource() {
|
) : SourcePagingSource() {
|
||||||
|
|
||||||
|
private val seenManga = hashSetOf<String>()
|
||||||
|
|
||||||
abstract suspend fun requestNextPage(currentPage: Int): MangasPage
|
abstract suspend fun requestNextPage(currentPage: Int): MangasPage
|
||||||
|
|
||||||
override suspend fun load(params: LoadParams<Long>): LoadResult<Long, Manga> {
|
override suspend fun load(params: LoadParams<Long>): LoadResult<Long, Manga> {
|
||||||
@ -51,7 +53,9 @@ abstract class BaseSourcePagingSource(
|
|||||||
?: throw NoResultsException()
|
?: throw NoResultsException()
|
||||||
}
|
}
|
||||||
|
|
||||||
val manga = mangasPage.mangas.map { it.toDomainManga(source.id) }
|
val manga = mangasPage.mangas
|
||||||
|
.map { it.toDomainManga(source.id) }
|
||||||
|
.filter { seenManga.add(it.url) }
|
||||||
.let { networkToLocalManga(it) }
|
.let { networkToLocalManga(it) }
|
||||||
|
|
||||||
LoadResult.Page(
|
LoadResult.Page(
|
||||||
|
Reference in New Issue
Block a user