@@ -43,6 +43,7 @@ fun SecuritySettingsScreen(
4343 val isPinEnabled by app.isPinEnabled.collectAsStateWithLifecycle()
4444 val isPinOnLaunchEnabled by app.isPinOnLaunchEnabled.collectAsStateWithLifecycle()
4545 val isBiometricEnabled by app.isBiometricEnabled.collectAsStateWithLifecycle()
46+ val isPinOnIdleEnabled by app.isPinOnIdleEnabled.collectAsStateWithLifecycle()
4647
4748 PinNavigationSheet (
4849 showSheet = showPinSheet,
@@ -53,6 +54,7 @@ fun SecuritySettingsScreen(
5354 isPinEnabled = isPinEnabled,
5455 isPinOnLaunchEnabled = isPinOnLaunchEnabled,
5556 isBiometricEnabled = isBiometricEnabled,
57+ isPinOnIdleEnabled = isPinOnIdleEnabled,
5658 isBiometrySupported = rememberBiometricAuthSupported(),
5759 onPinClick = {
5860 if (! isPinEnabled) {
@@ -69,6 +71,11 @@ fun SecuritySettingsScreen(
6971 onSuccessActionId = AuthCheckAction .TOGGLE_PIN_ON_LAUNCH ,
7072 )
7173 },
74+ onPinOnIdleClick = {
75+ navController.navigateToAuthCheck(
76+ onSuccessActionId = AuthCheckAction .TOGGLE_PIN_ON_IDLE ,
77+ )
78+ },
7279 onUseBiometricsClick = {
7380 navController.navigateToAuthCheck(
7481 requireBiometrics = true ,
@@ -86,10 +93,12 @@ private fun SecuritySettingsContent(
8693 isPinEnabled : Boolean ,
8794 isPinOnLaunchEnabled : Boolean ,
8895 isBiometricEnabled : Boolean ,
96+ isPinOnIdleEnabled : Boolean ,
8997 isBiometrySupported : Boolean ,
9098 onPinClick : () -> Unit = {},
9199 onChangePinClick : () -> Unit = {},
92100 onPinOnLaunchClick : () -> Unit = {},
101+ onPinOnIdleClick : () -> Unit = {},
93102 onUseBiometricsClick : () -> Unit = {},
94103 onBackClick : () -> Unit = {},
95104 onCloseClick : () -> Unit = {},
@@ -122,10 +131,15 @@ private fun SecuritySettingsContent(
122131 isChecked = isPinOnLaunchEnabled,
123132 onClick = onPinOnLaunchClick,
124133 )
134+ SettingsSwitchRow (
135+ title = stringResource(R .string.settings__security__pin_idle),
136+ isChecked = isPinOnIdleEnabled,
137+ onClick = onPinOnIdleClick,
138+ )
125139 }
126140 if (isPinEnabled && isBiometrySupported) {
127141 SettingsSwitchRow (
128- title = let {
142+ title = run {
129143 val bioTypeName = stringResource(R .string.security__bio)
130144 stringResource(R .string.settings__security__use_bio).replace(" {biometryTypeName}" , bioTypeName)
131145 },
@@ -135,7 +149,7 @@ private fun SecuritySettingsContent(
135149 }
136150 if (isPinEnabled && isBiometrySupported) {
137151 BodyS (
138- text = let {
152+ text = run {
139153 val bioTypeName = stringResource(R .string.security__bio)
140154 stringResource(R .string.settings__security__footer).replace(" {biometryTypeName}" , bioTypeName)
141155 },
@@ -155,6 +169,7 @@ fun Preview() {
155169 isPinEnabled = true ,
156170 isPinOnLaunchEnabled = true ,
157171 isBiometricEnabled = false ,
172+ isPinOnIdleEnabled = false ,
158173 isBiometrySupported = true ,
159174 )
160175 }
0 commit comments