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

Add ability to swipe between media when opened from the timeline. #4205

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 28, 2025

Content

Add ability to swipe between media when open from the timeline. Previously it was only possible to swipe when the media was opened from the media gallery.

Motivation and context

Closes #4174
Closes #1484

Screenshots / GIFs

MediaViewerSwipe.mp4

Tests

  • Open a room with some media / files
  • Click on a media
  • Observe that you can now swipe left or right to navigate between the medias of the room.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

Copy link
Contributor

github-actions bot commented Jan 28, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/WVWz6J

@bmarty bmarty added the PR-Feature For a new feature label Jan 28, 2025
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 90.57377% with 23 lines in your changes missing coverage. Please review.

Project coverage is 80.19%. Comparing base (9e5c5fa) to head (c059c3f).
Report is 19 commits behind head on develop.

Files with missing lines Patch % Lines
...droid/libraries/matrix/impl/room/RustMatrixRoom.kt 0.00% 8 Missing ⚠️
...raries/mediaviewer/impl/viewer/PagerKeysHandler.kt 69.56% 2 Missing and 5 partials ⚠️
...iaviewer/impl/datasource/MediaGalleryDataSource.kt 63.63% 1 Missing and 3 partials ⚠️
...aries/mediaviewer/impl/gallery/MediaGalleryView.kt 81.25% 3 Missing ⚠️
...raries/mediaviewer/impl/model/GroupedMediaItems.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4205   +/-   ##
========================================
  Coverage    80.18%   80.19%           
========================================
  Files         2023     2026    +3     
  Lines        53280    53378   +98     
  Branches      6451     6469   +18     
========================================
+ Hits         42723    42804   +81     
- Misses        8339     8346    +7     
- Partials      2218     2228   +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmarty bmarty marked this pull request as ready for review January 28, 2025 11:56
@bmarty bmarty requested a review from a team as a code owner January 28, 2025 11:56
@bmarty bmarty requested review from ganfra and removed request for a team and ganfra January 28, 2025 11:56
Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good job!
See some of my remarks, otherwise LGTM.
We'll probably iterate later to improve with event cache!

interface MediaTimeline {
suspend fun getTimeline(): Result<Timeline>
val cache: GroupedMediaItems?
fun orCache(data: GroupedMediaItems): GroupedMediaItems
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand this method

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's maybe not needed but it's here to protect a Timeline that would not return the expected Event.
Originally I though that mediaTimeline would return faster, with an empty list of Event, but it seems that it actually return only when the expected Event has been retrieved. This is why there is this code now: groupedMediaItemsFlow.emit(AsyncData.Success(cache)) at the beginning of method TimelineMediaGalleryDataSource.start().

So the method orCache is probably not needed, but I prefer to keep it as a safety measure.

@bmarty bmarty merged commit 5539979 into develop Jan 29, 2025
28 checks passed
@bmarty bmarty deleted the feature/bma/mediaNavigation branch January 29, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Feature For a new feature
Projects
None yet
2 participants