Persist book status and add recent catalog section
This commit is contained in:
1 parent
6422f814d1
commit
44cc0bbaf3
8 files changed
+136
-2
No files matched your search
@@ -94,6 +94,13 @@ actual suspend fun loadLibraryItemsPage(limit: Int, offset: Int): List<LibraryIt
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun loadRecentlyAddedLibraryItems(sinceImportedAt: Long, limit: Int): List<LibraryItem> = withContext(Dispatchers.IO) {
|
||||
appendLibraryLog("load recently added library items since=$sinceImportedAt limit=$limit")
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.files.listRecentlyAddedLibraryFiles(sinceImportedAt, limit).map { it.toLibraryItem() }
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun searchLibraryItems(query: String, limit: Int): List<LibraryItem> = withContext(Dispatchers.IO) {
|
||||
val prefixes = query.toSearchPrefixes()
|
||||
if (prefixes.isEmpty()) return@withContext emptyList()
|
||||
@@ -103,6 +110,8 @@ actual suspend fun searchLibraryItems(query: String, limit: Int): List<LibraryIt
|
||||
}
|
||||
}
|
||||
|
||||
actual fun currentLibraryTimeMillis(): Long = System.currentTimeMillis()
|
||||
|
||||
actual suspend fun loadLibraryItem(fileId: String): LibraryItem? = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.files.getLibraryFile(fileId)?.toLibraryItem()
|
||||
|
||||
Reference in new issue
Block a user