Allow creating backups without library entries

- In case you want a backup of just settings?
- Also disable backup options if dependent option is disabled (and fix being able to toggle disabled items)
- Also fix crash in RestoreBackupScreen due to attempt to parcelize Uri
- Make restore validation message a bit nicer

(cherry picked from commit f0a0ecfd4a5c8ee85fdcf7e92dc9a0079ef40cde)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/RestoreOptions.kt
This commit is contained in:
arkon
2023-12-30 16:02:36 -05:00
committed by Jobobby04
parent a2d202a2cf
commit acd0ca99ed
10 changed files with 94 additions and 58 deletions
@@ -18,3 +18,9 @@ inline fun <reified T : Any> BooleanArray.asDataClass(): T {
require(properties.size == this.size) { "Boolean array size does not match data class property count" }
return T::class.primaryConstructor!!.call(*this.toTypedArray())
}
fun <T : Any> T.anyEnabled(): Boolean {
return this::class.declaredMemberProperties
.filterIsInstance<KProperty1<T, Boolean>>()
.any { it.get(this) }
}