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

refactor(ffi): clean up functions to send medias #4482

Merged
merged 4 commits into from
Jan 8, 2025
Merged

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jan 8, 2025

Number of parameters and code duplication has gone a bit too wild lately.

bnjbvr added 4 commits January 8, 2025 11:05
Note: `Box<dyn ProgressWatcher>` couldn't be put in a `Record`, so
doesn't belong in `UploadParameters` as a result.
…uish early from late errors

Some errors can be handled immediately and don't need a request to be
spawned, e.g. invalid mimetype and so on. The returned task handle still
deals about "late" errors about the upload failing (for sync uploads) or
the send queue failing to push the media upload (for async uploads).
This is a breaking change because uniffi may use foreign-language named
parameters based on the Rust parameter name.
@bnjbvr bnjbvr requested a review from a team as a code owner January 8, 2025 10:48
@bnjbvr bnjbvr requested review from Hywan and removed request for a team January 8, 2025 10:48
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.10%. Comparing base (3f977b7) to head (59ff563).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4482      +/-   ##
==========================================
- Coverage   85.12%   85.10%   -0.03%     
==========================================
  Files         283      283              
  Lines       31768    31768              
==========================================
- Hits        27043    27035       -8     
- Misses       4725     4733       +8     

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

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Nice refactoring. Thanks!

Ok(None)
}
}
}

#[derive(uniffi::Record)]
pub struct UploadParameters {
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

And here is the approval.

@bnjbvr bnjbvr merged commit dc2775e into main Jan 8, 2025
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/ffi-send-media branch January 8, 2025 13:20
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