mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-09-06 18:01:11 +00:00
TasksActivity: use defaultValue=true for HINT_OPENTASKS_NOT_INSTALLED (#723)
This commit is contained in:
parent
c0570549c9
commit
ee36753e1a
|
@ -154,6 +154,7 @@ class SettingsManager internal constructor(
|
|||
fun getBooleanOrNull(key: String): Boolean? = getValue(key) { provider -> provider.getBoolean(key) }
|
||||
fun getBoolean(key: String): Boolean = getBooleanOrNull(key) ?: throw NoSuchPropertyException(key)
|
||||
fun getBooleanFlow(key: String): Flow<Boolean?> = observerFlow { getBooleanOrNull(key) }
|
||||
fun getBooleanFlow(key: String, defaultValue: Boolean): Flow<Boolean> = observerFlow { getBooleanOrNull(key) ?: defaultValue }
|
||||
|
||||
fun getIntOrNull(key: String): Int? = getValue(key) { provider -> provider.getInt(key) }
|
||||
fun getInt(key: String): Int = getIntOrNull(key) ?: throw NoSuchPropertyException(key)
|
||||
|
|
|
@ -104,7 +104,7 @@ class TasksActivity: AppCompatActivity() {
|
|||
|
||||
}
|
||||
|
||||
val showAgain = settings.getBooleanFlow(HINT_OPENTASKS_NOT_INSTALLED)
|
||||
val showAgain = settings.getBooleanFlow(HINT_OPENTASKS_NOT_INSTALLED, true)
|
||||
fun setShowAgain(showAgain: Boolean) {
|
||||
if (showAgain)
|
||||
settings.remove(HINT_OPENTASKS_NOT_INSTALLED)
|
||||
|
@ -166,7 +166,7 @@ fun TasksCard(
|
|||
val openTasksInstalled = model.openTasksInstalled
|
||||
val openTasksSelected by model.openTasksSelected.collectAsStateWithLifecycle(false)
|
||||
|
||||
val showAgain = model.showAgain.collectAsStateWithLifecycle(null).value ?: false
|
||||
val showAgain by model.showAgain.collectAsStateWithLifecycle(true)
|
||||
|
||||
fun installApp(packageName: String) {
|
||||
val uri = Uri.parse("market://details?id=$packageName&referrer=" +
|
||||
|
|
Loading…
Reference in a new issue