-
Notifications
You must be signed in to change notification settings - Fork 321
feat(timeline): report progress for media uploads #5454
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
base: main
Are you sure you want to change the base?
feat(timeline): report progress for media uploads #5454
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5454 +/- ##
=======================================
Coverage 88.93% 88.93%
=======================================
Files 334 334
Lines 92420 92433 +13
Branches 92420 92433 +13
=======================================
+ Hits 82196 82208 +12
- Misses 6378 6379 +1
Partials 3846 3846 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #5454 will improve performances by 21.81%Comparing Summary
Benchmarks breakdown
|
abc8928
to
a01918f
Compare
…ate::NotSentYet Signed-off-by: Johannes Marbach <[email protected]>
…ntYet Signed-off-by: Johannes Marbach <[email protected]>
8cf4c7d
to
77966e5
Compare
…::NotSentYet Move AbstractProgress from client to timeline Signed-off-by: Johannes Marbach <[email protected]>
…tSendState::NotSentYet Retain progress when applying remote echo Signed-off-by: Johannes Marbach <[email protected]>
3f36d7e
to
c23d92d
Compare
I have addressed all comments from #5008, except for:
This is turning out a little more involved than expected, sadly. There are places like here when a timeline item is added where I would have to peek into the content and figure out if it's a media event or not. There's also the retry handling here where I only have the transaction ID to figure out if it's a media upload transaction or not. It feels like working in a new enum variant there might introduce quite a bit of complexity. Alternatively, we could only use I currently feel like keeping the progress optional in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've discussed this with the Rust SDK core team, and we think this is a nice API. We might experiment with a new EventSendState::Uploading
state later, but since this is unclear whether it'll be good or not, I won't request it now.
My final comments are mostly cosmetic improvements, so a last round and we should be good to go. Thanks for this PR!
#[derive(Clone, Copy, uniffi::Enum)] | ||
pub enum EventSendProgress { | ||
/// A media is being uploaded. | ||
MediaUpload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this isn't serialized: maybe we could make this enum with one variant a plain struct, instead? MediaUploadProgress
or something like that?
@@ -990,7 +1041,10 @@ impl TimelineItem { | |||
#[derive(Clone, uniffi::Enum)] | |||
pub enum EventSendState { | |||
/// The local event has not been sent yet. | |||
NotSentYet, | |||
NotSentYet { | |||
/// The progress of the sending operation, if any is available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we precise it's only available for media uploads, at the moment?
// If the local echo had an upload progress, retain it. | ||
let progress = as_variant!(&prev_local_item.send_state, | ||
EventSendState::NotSentYet { progress } => progress.clone()) | ||
.flatten(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's let the code breath a bit, and simplify the as_variant!
to do as little as possible:
// If the local echo had an upload progress, retain it. | |
let progress = as_variant!(&prev_local_item.send_state, | |
EventSendState::NotSentYet { progress } => progress.clone()) | |
.flatten(); | |
// If the local echo had an upload progress, retain it. | |
let progress = as_variant!(&prev_local_item.send_state, EventSendState::NotSentYet) | |
.and_then(|progress| progress.cloned()); | |
@@ -65,7 +68,10 @@ impl LocalEventTimelineItem { | |||
#[derive(Clone, Debug)] | |||
pub enum EventSendState { | |||
/// The local event has not been sent yet. | |||
NotSentYet, | |||
NotSentYet { | |||
/// The progress of the sending operation, if any is available. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we precise it's only available for media uploads, please?
pub enum EventSendProgress { | ||
/// A media (consisting of a file and possibly a thumbnail) is being | ||
/// uploaded. | ||
MediaUpload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, since this is an enum with a single variant, and that's not ser/de, let's use a struct instead
This is meant to only contain the timeline changes broken out from #5008 (together with #5453 which this depends on).
Signed-off-by: