nowinandroid icon indicating copy to clipboard operation
nowinandroid copied to clipboard

Change `UserData` to `UserPreferences`

Open dturner opened this issue 3 years ago • 1 comments

"Preferences" more accurately describes the data this model contains.

Also requires changing the *UserDataRepository objects to *UserPreferencesRepository

dturner avatar Oct 28 '22 17:10 dturner

I'm quite new to this so I'd like to confirm the following:

  • you want all mentions of UserData to be changed to UserPreferences
  • same as above, all UserDataRepository mentions should be changed to UserPreferencesRepository did I get it right?

vaishnav-mk avatar Oct 28 '22 18:10 vaishnav-mk

@dturner renaming UserData to UserPreferences will conflict with com.google.samples.apps.nowinandroid.core.datastore.UserPreferences that's generated by user_preferences.proto I think we should pick another name 🤔

MohNage7 avatar Oct 31 '22 22:10 MohNage7

Thanks both for your interest in this issue. The thinking behind this is the type of data stored in this class:

data class UserData(
    val bookmarkedNewsResources: Set<String>,
    val followedTopics: Set<String>,
    val followedAuthors: Set<String>,
    val themeBrand: ThemeBrand,
    val darkThemeConfig: DarkThemeConfig,
)

Should we describe this as:

  • UserPreferences and potentially rename datastore.UserPreferences to avoid a clash (thanks for pointing this out @MohNage7 ). Another issue is that on Android the term preferences is already a commonly used term e.g. SharedPreferences.
  • something else. Open to suggestions.
  • keep as UserData?

dturner avatar Nov 01 '22 07:11 dturner

@dturner Thanks for your reply. IMHO, I think we can rename the proto class to UserPreferencesStore / UserPreferencesCache or go with the last option and leave UserData as is. Please let me know WDYT?

MohNage7 avatar Nov 01 '22 12:11 MohNage7

How about changing the name UserData to UserSettings?

carmen-gh avatar Nov 02 '22 09:11 carmen-gh

Thanks for the suggestions. I'm inclined to leave as-is for now. It's likely that we'll store other information here in future and UserData is generic enough to accommodate that.

dturner avatar Nov 02 '22 17:11 dturner