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
This commit is contained in:
arkon
2023-12-30 16:02:36 -05:00
parent f3b7eaf4a3
commit f0a0ecfd4a
10 changed files with 92 additions and 58 deletions

View File

@@ -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) }
}