Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3369] video thumbnails compose #4096

Merged
merged 76 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
d6136be
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Aug 12, 2022
9a315f2
[3369] Implement core changes in order to enable video thumbnail
MarinTolic Aug 18, 2022
d6ce67a
[3369] Appease Detekt.
MarinTolic Aug 18, 2022
156048e
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Aug 18, 2022
06f14ca
[3369] Updated the changelog.
MarinTolic Aug 18, 2022
22c8afe
[3369] Update tests.
MarinTolic Aug 18, 2022
a7b99a0
[3369] Update tests.
MarinTolic Aug 18, 2022
a8359cf
[3369] Start work on an attachment factory capable of displaying both…
MarinTolic Aug 19, 2022
5774c14
[3369] Fully fles out `MediaAttachmentContent`s and the compsable it …
MarinTolic Aug 22, 2022
741387d
[3369] Appease detekt
MarinTolic Aug 22, 2022
51f429d
[3369] Appease detekt
MarinTolic Aug 22, 2022
8ce405a
[3369] Appease detekt
MarinTolic Aug 22, 2022
db11206
[3369] Flesh out the preview content for media attachments.
MarinTolic Aug 22, 2022
22b4ddb
[3369] Generate detekt baseline.
MarinTolic Aug 22, 2022
fe644ec
[3369] Create a detailed outline of the media gallery screen feature
MarinTolic Aug 24, 2022
0463a5e
[3369] Create a breaking change that allows the users to open the `Me…
MarinTolic Aug 25, 2022
d4dc933
[3369] Fix max line violations
MarinTolic Aug 25, 2022
219e5b0
[3369] Fix max line violations
MarinTolic Aug 25, 2022
f78f52d
[3369] Generate detekt baseline.
MarinTolic Aug 25, 2022
4b5cf67
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Aug 25, 2022
bae0d9e
[3369] Start refactoring `MediaGalleryPreviewActivity` to support off…
MarinTolic Aug 26, 2022
745b498
[3369] Start refactoring `MediaGalleryPreviewActivity` to support off…
MarinTolic Aug 26, 2022
9be17c6
[3369] Make `MediaAttachmentFactory` and its children flexible in the…
MarinTolic Aug 29, 2022
3096464
[3369] Separate image and video maximum height in `ChatDimens` add na…
MarinTolic Aug 30, 2022
923407e
[3369] Improve the offline state for the new media gallery preview sc…
MarinTolic Aug 31, 2022
4af957e
[3369] Generate detekt baseline
MarinTolic Aug 31, 2022
3dee35a
[3369] Improve the design and offline capabilities of `MediaGalleryPr…
MarinTolic Sep 1, 2022
23a390e
[3369] Improve the design and offline capabilities of `MediaGalleryPr…
MarinTolic Sep 1, 2022
84d98fd
[3369] Switch to using an avatar without an online indicator we don't…
MarinTolic Sep 1, 2022
13bb2b2
[3369] Switch to using an avatar without an online indicator we don't…
MarinTolic Sep 1, 2022
6aa7afa
[3369] Switch to using an avatar without an online indicator we don't…
MarinTolic Sep 1, 2022
d87ca74
[3369] Switch to using an avatar without an online indicator we don't…
MarinTolic Sep 1, 2022
b443c2d
[3369] Implement automatic retry for media content inside the message…
MarinTolic Sep 2, 2022
9d7bcb9
[3369] Add an error Snackbar
MarinTolic Sep 2, 2022
18f6019
[3369] Add a media quoted attachment factory and make minor and make …
MarinTolic Sep 2, 2022
c450208
[3369] Add a media quoted attachment factory and make minor and make …
MarinTolic Sep 2, 2022
7810e0f
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Sep 5, 2022
532afa3
[3369] Disable clicking on disabled options
MarinTolic Sep 5, 2022
7692074
[3369] Appease Detekt
MarinTolic Sep 5, 2022
990574a
[3369] Appease Detekt
MarinTolic Sep 5, 2022
2c559e9
[3369] Check if the request data is null when retrying requests to av…
MarinTolic Sep 5, 2022
6ede214
[3369] Generate detekt baseline
MarinTolic Sep 5, 2022
ff19d96
[3369] Add the ability to disable video thumbnails
MarinTolic Sep 5, 2022
8a775f9
[3369] Start the deprecation process for replaced components.
MarinTolic Sep 5, 2022
396f034
[3369] Generate detekt baseline
MarinTolic Sep 5, 2022
5d05023
[3369] Update StreamDimens deprecations
MarinTolic Sep 5, 2022
f673ad1
[3369] Generate detekt baseline.
MarinTolic Sep 5, 2022
684028d
[3369] Update docusaurus
MarinTolic Sep 5, 2022
9d9e0e7
[3369] Update the changelog
MarinTolic Sep 6, 2022
8362bad
[3369] Add video thumbnails to file attachment content as well
MarinTolic Sep 6, 2022
54097b1
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Sep 6, 2022
611c84b
[3369] Update bad deprecations merge conflict resolution
MarinTolic Sep 6, 2022
c4dd372
[3369] Update deprecations
MarinTolic Sep 6, 2022
ae08b29
[3369] Update deprecations
MarinTolic Sep 6, 2022
9147992
[3369] Update colours and lessen the frequency of re-evaluating same …
MarinTolic Sep 6, 2022
321a13b
[3369] Add giphy support
MarinTolic Sep 6, 2022
9266d0f
[3369] Add imgur support
MarinTolic Sep 6, 2022
fb11293
[3369] Generate detekt baseline
MarinTolic Sep 6, 2022
5a81c5a
[3369] Update kdocs to add a guiding hand and add previews
MarinTolic Sep 6, 2022
f0edbe7
[3369] Improve logical conditions for playback
MarinTolic Sep 6, 2022
c607bd5
[3369] Updated kdocs in `MediaGalleryPreviewActivityAttachmentState.k…
MarinTolic Sep 13, 2022
8b50062
[3369] Added a default value for `AttachmentState.onMediaGalleryPrevi…
MarinTolic Sep 13, 2022
442436f
[3369] Added a default value for `AttachmentState.onMediaGalleryPrevi…
MarinTolic Sep 13, 2022
f03d681
[3369] Generate an api dump
MarinTolic Sep 13, 2022
afd0346
[3369] Appease Detekt
MarinTolic Sep 13, 2022
5efde88
[3369] Remove useless TODO for an already completed task
MarinTolic Sep 13, 2022
2127954
[3369] Introduce UI feedback for sharing and cancellable sharing
MarinTolic Sep 16, 2022
9bac20c
[3369] Suppress Detekt
MarinTolic Sep 16, 2022
108b7a3
Merge branch 'develop' of https://github.com/GetStream/stream-chat-an…
MarinTolic Sep 16, 2022
d494d69
[3369] Pulled dev and resolved merge conflicts
MarinTolic Sep 16, 2022
521ae4f
[3369] Enable sharing videos.
MarinTolic Sep 16, 2022
a6b8723
[3369] Enable sharing videos with cache and large file prompts.
MarinTolic Sep 16, 2022
5690ae6
[3369] Supress warnings.
MarinTolic Sep 16, 2022
12216d4
[3369] Supress warnings.
MarinTolic Sep 16, 2022
fccc566
[3369] Clear the cache when exiting the gallery and switch to using I…
MarinTolic Sep 16, 2022
0f21554
Merge branch 'develop' into feature/3368-video-thumbnails-compose
TGazica Sep 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,36 @@
### ⬆️ Improved
- Improved the way the [ChannelsScreen](https://getstream.io/chat/docs/sdk/android/compose/channel-components/channels-screen/) is built. [#4183](https://github.com/GetStream/stream-chat-android/pull/4183)
- Improved the way the [MessagesScreen](https://getstream.io/chat/docs/sdk/android/compose/message-components/messages-screen/) is built. [#4183](https://github.com/GetStream/stream-chat-android/pull/4183)
- Improved automatic reloading of non-cached images when regaining network connection. The improvements are visible in the messages list and the new media gallery called `MediaGalleryPreviewActivity`. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)

### ✅ Added
- Added a new gallery called `MediaGalleryPreviewActivity`. This gallery is an upgrade over `ImagePreviewActivity` as it has the capability to reproduce videos as well as images, automatically reloads non-cached images upon regaining network connection and works in offline mode. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Added `MediaAttachmentContent`. The new composable is an improvement over `ImageAttachmentContent` as it has the ability to preview both videos and images and has access to the new and improved media gallery and the ability to tile more than 4 previews by modifying the parameter `maximumNumberOfPreviewedItems`. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Added `MediaAttachmentFactory`. The new factory is an improvement over `ImageAttachmentFactory`. The new factory hs the ability to preview videos and the ability to tile more than 4 previews in a group by changing the value of the parameter `maximumNumberOfPreviewedItems`. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Added parameters `attachmentsContentVideoMaxHeight`, `attachmentsContentMediaGridSpacing`, `attachmentsContentVideoWidth`, `attachmentsContentGroupPreviewWidth` and `attachmentsContentGroupPreviewHeight` to `StreamDimens`. These parameters are meant for more finer grained control over how media previews are displayed in the message list. For the best aesthetic outcome, the width of these should be equal to the value in `StreamDimens.messageItemMaxWidth`. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Added the ability to turn off video previews (thumbnails) via `ChatTheme.videoThumbnailsEnabled`. Video previews are a paid feature and as such you can turn them off. They are on by default and the pricing can be found [here](https://getstream.io/chat/pricing/). [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)

### ⚠️ Changed
- Changed the way ChannelsScreen and MessagesScreen components are built. Instead of exposing a ton of parameters for customization, we now expose a ViewModelFactory that accepts them. [#4183](https://github.com/GetStream/stream-chat-android/pull/4183)
- Using this new approach you can reuse and connect to ViewModels from the outside, if you want to power custom behavior. Make sure to check out our documentation regarding these components. [#4183](https://github.com/GetStream/stream-chat-android/pull/4183)
- 🚨 Breaking change: `MessageAttachmentsContent` function parameter `onImagePreviewResult: (ImagePreviewResult?) -> Unit` has been replaced with `onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit`. Functionally `ImagePreviewResult` and `MediaGalleryPreviewResult` are the same, the only difference is the activity they are returned from so changes should be minimal.
- 🚨 Breaking change: `QuotedMessageAttachmentContent` function parameter `onImagePreviewResult: (ImagePreviewResult?) -> Unit` has been replaced with `onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit`. Functionally `ImagePreviewResult` and `MediaGalleryPreviewResult` are the same, the only difference is the activity they are returned from so changes should be minimal.
- 🚨 Breaking change: `MessageContent` function parameter `onImagePreviewResult: (ImagePreviewResult?) -> Unit` has been replaced with `onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit`. Functionally `ImagePreviewResult` and `MediaGalleryPreviewResult` are the same, the only difference is the activity they are returned from so changes should be minimal.
- 🚨 Breaking change: `MessageContainer` function parameter `onImagePreviewResult: (ImagePreviewResult?) -> Unit` has been replaced with `onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit`. Functionally `ImagePreviewResult` and `MediaGalleryPreviewResult` are the same, the only difference is the activity they are returned from so changes should be minimal.
- 🚨 Breaking change: Both bound (with `MessageListViewModel` as a parameter) and unbound `MessageList` Composable functions have had parameter `onImagePreviewResult: (ImagePreviewResult?) -> Unit` replaced with `onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit`. Functionally `ImagePreviewResult` and `MediaGalleryPreviewResult` are the same, the only difference is the activity they are returned from so changes should be minimal.
- Video previews are now automatically displayed. These are a paid feature and can be turned off via `ChatTheme.videoThumbnailsEnabled`. If you are interested in the pricing before making a decision, you can find it [here](https://getstream.io/chat/pricing/). [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
TGazica marked this conversation as resolved.
Show resolved Hide resolved
- Started the deprecation process for `ImagePreviewActivity`, please use `MediaGalleryPreviewActivity` as it has all the functionality of the previous gallery while adding additional features such as video playback and offline capabilities. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Started the deprecation process for `ImageAttachmentFactory`, please use `MediaAttachmentFactory` as it has all the functionality of the previous factory while adding additional features such as displaying video previews modifiable number of tiles in a group preview. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Started the deprecation process for `ImageAttachmentContent`, please use `MediaAttachmentContent` as it has all the functionality of the previous component while adding additional features such as displaying video previous and modifiable number of tiles in a group preview. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)
- Started the deprecation process for `ImageAttachmentQuotedContent`, please use `MediaAttachmentQuotedContent` as it retains all of the previous functionality while adding the ability to preview video attachments. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)

### ❌ Removed

## stream-chat-android-markdown-transformer
### 🐞 Fixed

### ⬆️ Improved
- The default factory for previewing video and image attachment now is `MediaAttachmentFactory`. It holds numerous improvements, the biggest of which are the ability to reload the image intelligently if the image wasn't loaded and network connection is re-established and the access to the new and improved media gallery. [#4096](https://github.com/GetStream/stream-chat-android/pull/4096)

### ✅ Added

Expand Down
24 changes: 24 additions & 0 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ This document lists deprecated constructs in the SDK, with their expected time

| API / Feature | Deprecated (warning) | Deprecated (error) | Removed | Notes |
| --- | --- | --- | --- | --- |
| `ImageAttachmentQuotedContent` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | Deprecated in favor of `MediaAttachmentQuotedContent`. The new function has the ability to preview videos as well as images. |
| `StreamDimens` constructor containing parameter `attachmentsContentImageGridSpacing` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | This constructor has been deprecated. Use the constructor that does not contain the parameter `attachmentsContentImageGridSpacing`. |
| `ImageAttachmentContent` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | `ImageAttachmentContent` has been deprecated in favor of `MediattachmentContent`. The new function is able to preview videos as well as images and has access to a new and improved media gallery. |
| `ImageAttachmentFactory` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | `ImageAttachmentFactory` has been deprecated in favor of `MediaAttachmentFactory`. The new factory is able to preview videos as well as images and has access to a new and improved media gallery. |
| `ImagePreviewContract` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | `ImagePreviewContract` has been deprecated in favor of `MediaGalleryPreviewContract`, please use it in conjunction with `MediaGalleryPreviewActivity`. The new gallery holds multiple improvements such as the ability to reproduce mixed image and video content, automatic reloading upon regaining network connection and more. |
| `ImagePreviewActivity` | 2022.09.13 <br/>5.9.1 | 2022.09.27<br/>5.9.1 | 2022.10.11 ⌛ | This gallery activity has been deprecated in favour of `MediaGalleryPreviewContract`. The new gallery holds multiple improvements such as the ability to reproduce mixed image and video content, automatic reloading upon regaining network connection and more. |
| Lambda parameter `AttachmentState.onImagePreviewResult` | 2022.09.13 <br/>5.8.2 | 2022.10.01 ⌛ | 2022.10.15 ⌛ | Replace it with lambda parameter `AttachmentState.onMediaGalleryPreviewResult` |
| `AttachmentState` constructor containing parameter `onImagePreviewResult` | 2022.09.17 <br/>5.8.2 | 2022.10.01 ⌛ | 2022.10.15 ⌛ | This constructor has been deprecated. Use the constructor that does not contain the parameter `onImagePreviewResult`. |
| `StreamDimens` constructor containing parameter `attachmentsContentImageHeight` | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13 ⌛ | This constructor has been deprecated. Use the constructor that does not contain the parameter `attachmentsContentImageHeight`. |
| `QueryChannelsState.chatEventHandler` | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13 ⌛ | Use `QueryChannelsState.chatEventHandlerFactory` instead. |
| Multiple event specific `BaseChatEventHandler` methods | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13 ⌛ | Use `handleChatEvent()` or `handleCidEvent()` instead. |
| `NonMemberChatEventHandler` | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13 ⌛ | Use `BaseChatEventHandler` or `DefaultChatEventHandler` instead. |
| `ClientState.initialized` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | Use ClientState.initializationState instead. |
| `MessageListViewModel.BlockUser` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | Deprecated in order to make the action more explicit. Use `MessageListViewModel.ShadowBanUser` if you want to retain the same functionality, or `MessageListViewModel.BanUser` if you want to outright ban the user. The difference between banning and shadow banning can be found here: https://getstream.io/blog/feature-announcement-shadow-ban/ |
| `MessageAction.MuteUser` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to mute users via a message option has been deprecated and will be removed. |
| `MessageListView::setUserUnmuteHandler` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to unmute the user from `MessageListView` has been deprecated and will be removed. |
| `MessageListView::setUserMuteHandler` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to mute the user from `MessageListView` has been deprecated and will be removed. |
| `MessageListView.UserUnmuteHandler` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to unmute the user from `MessageListView` has been deprecated and will be removed. `UserUnmuteHandler` will be removed with it too. |
| `MessageListView.UserMuteHandler` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to mute the user from `MessageListView` has been deprecated and will be removed. `UserMuteHandler` will be removed with it too. |
| `MessageListView::setMuteUserEnabled` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to mute the user from `MessageListView` has been deprecated and will be removed. |
| `MessageListView.UserBlockHandler` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to block the user from `MessageListView` has been deprecated and will be removed. `UserBlockHandler` will be removed with it too. |
| `MessageListView::setBlockUserEnabled` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The option to block the user from `MessageListView` has been deprecated and will be removed. |
| `MessageListView` attributes | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | The attributes `streamUiMuteOptionIcon`, `streamUiUnmuteOptionIcon`, `streamUiMuteUserEnabled`, `streamUiBlockOptionIcon` and `streamUiBlockUserEnabled` have been deprecated and will be removed. The options to block and mute users will no longer be contained inside `MessageListView` |
| `MessageListViewStyle` constructor containing params: `muteIcon`, `unmuteIcon`, `muteEnabled`, `blockIcon` and `blockEnabled` | 2022.08.02 <br/>5.7.0 | 2022.09.06 ⌛ | 2022.10.04 ⌛ | This constructor has been deprecated. Use the constructor that does not contain these parameters. |
| `StreamDimens` constructor containing parameter `attachmentsContentImageHeight` | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13<br/>5.10.0 | This constructor has been deprecated. Use the constructor that does not contain the parameter `attachmentsContentImageHeight`. |
| `QueryChannelsState.chatEventHandler` | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13<br/>5.10.0 | Use `QueryChannelsState.chatEventHandlerFactory` instead. |
| Multiple event specific `BaseChatEventHandler` methods | 2022.08.16 <br/>5.8.0 | 2022.08.30<br/>5.9.0 | 2022.09.13<br/>5.10.0 | Use `handleChatEvent()` or `handleCidEvent()` instead. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ fun MessageList(
onLastVisibleMessageChanged: (Message) -> Unit = { viewModel.updateLastSeenMessage(it) },
onScrollToBottom: () -> Unit = { viewModel.clearNewMessageState() },
onGiphyActionClick: (GiphyAction) -> Unit = { viewModel.performGiphyAction(it) },
onImagePreviewResult: (ImagePreviewResult?) -> Unit = {
if (it?.resultType == ImagePreviewResultType.SHOW_IN_CHAT) {
onMediaGalleryPreviewResult: (MediaGalleryPreviewResult?) -> Unit = {
if (it?.resultType == MediaGalleryPreviewResultType.SHOW_IN_CHAT) {
viewModel.focusMessage(it.messageId)
}
},
Expand All @@ -101,7 +101,7 @@ fun MessageList(
* `onLastVisibleMessageChanged`: Handler used when the user scrolls and the last visible item changes.
* `onScrollToBottom`: Handler used when the user reaches the newest message. Used to remove the "New message" or "Scroll to bottom" actions from the UI.
* `onGiphyActionClick`: Handler used when the user clicks on one of the actions in a Giphy message. Giphy images with actions are displayed only directly after using the Giphy slash command.
* `onImagePreviewResult`: Handler used when the user receives a result from the Image Preview screen, after opening an image attachment.
* `onMediaGalleryPreviewResult`: Handler used when the user receives a result from the Media Gallery Preview screen, after opening an image or a video attachment.

You can customize the behavior here by providing your own actions, like so:

Expand All @@ -116,8 +116,8 @@ MessageList(
onLastVisibleMessageChanged = { message -> },
onScrollToBottom = { },
onGiphyActionClick = { giphyAction -> },
onImagePreviewResult = { imagePreviewResult -> },
// Content
onMediaGalleryPreviewResult = { mediaGalleryPreviewResult -> },
// Content
)
```

Expand Down Expand Up @@ -176,11 +176,12 @@ fun MessageList(
itemContent: @Composable (MessageListItemState) -> Unit = { messageListItem ->
DefaultMessageContainer(
messageListItem = messageListItem,
onImagePreviewResult = onImagePreviewResult,
onMediaGalleryPreviewResult = onMediaGalleryPreviewResult,
onThreadClick = onThreadClick,
onLongItemClick = onLongItemClick,
onReactionsClick = onReactionsClick,
onGiphyActionClick = onGiphyActionClick
onGiphyActionClick = onGiphyActionClick,
onQuotedMessageClick = onQuotedMessageClick,
)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import io.getstream.chat.android.common.state.MessageMode
import io.getstream.chat.android.common.state.Reply
import io.getstream.chat.android.compose.sample.ChatApp
import io.getstream.chat.android.compose.sample.R
import io.getstream.chat.android.compose.state.imagepreview.ImagePreviewResultType
import io.getstream.chat.android.compose.state.mediagallerypreview.MediaGalleryPreviewResultType
import io.getstream.chat.android.compose.state.messages.SelectedMessageOptionsState
import io.getstream.chat.android.compose.state.messages.SelectedMessageReactionsPickerState
import io.getstream.chat.android.compose.state.messages.SelectedMessageReactionsState
Expand Down Expand Up @@ -132,17 +132,17 @@ class MessagesActivity : BaseConnectedActivity() {
composerViewModel.setMessageMode(MessageMode.MessageThread(message))
listViewModel.openMessageThread(message)
},
onImagePreviewResult = { result ->
onMediaGalleryPreviewResult = { result ->
when (result?.resultType) {
ImagePreviewResultType.QUOTE -> {
MediaGalleryPreviewResultType.QUOTE -> {
val message = listViewModel.getMessageWithId(result.messageId)

if (message != null) {
composerViewModel.performMessageAction(Reply(message))
}
}

ImagePreviewResultType.SHOW_IN_CHAT -> {
MediaGalleryPreviewResultType.SHOW_IN_CHAT -> {
}
null -> Unit
}
Expand Down
Loading