StateRegistry

class StateRegistry @JvmOverloads constructor(userStateFlow: StateFlow<User?>, latestUsers: StateFlow<Map<String, User>>, activeLiveLocations: StateFlow<List<Location>>, job: Job, now: () -> Long, scope: CoroutineScope, messageLimitConfig: MessageLimitConfig, mutedUsers: StateFlow<List<Mute>> = MutableStateFlow(emptyList()), useLegacyChannelState: Boolean = true)

Registry of all state objects exposed in the offline plugin. This class should have only one instance for the SDK.

Parameters

userStateFlow

The state flow that provides the user once it is set.

latestUsers

Latest users of the SDK.

activeLiveLocations

Latest live locations of the SDK.

job

A background job cancelled after calling clear.

scope

A scope for new coroutines.

messageLimitConfig

Configuration for message limits.

mutedUsers

The current list of muted users.

useLegacyChannelState

Whether to use the legacy channel state implementation.

Constructors

Link copied to clipboard
constructor(userStateFlow: StateFlow<User?>, latestUsers: StateFlow<Map<String, User>>, activeLiveLocations: StateFlow<List<Location>>, job: Job, now: () -> Long, scope: CoroutineScope, messageLimitConfig: MessageLimitConfig, mutedUsers: StateFlow<List<Mute>> = MutableStateFlow(emptyList()), useLegacyChannelState: Boolean = true)

Functions

Link copied to clipboard
fun channel(channelType: String, channelId: String): ChannelState

Returns ChannelState that represents a state of particular channel.

Link copied to clipboard
fun clear()

Clear state of all state objects.

Link copied to clipboard

Returns QueryChannelsState associated with particular filter and sort.

Link copied to clipboard
fun thread(messageId: String): ThreadState

Returns ThreadState of thread replies with parent message that has id equal to messageId.