diff --git a/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsScreen.kt b/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsScreen.kt index 6132824dbb7..467f2c1f07d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/settings/SettingsScreen.kt @@ -54,6 +54,14 @@ fun SettingsScreen( viewModel: SettingsViewModel = hiltViewModel() ) { val lazyListState: LazyListState = rememberLazyListState() + val turnAppLockOffDialogState = rememberVisibilityState() + val onAppLockSwitchClicked: (Boolean) -> Unit = remember { + { isChecked -> + if (isChecked) homeStateHolder.navigator.navigate(NavigationCommand(SetLockCodeScreenDestination, BackStackMode.NONE)) + else turnAppLockOffDialogState.show(Unit) + } + } + val context = LocalContext.current SettingsScreenContent( lazyListState = lazyListState, @@ -66,13 +74,9 @@ fun SettingsScreen( ) } }, - onAppLockSwitchChanged = remember { - { isChecked -> - if (isChecked) homeStateHolder.navigator.navigate(NavigationCommand(SetLockCodeScreenDestination, BackStackMode.NONE)) - else viewModel.disableAppLock() - } - } + onAppLockSwitchChanged = onAppLockSwitchClicked ) + TurnAppLockOffDialog(dialogState = turnAppLockOffDialogState, turnOff = viewModel::disableAppLock) } @Composable @@ -84,7 +88,6 @@ fun SettingsScreenContent( ) { val context = LocalContext.current val featureVisibilityFlags = LocalFeatureVisibilityFlags.current - val turnAppLockOffDialogState = rememberVisibilityState() with(featureVisibilityFlags) { LazyColumn( @@ -114,6 +117,19 @@ fun SettingsScreenContent( add(SettingsItem.NetworkSettings) add(SettingsItem.AppLock( +<<<<<<< HEAD + when (settingsState.appLockConfig) { + is AppLockConfig.Disabled -> SwitchState.Enabled( + value = false, + isOnOffVisible = true, + onCheckedChange = onAppLockSwitchChanged + ) + is AppLockConfig.Enabled -> SwitchState.Enabled( + value = true, + isOnOffVisible = true + ) { + turnAppLockOffDialogState.show(Unit) +======= when (settingsState.isAppLockEditable) { true -> { appLogger.d("AppLockConfig isAooLockEditable: ${settingsState.isAppLockEditable}") @@ -121,10 +137,10 @@ fun SettingsScreenContent( appLogger.d("AppLockConfig isAppLockEnabled: ${settingsState.isAppLockEnabled}") SwitchState.Enabled( value = settingsState.isAppLockEnabled, - isOnOffVisible = true - ) { - turnAppLockOffDialogState.show(Unit) - } + isOnOffVisible = true, + onCheckedChange = onAppLockSwitchChanged + ) +>>>>>>> dd3cb91b8 (LAST_COMMIT_MESSAGE) } false -> { @@ -158,8 +174,6 @@ fun SettingsScreenContent( ) } } - - TurnAppLockOffDialog(dialogState = turnAppLockOffDialogState) { onAppLockSwitchChanged(false) } } private fun LazyListScope.folderWithElements(