Refactored folder synchronization logic and improved migration handling (#21)

- Updated `MainViewModel` to skip synchronization until folder migration is completed and added metadata syncing when opening books.
- Modified folder migration to detach existing folder books (converting them to standard local files) before starting a fresh scan.
- Added `detachAllFolderBooks` to `RecentFileDao` and `RecentFilesRepository` to facilitate the migration process.
- Updated `MetadataExtractionWorker` to sync local metadata to the folder immediately after extraction.
- Simplified `FolderSyncWorker` by removing legacy migration lookups and streamlining the reconciliation of local and remote metadata.
- Updated `FolderMigrationDialog` UI text to reflect that books are now read directly from folders without duplication.
- Fixed various indentation and formatting issues across several files.
This commit is contained in:
Aryan 2026-03-02 03:03:36 +05:30 committed by GitHub
parent 34c6ec3fef
commit 0885b6949e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 105 additions and 196 deletions

View file

@ -1140,17 +1140,17 @@ fun FpsMonitor(modifier: Modifier = Modifier) {
@Composable
private fun FolderMigrationDialog(onConfirm: () -> Unit) {
AlertDialog(
onDismissRequest = { }, // Force acknowledgment
onDismissRequest = { },
icon = { Icon(Icons.Default.FolderSpecial, contentDescription = null) },
title = { Text("Folder Sync Refactored") },
title = { Text("Folder Sync Update") },
text = {
Column {
Text(
"We've completely rebuilt how Folder Sync works! Books from the folder are now read directly from your folder instead of being copied to app storage."
"We've improved Folder Sync! Books are now read directly from your folder without duplicating files."
)
Spacer(modifier = Modifier.height(12.dp))
Text(
"We'll now perform a one-time scan to migrate your existing progress and bookmarks. This will also free up internal storage space on your device.",
"To keep your reading progress safe, your previously synced books have been converted to standard local books. You may see duplicates once the folder resyncs; you can safely delete the old copies at your convenience.",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
@ -1158,7 +1158,7 @@ private fun FolderMigrationDialog(onConfirm: () -> Unit) {
},
confirmButton = {
TextButton(onClick = onConfirm) {
Text("Start Migration")
Text("Got it")
}
}
)