mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-07 11:19:58 +02:00
feat(apple): offer to remember a device after a transfer
Closes the loop: until now nothing in the UI could create a contact, so the list stayed empty unless the peer initiated. A completed receive names its sender and a completed delivery names its receiver, so both sides get the suggestion. Declining is persisted, or every later transfer with the same device would re-ask a question already answered; pairing deliberately afterwards clears that. The suggestion sheet ranks below the two other prompts, since nobody is waiting on the answer.
This commit is contained in:
@@ -319,6 +319,13 @@ private struct ContactPromptLayer: View {
|
||||
receiveModel.receiveOffered(ticket: ticket)
|
||||
}
|
||||
}
|
||||
},
|
||||
onSuggestionResponse: { suggestion, accepted in
|
||||
if accepted {
|
||||
Task { await contacts.acceptSuggestion(suggestion) }
|
||||
} else {
|
||||
contacts.declineSuggestion(suggestion)
|
||||
}
|
||||
}
|
||||
)
|
||||
.onChange(of: promptKey) { _, key in
|
||||
@@ -332,6 +339,7 @@ private struct ContactPromptLayer: View {
|
||||
guard approvals.state.current == nil else { return nil }
|
||||
if let offer = contacts.state.currentOffer { return "offer-\(offer.offerId)" }
|
||||
if let pairing = contacts.state.currentPairing { return "pairing-\(pairing.endpointId)" }
|
||||
if let suggestion = contacts.state.currentSuggestion { return "suggest-\(suggestion.endpointId)" }
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user