mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-08 16:07:50 +02:00
feat(upload): add progressTotal to event payload (#2033)
Co-authored-by: Fabian-Lars <github@fabianlars.de>
This commit is contained in:
@@ -61,6 +61,7 @@ impl Serialize for Error {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ProgressPayload {
|
||||
progress: u64,
|
||||
progress_total: u64,
|
||||
total: u64,
|
||||
transfer_speed: u64,
|
||||
}
|
||||
@@ -99,6 +100,7 @@ async fn download(
|
||||
stats.record_chunk_transfer(chunk.len());
|
||||
let _ = on_progress.send(ProgressPayload {
|
||||
progress: chunk.len() as u64,
|
||||
progress_total: stats.total_transferred,
|
||||
total,
|
||||
transfer_speed: stats.transfer_speed,
|
||||
});
|
||||
@@ -153,6 +155,7 @@ fn file_to_body(channel: Channel<ProgressPayload>, file: File) -> reqwest::Body
|
||||
stats.record_chunk_transfer(progress as usize);
|
||||
let _ = channel.send(ProgressPayload {
|
||||
progress,
|
||||
progress_total: stats.total_transferred,
|
||||
total,
|
||||
transfer_speed: stats.transfer_speed,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user