feat(sync): Allow to choose what to sync.

Various improvement and added the option to choose what they want to sync. Added sync library button to LibraryTab as well.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh
2024-01-14 05:56:09 +11:00
parent 89c577952c
commit ffe6efdd7a
9 changed files with 229 additions and 100 deletions

View File

@@ -36,4 +36,39 @@ class SyncPreferences(
return uniqueID
}
fun getSyncOptions(): SyncOptions {
return SyncOptions(
libraryEntries = preferenceStore.getBoolean("library_entries", true).get(),
categories = preferenceStore.getBoolean("categories", true).get(),
chapters = preferenceStore.getBoolean("chapters", true).get(),
tracking = preferenceStore.getBoolean("tracking", true).get(),
history = preferenceStore.getBoolean("history", true).get(),
appSettings = preferenceStore.getBoolean("appSettings", true).get(),
sourceSettings = preferenceStore.getBoolean("sourceSettings", true).get(),
privateSettings = preferenceStore.getBoolean("privateSettings", true).get(),
)
}
fun setSyncOptions(syncOptions: SyncOptions) {
preferenceStore.getBoolean("library_entries", true).set(syncOptions.libraryEntries)
preferenceStore.getBoolean("categories", true).set(syncOptions.categories)
preferenceStore.getBoolean("chapters", true).set(syncOptions.chapters)
preferenceStore.getBoolean("tracking", true).set(syncOptions.tracking)
preferenceStore.getBoolean("history", true).set(syncOptions.history)
preferenceStore.getBoolean("appSettings", true).set(syncOptions.appSettings)
preferenceStore.getBoolean("sourceSettings", true).set(syncOptions.sourceSettings)
preferenceStore.getBoolean("privateSettings", true).set(syncOptions.privateSettings)
}
}
data class SyncOptions(
val libraryEntries: Boolean = true,
val categories: Boolean = true,
val chapters: Boolean = true,
val tracking: Boolean = true,
val history: Boolean = true,
val appSettings: Boolean = true,
val sourceSettings: Boolean = true,
val privateSettings: Boolean = false,
)