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

feat(ffi): expose a custom timeline builder that can be configured to show only media, images and videos or files and audios #4365

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

stefanceriu
Copy link
Member

Instances of these timelines will be used to power the 2 different tabs shown on the new media browser. The client will be responsible for interacting with it similar to a normal timeline and transforming its data into something renderable e.g. section by date separators (which will be made configurable in a follow up PR)

@stefanceriu stefanceriu requested a review from a team as a code owner December 2, 2024 13:17
@stefanceriu stefanceriu requested review from andybalaam and removed request for a team December 2, 2024 13:17
Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.12%. Comparing base (ad3d1fb) to head (7abd774).
Report is 31 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4365      +/-   ##
==========================================
+ Coverage   85.09%   85.12%   +0.02%     
==========================================
  Files         280      280              
  Lines       30547    30547              
==========================================
+ Hits        25995    26002       +7     
+ Misses       4552     4545       -7     

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

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Sweet, a few proposals to make it slightly more generic for other consumers; I'd like to read your opinion before approving :-)

Comment on lines 58 to 59
ImageAndVideo,
FileAndAudio,
Copy link
Member

Choose a reason for hiding this comment

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

A few remarks:

  • can you add doc comments for these variants, please?
  • it seems a bit arbitrary to join image with video, and file with audio. I suppose these come from ElementX requirements, but we're trying to make the SDK a bit more general (although arguably, the FFI layer is quite adhoc to EX apps). Would it make sense to split those into four variants: Image, Video, File, Audio, and accept an array of them in media_events_timeline instead? That way, embedders can compose these as they want to, and not have to add new variants in there.

Copy link
Member Author

Choose a reason for hiding this comment

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

can you add doc comments

sure thing 👍

Would it make sense to split those into four variants

Yep yep, makes sense to me, I'll make the change

bindings/matrix-sdk-ffi/src/room.rs Outdated Show resolved Hide resolved
) -> Result<Arc<Timeline>, ClientError> {
let room = &self.inner;

let mut builder = matrix_sdk_ui::timeline::Timeline::builder(room);
Copy link
Member

Choose a reason for hiding this comment

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

Could we also ask for a timeline internal id prefix in this function's signature, and pass it here? This would help tracking issues in rageshakes, since the internal id prefix is used to distinguish across different timeline instances.

Copy link
Member

Choose a reason for hiding this comment

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

We may want to add a note that we're not passing a UTD hook here, but that's fine because we should be flagging those in the main timeline anyways.

@@ -260,6 +267,33 @@ impl Room {
Ok(Timeline::new(timeline))
}

pub async fn media_events_timeline(
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a rough doc comment, please?

@bnjbvr bnjbvr removed the request for review from andybalaam December 3, 2024 08:32
@stefanceriu
Copy link
Member Author

Alrighty, I went with exposing all of the possible RoomMessage message types and allowing any combination of them to be passed in as a filter. I'll squash and update the description before merging if everything else is in order 👍

@stefanceriu stefanceriu requested a review from bnjbvr December 3, 2024 15:29
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

…onfigured to only include RoomMessage type events and filter those further based on their message type.

Virtual timeline items will still be provided and the `default_event_filter` will be applied before everything else.
Instances of these timelines will be used to power the 2 different tabs shown on the new media browser. The client will be responsible for interacting with it similar to a normal timeline and transforming its data into something renderable e.g. section by date separators (which will be made configurable in a follow up PR)
@stefanceriu stefanceriu merged commit 9c381c1 into main Dec 4, 2024
40 checks passed
@stefanceriu stefanceriu deleted the stefan/mediaGallery branch December 4, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants