UserRepository

Handles the data in the Firestore database for the User class.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Cached user profiles.

Link copied to clipboard

Whether the initial user data has finished loading successfully.

Functions

Link copied to clipboard
suspend fun addUser(user: User)

Adds a new user to the Firestore database.

Link copied to clipboard
suspend fun deleteUser(user: User)

Deletes a user from the Firestore database.

Link copied to clipboard
fun getCachedUser(deviceId: String): User?

getCachedUser gets users saved in the cache instead of going through db read again.

Link copied to clipboard
suspend fun getUser(deviceId: String): User?

Retrieves a user from the local cache.

Link copied to clipboard
suspend fun refreshUsers()

Refreshes cached users from Firestore.

Link copied to clipboard
suspend fun setAllowNotifications(user: User, allow: Boolean)

Changes the user's notification setting to on or off.

Link copied to clipboard
suspend fun updateUser(user: User)

Saves user data to Firestore, creating the document if absent.