Add src:local search alias for Local Source (#2928)
This commit is contained in:
@@ -16,6 +16,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
- Display author & artist name in MAL search results ([@MajorTanya](https://github.com/MajorTanya)) ([#2833](https://github.com/mihonapp/mihon/pull/2833))
|
- Display author & artist name in MAL search results ([@MajorTanya](https://github.com/MajorTanya)) ([#2833](https://github.com/mihonapp/mihon/pull/2833))
|
||||||
- Add filter options to Updates tab ([@MajorTanya](https://github.com/MajorTanya)) ([#2851](https://github.com/mihonapp/mihon/pull/2851))
|
- Add filter options to Updates tab ([@MajorTanya](https://github.com/MajorTanya)) ([#2851](https://github.com/mihonapp/mihon/pull/2851))
|
||||||
- Add `src:` prefix to search the library by source ID ([@MajorTanya](https://github.com/MajorTanya)) ([#2927](https://github.com/mihonapp/mihon/pull/2927))
|
- Add `src:` prefix to search the library by source ID ([@MajorTanya](https://github.com/MajorTanya)) ([#2927](https://github.com/mihonapp/mihon/pull/2927))
|
||||||
|
- Add `src:local` as a way to search for Local Source entries ([@MajorTanya](https://github.com/MajorTanya)) ([#2928](https://github.com/mihonapp/mihon/pull/2928))
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
- Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266))
|
- Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266))
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ package eu.kanade.tachiyomi.ui.library
|
|||||||
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.source.service.SourceManager
|
import tachiyomi.domain.source.service.SourceManager
|
||||||
|
import tachiyomi.source.local.LocalSource
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
|
private const val LOCAL_SOURCE_ID_ALIAS = "local"
|
||||||
|
|
||||||
data class LibraryItem(
|
data class LibraryItem(
|
||||||
val libraryManga: LibraryManga,
|
val libraryManga: LibraryManga,
|
||||||
val downloadCount: Long = -1,
|
val downloadCount: Long = -1,
|
||||||
@@ -28,7 +31,12 @@ data class LibraryItem(
|
|||||||
if (constraint.startsWith("id:", true)) {
|
if (constraint.startsWith("id:", true)) {
|
||||||
return id == constraint.substringAfter("id:").toLongOrNull()
|
return id == constraint.substringAfter("id:").toLongOrNull()
|
||||||
} else if (constraint.startsWith("src:", true)) {
|
} else if (constraint.startsWith("src:", true)) {
|
||||||
return source.id == constraint.substringAfter("src:").toLongOrNull()
|
val querySource = constraint.substringAfter("src:")
|
||||||
|
return if (querySource.equals(LOCAL_SOURCE_ID_ALIAS, ignoreCase = true)) {
|
||||||
|
source.id == LocalSource.ID
|
||||||
|
} else {
|
||||||
|
source.id == querySource.toLongOrNull()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return libraryManga.manga.title.contains(constraint, true) ||
|
return libraryManga.manga.title.contains(constraint, true) ||
|
||||||
(libraryManga.manga.author?.contains(constraint, true) ?: false) ||
|
(libraryManga.manga.author?.contains(constraint, true) ?: false) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user