mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-07 19:29:57 +02:00
fix: stop the device picker hanging on an offer
Two causes. The connect step had no timeout, so an unreachable device was retried indefinitely instead of falling through to hold-for-later; it now gives up after 15s and holds the offer as designed. The picker also waited on the whole exchange, which includes a person on the other device deciding — up to two minutes. It now closes on tap and reports the outcome as a message, and a decline or an unanswered offer is shown as information rather than an error, since the offer did arrive.
This commit is contained in:
@@ -31,10 +31,12 @@ struct DevicePickerSheet: View {
|
||||
} else {
|
||||
List(reachable) { contact in
|
||||
Button {
|
||||
Task {
|
||||
await model.offerTransfer(transferId: transferId, to: contact)
|
||||
dismiss()
|
||||
}
|
||||
// Close first. The other device's user has to accept,
|
||||
// which can take as long as they take, and holding a
|
||||
// modal open on someone else's decision reads as a
|
||||
// hang. The outcome arrives as a message instead.
|
||||
dismiss()
|
||||
model.offerTransferInBackground(transferId: transferId, to: contact)
|
||||
} label: {
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
@@ -49,7 +51,7 @@ struct DevicePickerSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.disabled(!model.state.busyEndpoints.isEmpty)
|
||||
.disabled(model.state.busyEndpoints.contains(contact.endpointId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user