library / io.getstream.chat.android.livedata.controller / ChannelControllerImpl

ChannelControllerImpl

class ChannelControllerImpl : ChannelController

Constructors

<init>

ChannelControllerImpl(channelType: String, channelId: String, client: ChatClient, domainImpl: ChatDomainImpl)

Properties

activeThreadMapImpl

stores the mapping from cid to channelRepository

var activeThreadMapImpl: ConcurrentHashMap<String, ThreadControllerImpl>

channelController

val channelController: ChannelController

channelData

LiveData object with the channel data

val channelData: LiveData<ChannelData>

channelId

var channelId: String

channelType

var channelType: String

cid

val cid: String

client

var client: ChatClient

domainImpl

var domainImpl: ChatDomainImpl

endOfNewerMessages

set to true if there are no more newer messages to load

val endOfNewerMessages: LiveData<Boolean>

endOfOlderMessages

set to true if there are no more older messages to load

val endOfOlderMessages: LiveData<Boolean>

hidden

if the channel is currently hidden

val hidden: LiveData<Boolean>

job

val job: CompletableJob

loading

if we are currently loading

val loading: LiveData<Boolean>

loadingNewerMessages

if we are currently loading newer messages

val loadingNewerMessages: LiveData<Boolean>

loadingOlderMessages

if we are currently loading older messages

val loadingOlderMessages: LiveData<Boolean>

members

the list of members of this channel

val members: LiveData<List<Member>>

messages

a list of messages sorted by message.createdAt

val messages: LiveData<List<Message>>

muted

if the channel is currently muted

val muted: LiveData<Boolean>

read

read status for the current user

val read: LiveData<ChannelUserRead>

reads

how far every user in this channel has read

val reads: LiveData<List<ChannelUserRead>>

recoveryNeeded

var recoveryNeeded: Boolean

scope

val scope: CoroutineScope

typing

who is currently typing (current user is excluded from this)

val typing: LiveData<List<User>>

unreadCount

unread count for this channel, calculated based on read state (this works even if you're offline)

val unreadCount: LiveData<Int>

watcherCount

the number of people currently watching the channel

val watcherCount: LiveData<Int>

watchers

the list of users currently watching this channel

val watchers: LiveData<List<User>>

Functions

clean

fun clean(): Unit

deleteMessage

suspend fun deleteMessage(message: Message): Result<Message>

deleteReaction

suspend fun deleteReaction(reaction: Reaction): Result<Message>

editMessage

suspend fun editMessage(message: Message): Result<Message>

getConfig

fun getConfig(): Config

getMessage

fun getMessage(messageId: String): Message?

getThread

fun getThread(threadId: String): ThreadControllerImpl

getThreadMessages

fun getThreadMessages(threadId: String): MutableLiveData<MutableMap<String, Message>>

handleEvent

fun handleEvent(event: ChatEvent): Unit

handleEvents

fun handleEvents(events: List<ChatEvent>): Unit

hide

suspend fun hide(clearHistory: Boolean): Result<Unit>

isHidden

fun isHidden(): Boolean

keystroke

fun keystroke(): Result<Boolean>

loadMoreMessagesRequest

fun loadMoreMessagesRequest(limit: Int = 30, direction: Pagination): QueryChannelPaginationRequest

loadMoreThreadMessages

suspend fun loadMoreThreadMessages(threadId: String, limit: Int = 30, direction: Pagination): Result<List<Message>>

loadNewerMessages

suspend fun loadNewerMessages(limit: Int = 30): Result<Channel>

loadOlderMessages

suspend fun loadOlderMessages(limit: Int = 30): Result<Channel>

markRead

fun markRead(): Result<Boolean>

removeMessagesBefore

fun removeMessagesBefore(t: Date): Unit

runChannelQuery

suspend fun runChannelQuery(pagination: QueryChannelPaginationRequest): Result<Channel>

runChannelQueryOffline

suspend fun runChannelQueryOffline(pagination: QueryChannelPaginationRequest): Channel?

runChannelQueryOnline

suspend fun runChannelQueryOnline(pagination: QueryChannelPaginationRequest): Result<Channel>

sendMessage

  • Generate an ID
  • Insert the message into offline storage with sync status set to Sync Needed
  • If we're online do the send message request
  • If the request fails we retry according to the retry policy set on the repo
suspend fun sendMessage(message: Message): Result<Message>

sendReaction

sendReaction posts the reaction on local storage message reaction count should increase, latest reactions and own_reactions should be updated

suspend fun sendReaction(reaction: Reaction): Result<Reaction>

setTyping

fun setTyping(userId: String, event: ChatEvent?): Unit

setWatcherCount

fun setWatcherCount(watcherCount: Int): Unit

setWatchers

fun setWatchers(watchers: List<Watcher>): Unit

show

suspend fun show(): Result<Unit>

sortedMessages

fun sortedMessages(): List<Message>

stopTyping

fun stopTyping(): Result<Boolean>

toChannel

fun toChannel(): Channel

updateChannelData

fun updateChannelData(channel: Channel): Unit

updateLiveDataFromChannel

fun updateLiveDataFromChannel(c: Channel): Unit

updateLiveDataFromChannelEntityPair

fun updateLiveDataFromChannelEntityPair(c: ChannelEntityPair): Unit

updateRead

fun updateRead(read: ChannelUserRead): Unit

updateReads

fun updateReads(reads: List<ChannelUserRead>): Unit

upsertEventMessage

fun upsertEventMessage(message: Message): Unit

upsertMember

fun upsertMember(member: Member): Unit

upsertMessage

fun upsertMessage(message: Message): Unit

upsertMessages

fun upsertMessages(messages: List<Message>): Unit

watch

suspend fun watch(limit: Int = 30): Unit