Migrate extension details page to Compose

This commit is contained in:
arkon
2022-05-07 23:34:55 -04:00
parent 1c94ecdcdf
commit 13943f77f7
24 changed files with 363 additions and 452 deletions
@@ -9,12 +9,15 @@ class ToggleSource(
private val preferences: PreferencesHelper,
) {
fun await(source: Source) {
val isEnabled = source.id.toString() !in preferences.disabledSources().get()
if (isEnabled) {
preferences.disabledSources() += source.id.toString()
fun await(source: Source, enable: Boolean = source.id.toString() in preferences.disabledSources().get()) {
await(source.id, enable)
}
fun await(sourceId: Long, enable: Boolean = sourceId.toString() in preferences.disabledSources().get()) {
if (enable) {
preferences.disabledSources() -= sourceId.toString()
} else {
preferences.disabledSources() -= source.id.toString()
preferences.disabledSources() += sourceId.toString()
}
}
}