Toggle enabled source in bulk

Maybe fixes #8439
This commit is contained in:
arkon
2022-11-04 09:39:23 -04:00
parent 65387d0089
commit 280b0f42db
2 changed files with 10 additions and 1 deletions

View File

@@ -18,6 +18,13 @@ class ToggleSource(
}
}
fun await(sourceIds: List<Long>, enable: Boolean) {
val transformedSourceIds = sourceIds.map { it.toString() }
preferences.disabledSources().getAndSet { disabled ->
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
}
}
private fun isEnabled(sourceId: Long): Boolean {
return sourceId.toString() in preferences.disabledSources().get()
}