Skip to content

Standardize SharedPreferences naming across app #93

@callebtc

Description

@callebtc

Description:
The app uses inconsistent naming for SharedPreferences files, creating maintenance confusion and potential refactoring risks.

Current Inconsistent Names:

  • "NumoPrefs" (ModernPOSActivity.kt)
  • "app_prefs" (ThemeManager.kt)
  • "CashuWalletPrefs" (CashuWalletManager.kt)
  • Various other preference files

Issues:

  1. Maintenance confusion
  2. Potential data loss during refactoring
  3. No clear naming convention

Fix Instructions:

  1. Choose a standard naming pattern (e.g., "numo_" prefix)
  2. Update all preference file names:
// Standardize to:
private const val PREFS_NAME = "numo_main_prefs"
private const val WALLET_PREFS_NAME = "numo_wallet_prefs"  
private const val THEME_PREFS_NAME = "numo_theme_prefs"
  1. Add migration code to preserve existing user settings:
// Migration example:
private fun migratePreferences() {
    val oldPrefs = getSharedPreferences("app_prefs", MODE_PRIVATE)
    val newPrefs = getSharedPreferences("numo_theme_prefs", MODE_PRIVATE)
    
    if (oldPrefs.all.isNotEmpty() && newPrefs.all.isEmpty()) {
        // Migrate old preferences to new file
    }
}

Priority: Medium - affects maintainability

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions