Add "src:" prefix to search by source ID (#2927)

Allows users to search for the exact source ID in their library.

Similar to the Browse > Migrate screen, but filtered in the Library,
where users can take all the usual actions.

Could be used in the future to change the search behaviour of tapping
the source name in the title info view to search by the ID with this
prefix.
This commit is contained in:
MajorTanya
2026-02-03 10:54:22 +01:00
committed by GitHub
parent 100cea0757
commit 4e4bdffdf3
2 changed files with 5 additions and 1 deletions
@@ -23,9 +23,12 @@ data class LibraryItem(
* @return true if the manga matches the query, false otherwise.
*/
fun matches(constraint: String): Boolean {
val sourceName by lazy { sourceManager.getOrStub(libraryManga.manga.source).getNameForMangaInfo() }
val source = sourceManager.getOrStub(libraryManga.manga.source)
val sourceName by lazy { source.getNameForMangaInfo() }
if (constraint.startsWith("id:", true)) {
return id == constraint.substringAfter("id:").toLongOrNull()
} else if (constraint.startsWith("src:", true)) {
return source.id == constraint.substringAfter("src:").toLongOrNull()
}
return libraryManga.manga.title.contains(constraint, true) ||
(libraryManga.manga.author?.contains(constraint, true) ?: false) ||