Ignore auto sign in if user has PIN (#392)

If the current user has a PIN, the sign in automatically setting is
ignored if the app is put in the background or restarted.

Follow up to #356 &
https://github.com/damontecres/Wholphin/issues/321#issuecomment-3621312496

I think the PIN protection needs some more thought overall.
This commit is contained in:
damontecres 2025-12-07 17:48:46 -05:00 committed by GitHub
parent e0d50baf15
commit fa141adc60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View file

@ -179,7 +179,7 @@ class MainActivity : AppCompatActivity() {
} else {
DisposableEffect(Unit) {
onDispose {
if (!appPreferences.signInAutomatically) {
if (!appPreferences.signInAutomatically || current?.user?.hasPin == true) {
serverRepository.closeSession()
}
}
@ -252,7 +252,7 @@ class MainActivity : AppCompatActivity() {
val signInAutomatically =
runBlocking { userPreferencesDataStore.data.firstOrNull()?.signInAutomatically } ?: true
Timber.i("onRestart: signInAutomatically=$signInAutomatically")
if (!signInAutomatically) {
if (!signInAutomatically || serverRepository.currentUser.value?.hasPin == true) {
serverRepository.closeSession()
}
}