Skip to content

MainActivity isUnlocked state not reactive to parental lock setting changes #24

Description

@MRAKS05

Description

MainActivity.kt:72 reads isParentalLockEnabled only once at initial composition:

val isUnlocked = remember { mutableStateOf(!settings.isParentalLockEnabled) }

If the user navigates to Settings, enables parental lock, and navigates back, isUnlocked is still true because it was captured at composition time. The lock screen only appears after the activity goes through ON_STOP -> ON_START.

Impact

  1. Open the app
  2. Go to Settings -> enable parental lock -> set a PIN
  3. Press back to Dashboard - still unlocked
  4. The lock only activates after the app is fully backgrounded and reopened

Fix: Derive isUnlocked from a StateFlow or use produceState that observes SharedPreferences changes for the parental_lock key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: securityParental lock, encryption, permissionsarea: uiScreens, navigation, composables, themingbugSomething isn't workingpriority: lowMinor issue or nice-to-have enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions