mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(ui): surface transfer progress, cancel, and delivery events
Make the transfer loop feel live: parse real core progress payloads, show progress on send/receive surfaces, allow cancel/stop, retry failed receives, and fix delivery-phase events so receiver completion updates the UI.
This commit is contained in:
@@ -36,7 +36,7 @@ bytes through Kotlin memory.
|
||||
- Transfer statuses: `sharing`, `receiving`, `done`, `failed`, `cancelled`,
|
||||
`stopped`.
|
||||
- Main event phases: `endpoint`, `import`, `ticket`, `handshake`, `approval`,
|
||||
`access`, `transfer`, `download`, `export`, `lifecycle`, `error`.
|
||||
`access`, `transfer`, `download`, `export`, `delivery`, `lifecycle`, `error`.
|
||||
- Events are sent to `CoreEventSink` immediately and persisted through the event
|
||||
hub. `list_events` flushes queued persistence before reading SQLite.
|
||||
- `shutdown()` is idempotent and flushes events before stopping the router.
|
||||
|
||||
@@ -45,6 +45,8 @@ enum EventPhase {
|
||||
Handshake,
|
||||
Approval,
|
||||
Transfer,
|
||||
/// Delivery receipts from receivers (completed download acknowledgements).
|
||||
Delivery,
|
||||
}
|
||||
|
||||
impl EventPhase {
|
||||
@@ -65,6 +67,7 @@ impl EventPhase {
|
||||
"handshake" => Some(Self::Handshake),
|
||||
"approval" => Some(Self::Approval),
|
||||
"transfer" => Some(Self::Transfer),
|
||||
"delivery" => Some(Self::Delivery),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -86,6 +89,7 @@ impl EventPhase {
|
||||
Self::Handshake => "handshake",
|
||||
Self::Approval => "approval",
|
||||
Self::Transfer => "transfer",
|
||||
Self::Delivery => "delivery",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,14 @@ fn public_share_receives_without_sender_approval() {
|
||||
assert_eq!(deliveries[0].receiver_name.as_deref(), Some("Receiver"));
|
||||
assert_eq!(deliveries[0].status, "completed");
|
||||
assert!(deliveries[0].completed_at.is_some());
|
||||
assert!(
|
||||
sender.sink.events().iter().any(|event| {
|
||||
event.phase == "delivery"
|
||||
&& event.kind == "receiver-completed"
|
||||
&& event.transfer_id == Some(share.transfer_id)
|
||||
}),
|
||||
"delivery receipts must emit a delivery phase event for UI live updates"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user