Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sceyt/sceyt-chat-android-uikit/llms.txt

Use this file to discover all available pages before exploring further.

ChannelInteractor is the primary interface for all channel-level operations in the Sceyt Chat Android UIKit. It is accessible via SceytChatUIKit.chatUIFacade.channelInteractor. All methods are suspend functions unless stated otherwise, and most return either a SceytResponse<T> (for single-result operations) or a Flow<PaginationResponse<SceytChannel>> (for paginated list operations). SceytResponse is a sealed class with Success and Error variants, making exhaustive handling straightforward. Package: com.sceyt.chatuikit.persistence.interactor
val interactor: ChannelInteractor = SceytChatUIKit.chatUIFacade.channelInteractor

Loading Channels

loadChannels
suspend fun → Flow<PaginationResponse<SceytChannel>>
Loads a paginated list of channels. Results are emitted from the local database first, then updated with the server response. The flow closes when all data has been delivered.
interactor.loadChannels(
    offset           = 0,
    searchQuery      = "",
    loadKey          = LoadKeyData(),
    onlyMine         = false,
    ignoreDb         = false,
    awaitForConnection = false,
    config           = ChannelListConfig.default
).collect { response ->
    when (response) {
        is PaginationResponse.DBResponse -> updateUiFromDb(response.data)
        is PaginationResponse.ServerResponse -> updateUiFromServer(response.data)
        else -> {}
    }
}
searchChannelsWithUserIds
suspend fun → Flow<PaginationResponse<SceytChannel>>
Searches channels that contain the specified user IDs, optionally also matching a subject query. Useful for finding direct or group channels with specific participants.
interactor.searchChannelsWithUserIds(
    offset                       = 0,
    searchQuery                  = "",
    userIds                      = listOf("user-abc", "user-xyz"),
    config                       = ChannelListConfig.default,
    includeSearchByUserDisplayName = true,
    onlyMine                     = true,
    ignoreDb                     = false,
    loadKey                      = null,
    directChatType               = "direct"
).collect { response -> /* handle */ }
getChannelsBySQLiteQuery
suspend fun → List<SceytChannel>
Executes a raw SQLite query against the local channel database. Use for advanced offline filtering not supported by the standard API.
val query = SimpleSQLiteQuery("SELECT * FROM channels WHERE pinned = 1")
val pinnedChannels: List<SceytChannel> = interactor.getChannelsBySQLiteQuery(query)
syncChannels
suspend fun → Flow<SyncResult<SceytChannel>>
Forces a full server-side channel sync using the supplied config. Emits SyncResult events as pages of channels are fetched and persisted.
interactor.syncChannels(ChannelListConfig.default)
    .collect { result -> /* handle sync progress */ }

Read Status

markChannelAsRead
suspend fun → SceytResponse<SceytChannel>
Marks all messages in the channel as read and resets the unread count to zero.
when (val result = interactor.markChannelAsRead(channelId)) {
    is SceytResponse.Success -> { /* updated channel in result.data */ }
    is SceytResponse.Error   -> { /* handle error */ }
}
markChannelAsUnRead
suspend fun → SceytResponse<SceytChannel>
Marks the channel as having unread messages, causing it to appear with an unread indicator.

History and Deletion

clearHistory
suspend fun → SceytResponse<Long>
Deletes all messages in the channel. Returns the channel ID on success.
interactor.clearHistory(channelId = 42L, forEveryone = false)
blockAndLeaveChannel
suspend fun → SceytResponse<Long>
Blocks the channel and removes the current user from it simultaneously. Typically used for direct channels to prevent future messages from that peer.
unblockChannel
suspend fun → SceytResponse<SceytChannel>
Removes the block on a previously blocked channel.
deleteChannel
suspend fun → SceytResponse<Long>
Permanently deletes the channel and all its messages. The caller must have owner or admin privileges. Returns the deleted channel’s ID on success.
leaveChannel
suspend fun → SceytResponse<Long>
Removes the current user from the channel without deleting it.

Creating Channels

