Skip to content

Conversation

@Kota-Jagadeesh
Copy link
Collaborator

@Kota-Jagadeesh Kota-Jagadeesh commented Jan 11, 2026

Description (required)

Fixes #6612
Part of issue #6508

This PR addresses two long-standing TODO items in CommonsApplication.kt:

  1. Fresco Initialization Cleanup: Replaced the "band-aid" try-catch block during Fresco initialization with an explicit check for the robolectric environment. This prevents the app from attempting to load native libraries in test environments where they are unavailable, fulfilling the TODO for test builds.

  2. Smart Preference Clearing: Fixed the "preference manager" TODO by refactoring clearApplicationData. Instead of a total wipe using clearAll(), the app now captures the user's Theme (KEY_THEME_VALUE) and App UI Language (APP_UI_LANGUAGE) preferences before clearing data, and restores them immediately after. This ensures that visual and accessibility preferences are persistent across logout/login sessions, improving user experience.

Tests performed (required)

Tested prodDebug on Redmi Note 13 Pro 5g with API level 35.

  • Unit Tests: Verified that ./gradlew test passes and that Fresco initialization is correctly skipped in the Robolectric environment.
  • Manual Verification:
    1. Set the app theme to "Dark" and language to a non-default option.
    2. Performed a logout.
    3. Confirmed the Login screen remained in "Dark" mode and retained the selected language.
  • Data Integrity: Verified that sensitive user data (cookies and session) are still successfully cleared.

@Kota-Jagadeesh Kota-Jagadeesh self-assigned this Jan 11, 2026
@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant