-
- All Implemented Interfaces:
-
io.getstream.chat.android.offline.plugin.state.global.GlobalState,io.getstream.chat.android.offline.plugin.state.global.internal.MutableGlobalState
public final class GlobalMutableState implements MutableGlobalState
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classGlobalMutableState.Companion
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<User>userprivate final StateFlow<Boolean>initializedprivate final StateFlow<ConnectionState>connectionStateprivate final StateFlow<Integer>totalUnreadCountprivate final StateFlow<Integer>channelUnreadCountprivate final StateFlow<Event<ChatError>>errorEventsprivate final StateFlow<List<Mute>>mutedprivate final StateFlow<List<ChannelMute>>channelMutesprivate final StateFlow<Boolean>bannedprivate final StateFlow<TypingEvent>typingUpdatesprivate final StateFlow<Map<String, TypingEvent>>typingChannelsprivate final ClientStateclientState
-
Method Summary
Modifier and Type Method Description StateFlow<User>getUser()The current user in the OfflinePlugin state. StateFlow<Boolean>getInitialized()If the client connection has been initialized. StateFlow<ConnectionState>getConnectionState()StateFlow<ConnectionState> that indicates if we are currently online, connecting of offline. StateFlow<Integer>getTotalUnreadCount()The total unread message count for the current user. StateFlow<Integer>getChannelUnreadCount()the number of unread channels for the current user. StateFlow<Event<ChatError>>getErrorEvents()The error event state flow object is triggered when errors in the underlying components occur. StateFlow<List<Mute>>getMuted()list of users that you've muted. StateFlow<List<ChannelMute>>getChannelMutes()List of channels you've muted. StateFlow<Boolean>getBanned()if the current user is banned or not. StateFlow<TypingEvent>getTypingUpdates()Updates about currently typing users in active channels. StateFlow<Map<String, TypingEvent>>getTypingChannels()Map of typing users in all active channel. ClientStategetClientState()BooleanisOnline()If the user is online or not. BooleanisOffline()If the user is offline or not. BooleanisConnecting()If connection is in connecting state. BooleanisInitialized()If domain state is initialized or not. UnitclearState()Clears the state of GlobalState. UnitsetErrorEvent(Event<ChatError> errorEvent)UnitsetTotalUnreadCount(Integer totalUnreadCount)UnitsetChannelUnreadCount(Integer channelUnreadCount)UnitsetBanned(Boolean banned)UnitsetChannelMutes(List<ChannelMute> channelMutes)UnitsetMutedUsers(List<Mute> mutedUsers)UnittryEmitTypingEvent(String cid, TypingEvent typingEvent)Tries emit typing event for a particular channel. -
-
Method Detail
-
getUser
StateFlow<User> getUser()
The current user in the OfflinePlugin state.
-
getInitialized
StateFlow<Boolean> getInitialized()
If the client connection has been initialized.
-
getConnectionState
StateFlow<ConnectionState> getConnectionState()
StateFlow<ConnectionState> that indicates if we are currently online, connecting of offline.
-
getTotalUnreadCount
StateFlow<Integer> getTotalUnreadCount()
The total unread message count for the current user. Depending on your app you'll want to show this or the channelUnreadCount.
-
getChannelUnreadCount
StateFlow<Integer> getChannelUnreadCount()
the number of unread channels for the current user.
-
getErrorEvents
StateFlow<Event<ChatError>> getErrorEvents()
The error event state flow object is triggered when errors in the underlying components occur. The following example shows how to observe these errors
repo.errorEvent.collect { // create a toast }
-
getChannelMutes
StateFlow<List<ChannelMute>> getChannelMutes()
List of channels you've muted.
-
getTypingUpdates
StateFlow<TypingEvent> getTypingUpdates()
Updates about currently typing users in active channels. See TypingEvent.
-
getTypingChannels
StateFlow<Map<String, TypingEvent>> getTypingChannels()
Map of typing users in all active channel. Use io.getstream.chat.android.client.models.Channel.cid to access events for a particular channel.
-
getClientState
ClientState getClientState()
-
isConnecting
Boolean isConnecting()
If connection is in connecting state.
-
isInitialized
Boolean isInitialized()
If domain state is initialized or not.
-
clearState
Unit clearState()
Clears the state of GlobalState.
-
setErrorEvent
Unit setErrorEvent(Event<ChatError> errorEvent)
-
setTotalUnreadCount
Unit setTotalUnreadCount(Integer totalUnreadCount)
-
setChannelUnreadCount
Unit setChannelUnreadCount(Integer channelUnreadCount)
-
setChannelMutes
Unit setChannelMutes(List<ChannelMute> channelMutes)
-
setMutedUsers
Unit setMutedUsers(List<Mute> mutedUsers)
-
tryEmitTypingEvent
Unit tryEmitTypingEvent(String cid, TypingEvent typingEvent)
Tries emit typing event for a particular channel.
- Parameters:
cid- The full channel id, i.e.typingEvent- TypingEvent with information about typing users.
-
-
-
-