Reading progress, persist library mode and improve scan feedback
This commit is contained in:
1 parent
e8b18ec472
commit
dbf63c351c
13 files changed
+599
-177
No files matched your search
@@ -449,6 +449,18 @@ actual suspend fun saveReaderFontSettings(settings: ReaderFontSettings) = withCo
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun loadReaderFullScreen(): Boolean = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.getAppFlag(ReaderFullScreenFlag)?.toBooleanStrictOrNull() ?: false
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun saveReaderFullScreen(fullScreen: Boolean) = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.setAppFlag(ReaderFullScreenFlag, fullScreen.toString())
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun loadScanDownloadsAutomatically(): Boolean = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.getAppFlag(ScanDownloadsAutomaticallyFlag)?.toBooleanStrictOrNull() ?: true
|
||||
@@ -461,6 +473,20 @@ actual suspend fun saveScanDownloadsAutomatically(enabled: Boolean) = withContex
|
||||
}
|
||||
}
|
||||
|
||||
internal actual suspend fun loadLibraryFilter(): LibraryFilter = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.getAppFlag(LibraryFilterFlag)
|
||||
?.let { runCatching { LibraryFilter.valueOf(it) }.getOrNull() }
|
||||
?: LibraryFilter.MyLibrary
|
||||
}
|
||||
}
|
||||
|
||||
internal actual suspend fun saveLibraryFilter(filter: LibraryFilter) = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.setAppFlag(LibraryFilterFlag, filter.name)
|
||||
}
|
||||
}
|
||||
|
||||
actual suspend fun loadAppLocaleTag(): String? = withContext(Dispatchers.IO) {
|
||||
openLibraryDatabase().useLibrary { db ->
|
||||
db.getAppFlag(AppLocaleTagFlag)?.takeIf { it.isNotBlank() }
|
||||
@@ -715,6 +741,8 @@ private fun String.isSupportedBookFile(): Boolean =
|
||||
private const val ActiveReadingFileIdFlag = "active_reading_file_id"
|
||||
private const val ThemeModeFlag = "theme_mode"
|
||||
private const val ReaderFontSettingsFlag = "reader_font_settings"
|
||||
private const val ReaderFullScreenFlag = "reader_full_screen"
|
||||
private const val ScanDownloadsAutomaticallyFlag = "scan_downloads_automatically"
|
||||
private const val LibraryFilterFlag = "library_filter"
|
||||
private const val AppLocaleTagFlag = "app_locale_tag"
|
||||
private const val DownloadsWasScannedFlag = "downloads_was_scanned"
|
||||
Reference in new issue
Block a user