Support gallery messages#7112
Conversation
* Support gallery messages * Address review * Remove unused function * Fix indent * Add "Gallery" message prefix * Support galleries for image editing * Fix tapping on a tile opens the last item * Fix overflow count * Add caption editing to gallery messages * Use the new gallery string for prefix * Lock sending galleries behind a feature flag * Fix detekts * Fix * Ensure image edition is saved when navigating * Fix sending media broken on edited gallery. * Fix tests * Order imports * Remove unused parameters. * Fix copyright header of new files. * Fix Konsist test * Extract new previews to a dedicated file. * Sync strings * Remove unused import * Update screenshots * Trigger CI * Remove parameters with default value. * More cleanup * Restore sendAsFile behavior. * Improve Preview. * Improve Preview. * Improve Preview. * Fix gallery sending cancel and retry issue * Ensure any previous job is cancelled. * Fix issue in summary message * Gallery feature is disabled by default. * Kotlin convention * Remove useless parenthesis * Update screenshots * Fix test * List -> ImmutableList * Remove useless code. * Render formatted caption for attachment list. * Replace set of Booleans by an enum * Remove unused model for individual caption in a gallery Event. * Fix tests * Fix tests * Rework MediaViewer entry point. And ensure that the clicked image from the gallery is displayed first. * Ensure gallery item can be click in the pinned message list Improve the gallery item click handling code. * Improve code and fix separator color Closes #7101 * React on attachment item click Improve code * Improve code and support 0 items in gallery. * Fix click on attachment item not rendering anything. --------- Co-authored-by: Benoit Marty <benoitm@element.io> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: ElementBot <android@element.io>
|
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7112 +/- ##
==========================================
Coverage 80.55% 80.55%
==========================================
Files 2686 2701 +15
Lines 76357 77717 +1360
Branches 10271 10488 +217
==========================================
+ Hits 61510 62606 +1096
- Misses 10920 11059 +139
- Partials 3927 4052 +125 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jmartinesp
left a comment
There was a problem hiding this comment.
I've reviewed the first few classes and I've found some issues, mainly with the 'per-item media quality selector' feature, it disables some optimizations and they don't seem to work well together overall.
I'll continue testing and reviewing tomorrow.
| !isApplyingImageEdits) { | ||
| if (mediaAttachment.localMedia.info.mimeType.isMimeTypeVideo() && mediaOptimizationSelectorState.videoSizeEstimations.dataOrNull() == null) { | ||
| Timber.d("Waiting for video size estimations to be able to select the best video compression preset before pre-processing the media") | ||
| return@LaunchedEffect | ||
| } |
There was a problem hiding this comment.
I think removing this may be breaking selecting the highest preset available automatically in the 'per-media' media quality feature. e.g. your video is short, so it fits in the HS max upload size in high quality (1080p) but instead standard (720p) is selected.
| val config = MediaOptimizationConfig( | ||
| compressImages = mediaOptimizationSelectorState.isImageOptimizationEnabled | ||
| ?: mediaOptimizationConfigProvider.get().compressImages, | ||
| videoCompressionPreset = mediaOptimizationSelectorState.selectedVideoPreset | ||
| ?: mediaOptimizationConfigProvider.get().videoCompressionPreset, | ||
| ) | ||
| preprocessMediaJob = coroutineScope.launch(dispatchers.io) { | ||
| preProcessAttachments( | ||
| attachments = attachmentsAndEdits.map { it.attachment }, | ||
| mediaOptimizationConfig = config, | ||
| displayProgress = true, | ||
| sendActionState = sendActionState, | ||
| ) | ||
| } |
There was a problem hiding this comment.
Why do we need to re-run the pre-processing? Shouldn't this already have happened or be happening and we should just wait for it to finish?
There was a problem hiding this comment.
It was not happening and the application was stuck when the user clicked the send buton. I will check the code again
There was a problem hiding this comment.
Maybe some of the changes broke something related to this, or maybe there's some case we didn't realise could cause this pre-processing to be cancelled 🤔 .
jmartinesp
left a comment
There was a problem hiding this comment.
Ok, here's another round of comments. I may have missed some stuff since the PR is huge, but I think once the issues with the per-item media quality feature are fixed, it should be mergeable.
…ampleMediaRenderer
|
@jmartinesp I have pushed a few commits, but I'll do more user tests on my side. |
jmartinesp
left a comment
There was a problem hiding this comment.
It seems to work pretty well now, thanks! Great job making it work with the per-item media quality. I added a couple of nits, but nothing important.
My main concern is that some other clients (like Element Web) don't seem to support this event type and there is no fallback version. I guess that's why it's behind a FF.
|
Thanks for the review @jmartinesp . I have pushed a fix and take your remark into account. I am wondering when |
|



Follow up for #6519
Support sending and rendering gallery messages (a message with multiple photos)