Skip to content

Refactor CommonsApplication to resolve TODOs and prevent loss of UI settings on logout #6612

@Kota-Jagadeesh

Description

@Kota-Jagadeesh

Summary

The CommonsApplication.kt file contains two long-standing TODO items. The first involves a non-standard try-catch block for Fresco initialization that should be handled by environment checks. The second is a logic flaw in clearApplicationData where the app performs a "nuclear" clear of all preferences, causing users to lose their Theme and Language settings every time they log out.

Steps to reproduce

  1. Log in to the Commons app.
  2. Go to Settings and change the App Theme to "Dark/Light" (Don't keep to system default).
  3. Change the App UI Language to something other than the system default.
  4. Navigate to the "More" tab and tap "Logout".
  5. Observe the UI state on the Login screen and after the data clear process completes.

Expected behaviour

  1. Fresco: Initialization should be handled safely based on the build environment without relying on a generic try-catch.
  2. Settings: User-agnostic UI preferences like appThemePref and appUiLanguage should be preserved during logout so the user's visual and accessibility choices remain intact.

Actual behaviour

  1. Fresco: Uses a generic try-catch with a TODO comment as a "band-aid" for test builds.
  2. Settings: The app calls defaultPrefs.clearAll(), which wipes every setting, including the theme and language. The app then manually sets firstrun to false, but all other UI customizations are lost.

Device name

Redmi Note 13 Pro

Android version

Android 13

Commons app version

ProDebug

Device logs

No response

Screenshots

No response

Would you like to work on the issue?

Yes

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions