MediaGalleryPreviewViewModel

class MediaGalleryPreviewViewModel(chatClient: ChatClient, clientState: ClientState, messageId: String, skipEnrichUrl: Boolean = false) : ViewModel

A ViewModel capable of loading images, playing videos.

Parameters

chatClient

The low level chat client used for API calls.

clientState

Used to collect client state information such as the connectivity status.

messageId

The ID of the message containing the attachments to be previewed.

skipEnrichUrl

If set to true will skip enriching URLs when you update the message by deleting an attachment contained within it. Set to false by default.

Constructors

Link copied to clipboard
constructor(chatClient: ChatClient, clientState: ClientState, messageId: String, skipEnrichUrl: Boolean = false)

Properties

Link copied to clipboard

Represent the header title of the gallery screen.

Link copied to clipboard

If we are preparing a file for sharing or not.

Link copied to clipboard

Shows or hides the media gallery menu in the UI.

Link copied to clipboard

Shows or hides the media options menu and overlay in the UI.

Link copied to clipboard

Represents the message that we observe to show the UI data.

Link copied to clipboard

If an attachment needs a prompt to be shared due to a large file size this value will be non-null.

Link copied to clipboard
val user: StateFlow<User?>

The currently logged in user.

Functions

Link copied to clipboard
fun deleteCurrentMediaAttachment(currentMediaAttachment: Attachment, skipEnrichUrl: Boolean = this.skipEnrichUrl)

Deletes the current media attachment from the message we're observing, if possible.

Link copied to clipboard
fun toggleGallery(isShowingGallery: Boolean)

Toggles if we're showing the gallery screen.

Link copied to clipboard
fun toggleMediaOptions(isShowingOptions: Boolean)

Toggles if we're showing the media options menu.

Inherited functions

Link copied to clipboard
open fun addCloseable(closeable: AutoCloseable)
fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard