Add switch preference to enable feed
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package de.mm20.launcher2.preferences.feed
|
||||
|
||||
import de.mm20.launcher2.preferences.GestureAction
|
||||
import de.mm20.launcher2.preferences.LauncherDataStore
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
@@ -7,6 +8,15 @@ class FeedSettings internal constructor(
|
||||
private val launcherDataStore: LauncherDataStore,
|
||||
) {
|
||||
|
||||
val enabled
|
||||
get() = launcherDataStore.data.map { it.gesturesSwipeRight is GestureAction.Feed }
|
||||
|
||||
fun setEnabled(enabled: Boolean) {
|
||||
launcherDataStore.update {
|
||||
it.copy(gesturesSwipeRight = if (enabled) GestureAction.Feed else GestureAction.NoAction)
|
||||
}
|
||||
}
|
||||
|
||||
val providerPackage
|
||||
get() = launcherDataStore.data.map { it.feedProviderPackage }
|
||||
|
||||
@@ -15,4 +25,5 @@ class FeedSettings internal constructor(
|
||||
it.copy(feedProviderPackage = providerPackage)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user