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.

AttachmentInteractor provides all operations for browsing, loading, and managing message attachments within a channel. It is accessible via SceytChatUIKit.chatUIFacade.attachmentInteractor. Use it to implement media galleries, file browsers, voice-message lists, and link-preview feeds — each filtered by attachment type. Paginated methods return a Flow<PaginationResponse<AttachmentWithUserData>>, which emits locally cached results first and then updates from the server. Utility methods handle file checksum deduplication, link preview fetching, and transfer-state tracking. Package: com.sceyt.chatuikit.persistence.interactor
val interactor: AttachmentInteractor = SceytChatUIKit.chatUIFacade.attachmentInteractor

Paginating Attachments

getPrevAttachments
suspend fun → Flow<PaginationResponse<AttachmentWithUserData>>
Loads attachments older than lastAttachmentId (backward pagination). Each emission contains an AttachmentWithUserData list, pairing the attachment with its sender’s profile data.
interactor.getPrevAttachments(
    conversationId   = channelId,
    lastAttachmentId = oldestLoadedAttachmentId,
    types            = listOf("image", "video"),
    offset           = 0,
    ignoreDb         = false,
    loadKeyData      = LoadKeyData()
).collect { response ->
    when (response) {
        is PaginationResponse.DBResponse     -> renderFromCache(response.data)
        is PaginationResponse.ServerResponse -> renderFromServer(response.data)
        else -> {}
    }
}
getNextAttachments
suspend fun → Flow<PaginationResponse<AttachmentWithUserData>>
Loads attachments newer than lastAttachmentId (forward pagination). Use this when implementing a media viewer that allows navigating towards more recent files.
interactor.getNextAttachments(
    conversationId   = channelId,
    lastAttachmentId = newestLoadedAttachmentId,
    types            = listOf("file"),
    offset           = 0
).collect { response -> /* handle */ }
getNearAttachments
suspend fun → Flow<PaginationResponse<AttachmentWithUserData>>
Loads attachments surrounding a specific attachmentId. Useful for opening a media viewer at a particular item and needing context items on both sides for swipe navigation.
interactor.getNearAttachments(
    conversationId = channelId,
    attachmentId   = focusedAttachmentId,
    types          = listOf("image", "video"),
    offset         = 0
).collect { response -> /* render viewer context */ }

Updating Attachment Metadata

updateAttachmentIdAndMessageId
suspend fun
Synchronises the local database record’s attachment ID and message ID fields after the server has confirmed a message send. Called internally by the send pipeline; you should not need to call this directly.
updateTransferDataByMsgTid
suspend fun
Updates the upload or download transfer state for an attachment identified by its parent message’s transaction ID. The UIKit calls this internally to persist progress, completion, or error states.
interactor.updateTransferDataByMsgTid(
    TransferData(
        messageTid   = pendingMessage.tid,
        progress     = 0.75f,
        state        = TransferState.Uploading,
        url          = null,
        filePath     = localPath
    )
)
updateAttachmentFilePathAndMetadata
suspend fun
Updates the local file path, file size, and metadata for an attachment in the database after a post-processing step (e.g. transcoding or resizing).

File Deduplication

getFileChecksumData
suspend fun → FileChecksumData?
Computes or retrieves the checksum data for a local file path. When SceytChatUIKitConfig.preventDuplicateAttachmentUpload is true, this is used to detect if the file has already been uploaded and reuse the existing URL.
val checksum: FileChecksumData? = interactor.getFileChecksumData(localFilePath)
if (checksum?.url != null) {
    // File already uploaded, reuse checksum.url
}

Fetches Open Graph and other preview metadata for the given URL. The result is cached locally so subsequent calls for the same URL are served from the database.
when (val result = interactor.getLinkPreviewData("https://sceyt.com")) {
    is SceytResponse.Success -> showLinkPreview(result.data)
    is SceytResponse.Error   -> hideLinkPreview()
}
Inserts or updates a LinkPreviewDetails record in the local database. Use this to pre-populate the cache with server-provided or externally fetched preview data.
interactor.upsertLinkPreviewData(
    LinkPreviewDetails(
        link        = "https://sceyt.com",
        title       = "Sceyt Chat",
        description = "In-app chat infrastructure",
        imageUrl    = "https://sceyt.com/og-image.png"
    )
)

Build docs developers (and LLMs) love