Skip to content
31 changes: 14 additions & 17 deletions app/detekt-baseline.xml

Large diffs are not rendered by default.

328 changes: 328 additions & 0 deletions app/schemas/io.aatricks.easyreader.data.local.AppDatabase/10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
{
"formatVersion": 1,
"database": {
"version": 10,
"identityHash": "fec9afdebaf15aae07594f5f67087286",
"entities": [
{
"tableName": "library_items",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `title` TEXT NOT NULL, `url` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `progress` INTEGER NOT NULL, `isCurrentlyReading` INTEGER NOT NULL, `currentChapter` TEXT NOT NULL, `currentChapterUrl` TEXT NOT NULL, `totalChapters` INTEGER NOT NULL, `contentType` TEXT NOT NULL, `dateAdded` INTEGER NOT NULL, `lastRead` INTEGER NOT NULL, `isDownloading` INTEGER NOT NULL, `lastScrollPosition` REAL NOT NULL, `lastReadIndex` INTEGER NOT NULL, `lastReadElementKey` TEXT NOT NULL, `lastReadOffsetFraction` REAL NOT NULL, `hasUpdates` INTEGER NOT NULL, `chapterSummaries` TEXT NOT NULL, `baseTitle` TEXT NOT NULL, `readingMode` TEXT NOT NULL, `baseNovelUrl` TEXT NOT NULL, `sourceName` TEXT NOT NULL, `isDownloaded` INTEGER NOT NULL, `downloadedAt` INTEGER, `coverImageUrl` TEXT NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "progress",
"columnName": "progress",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isCurrentlyReading",
"columnName": "isCurrentlyReading",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "currentChapter",
"columnName": "currentChapter",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "currentChapterUrl",
"columnName": "currentChapterUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "totalChapters",
"columnName": "totalChapters",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "contentType",
"columnName": "contentType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "dateAdded",
"columnName": "dateAdded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastRead",
"columnName": "lastRead",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isDownloading",
"columnName": "isDownloading",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastScrollPosition",
"columnName": "lastScrollPosition",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "lastReadIndex",
"columnName": "lastReadIndex",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastReadElementKey",
"columnName": "lastReadElementKey",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lastReadOffsetFraction",
"columnName": "lastReadOffsetFraction",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "hasUpdates",
"columnName": "hasUpdates",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapterSummaries",
"columnName": "chapterSummaries",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseTitle",
"columnName": "baseTitle",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "readingMode",
"columnName": "readingMode",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "baseNovelUrl",
"columnName": "baseNovelUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sourceName",
"columnName": "sourceName",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "isDownloaded",
"columnName": "isDownloaded",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "downloadedAt",
"columnName": "downloadedAt",
"affinity": "INTEGER"
},
{
"fieldPath": "coverImageUrl",
"columnName": "coverImageUrl",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_library_items_url",
"unique": true,
"columnNames": [
"url"
],
"orders": [],
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_library_items_url` ON `${TABLE_NAME}` (`url`)"
},
{
"name": "index_library_items_baseTitle",
"unique": false,
"columnNames": [
"baseTitle"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_library_items_baseTitle` ON `${TABLE_NAME}` (`baseTitle`)"
},
{
"name": "index_library_items_isCurrentlyReading",
"unique": false,
"columnNames": [
"isCurrentlyReading"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_library_items_isCurrentlyReading` ON `${TABLE_NAME}` (`isCurrentlyReading`)"
},
{
"name": "index_library_items_lastRead",
"unique": false,
"columnNames": [
"lastRead"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_library_items_lastRead` ON `${TABLE_NAME}` (`lastRead`)"
}
]
},
{
"tableName": "chapter_image_state",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`chapterUrl` TEXT NOT NULL, `imageUrl` TEXT NOT NULL, `status` TEXT NOT NULL, `attempts` INTEGER NOT NULL, `lastAttemptMs` INTEGER NOT NULL, `httpStatusCode` INTEGER, PRIMARY KEY(`chapterUrl`, `imageUrl`))",
"fields": [
{
"fieldPath": "chapterUrl",
"columnName": "chapterUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "attempts",
"columnName": "attempts",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lastAttemptMs",
"columnName": "lastAttemptMs",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "httpStatusCode",
"columnName": "httpStatusCode",
"affinity": "INTEGER"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"chapterUrl",
"imageUrl"
]
},
"indices": [
{
"name": "index_chapter_image_state_chapterUrl",
"unique": false,
"columnNames": [
"chapterUrl"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_chapter_image_state_chapterUrl` ON `${TABLE_NAME}` (`chapterUrl`)"
},
{
"name": "index_chapter_image_state_status",
"unique": false,
"columnNames": [
"status"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_chapter_image_state_status` ON `${TABLE_NAME}` (`status`)"
}
]
},
{
"tableName": "image_dimension_cache",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`imageUrl` TEXT NOT NULL, `width` INTEGER NOT NULL, `height` INTEGER NOT NULL, `cachedAtMs` INTEGER NOT NULL, `parserVersion` INTEGER NOT NULL, PRIMARY KEY(`imageUrl`))",
"fields": [
{
"fieldPath": "imageUrl",
"columnName": "imageUrl",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "width",
"columnName": "width",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "height",
"columnName": "height",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "cachedAtMs",
"columnName": "cachedAtMs",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "parserVersion",
"columnName": "parserVersion",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"imageUrl"
]
}
}
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'fec9afdebaf15aae07594f5f67087286')"
]
}
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

<application
android:name=".EasyReaderApplication"
android:enableOnBackInvokedCallback="true"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/io/aatricks/easyreader/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import kotlinx.coroutines.launch
import javax.inject.Inject

import androidx.hilt.navigation.compose.hiltViewModel
import io.aatricks.easyreader.data.local.PreferencesManager
import io.aatricks.easyreader.ui.components.appUpdateHandler
import io.aatricks.easyreader.ui.viewmodel.ExploreViewModel
import io.aatricks.easyreader.ui.viewmodel.UpdateViewModel
Expand All @@ -60,6 +61,7 @@ class MainActivity : ComponentActivity() {
private val libraryViewModel: LibraryViewModel by viewModels()

@Inject lateinit var contentRepository: ContentRepository
@Inject lateinit var preferencesManager: PreferencesManager

private val filePickerLauncher = registerForActivityResult(
ActivityResultContracts.OpenDocument()
Expand Down Expand Up @@ -89,10 +91,18 @@ class MainActivity : ComponentActivity() {
val readerUiState by readerViewModel.uiState.collectAsState()
val updateViewModel: UpdateViewModel = hiltViewModel()
val updateState by updateViewModel.uiState.collectAsState()
val appearanceSettings by preferencesManager.appearanceSettings.collectAsState()

val isSystemDark = androidx.compose.foundation.isSystemInDarkTheme()
val darkTheme = when (appearanceSettings.themeMode) {
"LIGHT" -> false
"DARK" -> true
else -> isSystemDark
}

NovelScraperTheme(
darkTheme = androidx.compose.foundation.isSystemInDarkTheme(),
dynamicColor = false,
darkTheme = darkTheme,
dynamicColor = appearanceSettings.dynamicColor,
accentTheme = readerUiState.accentTheme
) {
val navController = rememberNavController()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ data class LibraryItemBackup(
val sourceName: String,
val isDownloaded: Boolean = false,
val downloadedAt: Long? = null,
val bundledEpubPath: String? = null
val bundledEpubPath: String? = null,
val coverImageUrl: String = ""
)
Loading
Loading