Improving when structure

This commit is contained in:
Maxime NATUREL 2022-10-14 13:46:33 +02:00
parent 86132219d8
commit 189e77211e
1 changed files with 3 additions and 3 deletions

View File

@ -151,9 +151,9 @@ class VectorSettingsLabsFragment :
private fun configureEnableClientInfoRecordingPreference() { private fun configureEnableClientInfoRecordingPreference() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_CLIENT_INFO_RECORDING_KEY)?.onPreferenceChangeListener = findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_CLIENT_INFO_RECORDING_KEY)?.onPreferenceChangeListener =
OnPreferenceChangeListener { _, newValue -> OnPreferenceChangeListener { _, newValue ->
when { when (newValue as? Boolean) {
(newValue as? Boolean) == false -> viewModel.handle(VectorSettingsLabsAction.DeleteRecordedClientInfo) false -> viewModel.handle(VectorSettingsLabsAction.DeleteRecordedClientInfo)
(newValue as? Boolean) == true -> viewModel.handle(VectorSettingsLabsAction.UpdateClientInfo) true -> viewModel.handle(VectorSettingsLabsAction.UpdateClientInfo)
else -> Unit else -> Unit
} }
true true