-
public final class MediaGalleryPreviewViewModel extends ViewModel
A ViewModel capable of loading images, playing videos.
-
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<User>userprivate final Messagemessageprivate BooleanisSharingInProgressprivate AttachmentpromptedAttachmentprivate ConnectionStateconnectionStateprivate BooleanisShowingOptionsprivate BooleanisShowingGallery
-
Constructor Summary
Constructors Constructor Description MediaGalleryPreviewViewModel(ChatClient chatClient, ClientState clientState, String messageId, Boolean skipEnrichUrl)
-
Method Summary
Modifier and Type Method Description final StateFlow<User>getUser()The currently logged in user. final MessagegetMessage()Represents the message that we observe to show the UI data. final BooleangetIsSharingInProgress()If we are preparing a file for sharing or not. final UnitsetIsSharingInProgress(Boolean isSharingInProgress)If we are preparing a file for sharing or not. final AttachmentgetPromptedAttachment()If an attachment needs a prompt to be shared due to a large file size this value will be non-null. final UnitsetPromptedAttachment(Attachment promptedAttachment)If an attachment needs a prompt to be shared due to a large file size this value will be non-null. final ConnectionStategetConnectionState()Represent the header title of the gallery screen. final UnitsetConnectionState(ConnectionState connectionState)final BooleangetIsShowingOptions()Shows or hides the media options menu and overlay in the UI. final UnitsetIsShowingOptions(Boolean isShowingOptions)final BooleangetIsShowingGallery()Shows or hides the media gallery menu in the UI. final UnitsetIsShowingGallery(Boolean isShowingGallery)final UnittoggleMediaOptions(Boolean isShowingOptions)Toggles if we're showing the media options menu. final UnittoggleGallery(Boolean isShowingGallery)Toggles if we're showing the gallery screen. final UnitdeleteCurrentMediaAttachment(Attachment currentMediaAttachment, Boolean skipEnrichUrl)Deletes the current media attachment from the message we're observing, if possible. -
Methods inherited from class io.getstream.chat.android.compose.viewmodel.mediapreview.MediaGalleryPreviewViewModel
addCloseable, addCloseable, addCloseable, getCloseable -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MediaGalleryPreviewViewModel
MediaGalleryPreviewViewModel(ChatClient chatClient, ClientState clientState, String messageId, Boolean skipEnrichUrl)
- 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.
-
-
Method Detail
-
getUser
final StateFlow<User> getUser()
The currently logged in user.
-
getMessage
final Message getMessage()
Represents the message that we observe to show the UI data.
-
getIsSharingInProgress
final Boolean getIsSharingInProgress()
If we are preparing a file for sharing or not.
-
setIsSharingInProgress
final Unit setIsSharingInProgress(Boolean isSharingInProgress)
If we are preparing a file for sharing or not.
-
getPromptedAttachment
final Attachment getPromptedAttachment()
If an attachment needs a prompt to be shared due to a large file size this value will be non-null.
You should clear this value once the prompt is removed.
-
setPromptedAttachment
final Unit setPromptedAttachment(Attachment promptedAttachment)
If an attachment needs a prompt to be shared due to a large file size this value will be non-null.
You should clear this value once the prompt is removed.
-
getConnectionState
final ConnectionState getConnectionState()
Represent the header title of the gallery screen.
-
setConnectionState
final Unit setConnectionState(ConnectionState connectionState)
-
getIsShowingOptions
final Boolean getIsShowingOptions()
Shows or hides the media options menu and overlay in the UI.
-
setIsShowingOptions
final Unit setIsShowingOptions(Boolean isShowingOptions)
-
getIsShowingGallery
final Boolean getIsShowingGallery()
Shows or hides the media gallery menu in the UI.
-
setIsShowingGallery
final Unit setIsShowingGallery(Boolean isShowingGallery)
-
toggleMediaOptions
final Unit toggleMediaOptions(Boolean isShowingOptions)
Toggles if we're showing the media options menu.
- Parameters:
isShowingOptions- If we need to show or hide the options.
-
toggleGallery
final Unit toggleGallery(Boolean isShowingGallery)
Toggles if we're showing the gallery screen.
- Parameters:
isShowingGallery- If we need to show or hide the gallery.
-
deleteCurrentMediaAttachment
final Unit deleteCurrentMediaAttachment(Attachment currentMediaAttachment, Boolean skipEnrichUrl)
Deletes the current media attachment from the message we're observing, if possible.
This will in turn update the UI accordingly or finish this screen in case there are no more media attachments to show.
- Parameters:
currentMediaAttachment- The media attachment to remove from the message we're updating.skipEnrichUrl- If set to true will skip enriching URLs when you update the message by deleting an attachment contained within it.
-
-
-
-