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

Media Viewer: show snackbar when reaching end of timeline. #4201

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 27, 2025

Content

Media Viewer: show snackbar when reaching end of timeline.

When the loading page is displayed and there is no more media to load, the loading page vanished (this is handled automatically by the HorizontalPager - without animation (is does not seem to be supported yet by the library) and a Snackbar is displayed. This PR handle the displaying of the snackbar.

Motivation and context

Follow design from Figma https://www.figma.com/design/Ni6Ii8YKtmXCKYNE90cC67/Timeline-(new)?node-id=2660-29699&m=dev

Screenshots / GIFs

Tests

  • Open a room with at least one media
  • navigate to "Media and files" and open the media, then quickly swipe to right to see the loader
  • wait for the pagination request to reach the beginning of the room and observe that the media viewer navigate to the previous item and a snckbar is displayed.

Tested devices

  • Physical
  • Emulator using hack code to simulate the scenario above.
  • 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

@bmarty bmarty added the PR-Wip For anything that isn't ready to ship and will be enabled at a later date label Jan 27, 2025
@bmarty bmarty requested a review from a team as a code owner January 27, 2025 10:37
@bmarty bmarty requested review from ganfra and removed request for a team January 27, 2025 10:37
Copy link
Contributor

github-actions bot commented Jan 27, 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/S9aa49

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 97.36842% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.36%. Comparing base (df82afb) to head (792c350).
Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...es/mediaviewer/impl/viewer/MediaViewerPresenter.kt 97.36% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4201   +/-   ##
========================================
  Coverage    83.35%   83.36%           
========================================
  Files         1886     1886           
  Lines        49404    49437   +33     
  Branches      5804     5811    +7     
========================================
+ Hits         41181    41213   +32     
  Misses        6134     6134           
- Partials      2089     2090    +1     

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

@@ -64,6 +72,37 @@ class MediaViewerPresenter @AssistedInject constructor(
var currentIndex by remember { mutableIntStateOf(searchIndex(data, inputs.eventId)) }
val snackbarMessage by snackbarDispatcher.collectSnackbarMessageAsState()

val isRenderingLoadingBackward by remember {
Copy link
Member

Choose a reason for hiding this comment

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

This will cause the the Present method to recompose, I think you should try to manage this only using snapshot flows inside the LaunchedEffect.
Maybe also extract that into a separate 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.

I have extracted to sub method. For the recomposition issue can we handle it later?

@bmarty bmarty merged commit 23e2caa into develop Jan 27, 2025
28 checks passed
@bmarty bmarty deleted the feature/bma/mediaSwipeEndOfRoom branch January 27, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Wip For anything that isn't ready to ship and will be enabled at a later date
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants