mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(apple): add context menus to Send and Receive rows
Send rows get a context menu that acts inline without navigating: Share opens the share panel (QR + delivery) over the list via a dedicated sheet host, Stop sharing (active shares) and Delete transfer run in place, the latter through a new id-based SendModel.deleteTransfer and a list-level confirmation alert. Receive rows get a Delete action mirroring swipe-to-delete (handy on macOS).
This commit is contained in:
@@ -228,6 +228,31 @@ final class SendModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// Deletes a transfer by id, independent of the detail selection — used by the
|
||||
/// list context menu so it can act inline without navigating into the detail.
|
||||
func deleteTransfer(id: UInt64) {
|
||||
if state.isDeleting { return }
|
||||
state.isDeleting = true
|
||||
Task {
|
||||
let result = await repository.delete(transferId: id)
|
||||
switch result {
|
||||
case .success:
|
||||
filePreviewRepository.remove(transferId: id)
|
||||
if state.selectedTransferId == id {
|
||||
state.selectedTransferId = nil
|
||||
state.detailPanel = nil
|
||||
state.receiverHistory = []
|
||||
}
|
||||
state.isDeleting = false
|
||||
_ = await repository.refresh()
|
||||
messages.tryShow(UiMessage(text: .resource(L10n.Transfer.deleted), tone: .success))
|
||||
case .failure(let error):
|
||||
state.isDeleting = false
|
||||
messages.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Cancels/refuses a single receiver by responding to its request negatively.
|
||||
/// Uses the core's `respondReceiverRequest` (no backend change); applies to
|
||||
/// receivers that are still pending or accepted.
|
||||
|
||||
Reference in New Issue
Block a user