Class StreamUserDataStore
-
- All Implemented Interfaces:
-
androidx.datastore.core.DataStore
public final class StreamUserDataStore implements DataStore<StreamUserPreferences>
A DataStore managers to persist Stream user login data safely, consistently, and transactionally.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classStreamUserDataStore.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Flow<User>userprivate final Flow<String>apiKeyprivate final Flow<String>userTokenprivate final Flow<Device>userDeviceprivate final Flow<StreamUserPreferences>datapublic final static StreamUserDataStore.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description StreamUserDataStore(DataStore<StreamUserPreferences> dataStore)
-
Method Summary
Modifier and Type Method Description final Flow<User>getUser()A state that contains a persisted User data. final Flow<String>getApiKey()A state that contains a persisted ApiKey data. final Flow<String>getUserToken()A state that contains a persisted UserToken data. final Flow<Device>getUserDevice()A state that contains a persisted Device data. final UnitupdateUserPreferences(StreamUserPreferences streamUserPreferences)Update user preferences with the give StreamUserPreferences. final UnitupdateUser(User user)Update User information that is used to build a StreamVideoinstance for logging in.final UnitupdateApiKey(String apiKey)Update ApiKey information that is used to build a StreamVideoinstance for logging in.final UnitupdateUserToken(String userToken)Update UserToken information that is used to build a StreamVideoinstance for logging in.final UnitupdateUserDevice(Device userDevice)Update Device information that is used to be get push notifications from the Stream server. final StreamUserPreferencesclear()Clear the persisted all user data. -
-
Constructor Detail
-
StreamUserDataStore
StreamUserDataStore(DataStore<StreamUserPreferences> dataStore)
- Parameters:
dataStore- A DataStore that contains data type of StreamUserPreferences.
-
-
Method Detail
-
getUserToken
final Flow<String> getUserToken()
A state that contains a persisted UserToken data.
-
getUserDevice
final Flow<Device> getUserDevice()
A state that contains a persisted Device data.
-
updateUserPreferences
final Unit updateUserPreferences(StreamUserPreferences streamUserPreferences)
Update user preferences with the give StreamUserPreferences.
- Parameters:
streamUserPreferences- A new StreamUserPreferences to replace previous persisted data.
-
updateUser
final Unit updateUser(User user)
Update User information that is used to build a
StreamVideoinstance for logging in.- Parameters:
user- A user instance to be used logged in.
-
updateApiKey
final Unit updateApiKey(String apiKey)
Update ApiKey information that is used to build a
StreamVideoinstance for logging in.- Parameters:
apiKey- An API key instance to be used logged in.
-
updateUserToken
final Unit updateUserToken(String userToken)
Update UserToken information that is used to build a
StreamVideoinstance for logging in.- Parameters:
userToken- An user token instance to be used logged in.
-
updateUserDevice
final Unit updateUserDevice(Device userDevice)
Update Device information that is used to be get push notifications from the Stream server.
- Parameters:
userDevice- A user device used to be get push notifications from the Stream server.
-
clear
final StreamUserPreferences clear()
Clear the persisted all user data.
-
-
-
-