findOrCreatePendingChannelByMembers
suspend fun → SceytResponse<SceytChannel>
Finds an existing pending channel with the given members, or creates a new one. Used internally for optimistic channel creation before server confirmation.
findOrCreatePendingChannelByUri
suspend fun → SceytResponse<SceytChannel>
Finds an existing pending channel by URI, or creates a new one with the given URI.
createChannel
suspend fun → SceytResponse<SceytChannel>
Creates a new channel on the server with the provided configuration data.
val result = interactor.createChannel(
    CreateChannelData(
        channelType = "group",
        subject     = "Team Chat",
        members     = listOf(memberData1, memberData2)
    )
)

Muting and Auto-Delete

muteChannel
suspend fun → SceytResponse<SceytChannel>
Mutes notifications for the channel until the specified epoch timestamp in milliseconds. Pass Long.MAX_VALUE to mute indefinitely.
interactor.muteChannel(channelId, muteUntil = System.currentTimeMillis() + 3_600_000L)
unMuteChannel
suspend fun → SceytResponse<SceytChannel>
Re-enables notifications for a previously muted channel.
enableAutoDelete
suspend fun → SceytResponse<SceytChannel>
Enables auto-delete for messages in the channel after the specified period.
interactor.enableAutoDelete(channelId, period = 7.days.inWholeMilliseconds)
disableAutoDelete
suspend fun → SceytResponse<SceytChannel>
Turns off auto-delete for the channel, retaining all existing messages.

Pinning

pinChannel
suspend fun → SceytResponse<SceytChannel>
Pins the channel so it appears at the top of the channel list for the current user.
unpinChannel
suspend fun → SceytResponse<SceytChannel>
Removes the pin from a previously pinned channel.

Fetching Channels

getChannelFromDb
suspend fun → SceytChannel?
Returns the channel from the local database, or null if it is not cached.
val channel: SceytChannel? = interactor.getChannelFromDb(channelId)
getChannelsFromDb
suspend fun → List<SceytChannel>
Returns multiple channels from the local database by their IDs.
getDirectChannelFromDb
suspend fun → SceytChannel?
Looks up the direct (1-to-1) channel with the specified peer user from the local database.
getChannelFromServer
suspend fun → SceytResponse<SceytChannel>
Fetches the latest channel data from the server and updates the local database.
getChannelByInviteKey
suspend fun → SceytResponse<SceytChannel>
Looks up a channel using its invite key string. Does not join the channel.
getChannelFromServerByUri
suspend fun → SceytResponse<SceytChannel?>
Fetches a channel by its public URI from the server.
getChannelsCountFromDb
suspend fun → Int
Returns the total number of channels stored in the local database.
val count: Int = interactor.getChannelsCountFromDb()

Editing

editChannel
suspend fun → SceytResponse<SceytChannel>
Updates the channel’s subject, description, avatar, metadata, or URI.
interactor.editChannel(
    channelId = 42L,
    data      = EditChannelData(subject = "New Team Name")
)

Joining

join
suspend fun → SceytResponse<SceytChannel>
Joins the current user to a public channel.
joinWithInviteKey
suspend fun → SceytResponse<SceytChannel>
Joins a channel using an invite key, which may be for a private channel.

Hiding

hideChannel
suspend fun → SceytResponse<SceytChannel>
Hides the channel from the channel list without leaving it. The channel reappears when a new message arrives.
unHideChannel
suspend fun → SceytResponse<SceytChannel>
Makes a previously hidden channel visible again in the channel list.

Unread Counts and Draft

getTotalUnreadCount
fun → Flow<Long>
Returns a hot Flow that emits the total unread message count across channels, optionally filtered by channel type. Emits a new value whenever the count changes.
interactor.getTotalUnreadCount(channelTypes = listOf("direct", "group"))
    .onEach { count -> updateBadge(count) }
    .launchIn(lifecycleScope)
getChannelMessageCount
fun → Flow<Long>
Returns a hot Flow that emits the total number of messages in a specific channel from the local database.
updateDraftMessage
suspend fun
Persists a draft message for the channel to the local database. The draft is displayed in the channel list and restored when the user reopens the conversation.
interactor.updateDraftMessage(
    DraftMessage(channelId = 42L, message = "I was typing this...")
)

Build docs developers (and LLMs) love