mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-07 11:19:58 +02:00
feat(apple): collect transfers held for this device
Adds the opt-in foreground check and an explicit Check now, the waiting-to- be-delivered list on the sender side, and honest reporting when a send could not be delivered: a closed app is a delay, not a success nobody received. The setting is off by default and its footer states that checking reveals app-open times to remembered devices, since that is the reason it is a setting at all. Records in the design doc that this shipped as one global toggle rather than the per-contact opt-in originally specified.
This commit is contained in:
@@ -335,7 +335,7 @@ final class CoreRepository: ObservableObject, CoreGateway {
|
||||
sources: [ShareSource],
|
||||
transferName: String,
|
||||
senderName: String
|
||||
) async -> Result<Share, Error> {
|
||||
) async -> Result<ContactSendOutcome, Error> {
|
||||
guard !isNetworkTransitionInProgress else {
|
||||
return .failure(CoreNetworkLifecycleError.transitionInProgress)
|
||||
}
|
||||
@@ -355,10 +355,18 @@ final class CoreRepository: ObservableObject, CoreGateway {
|
||||
accessMode: .approvalRequired
|
||||
)
|
||||
)
|
||||
return result.toModel()
|
||||
return ContactSendOutcome(share: result.share.toModel(), delivered: result.delivered)
|
||||
}
|
||||
}
|
||||
|
||||
func heldOffers() async -> Result<[HeldOfferModel], Error> {
|
||||
await runCore { try self.requireCore().listHeldOffers().map { $0.toModel() } }
|
||||
}
|
||||
|
||||
func pollContactsForOffers() async -> Result<UInt64, Error> {
|
||||
await runCore { try self.requireCore().pollContactsForOffers() }
|
||||
}
|
||||
|
||||
func forgetContact(endpointId: String) async -> Result<Void, Error> {
|
||||
await runCore { try self.requireCore().forgetContact(endpointId: endpointId) }
|
||||
}
|
||||
@@ -657,6 +665,20 @@ extension IncomingOffer {
|
||||
}
|
||||
}
|
||||
|
||||
extension HeldOfferSummary {
|
||||
func toModel() -> HeldOfferModel {
|
||||
HeldOfferModel(
|
||||
offerId: offerId,
|
||||
endpointId: endpointId,
|
||||
transferId: transferId,
|
||||
transferName: transferName,
|
||||
fileCount: fileCount,
|
||||
totalBytes: totalBytes,
|
||||
createdAt: createdAt
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
extension GrantLifetimeOption {
|
||||
func toNative() -> GrantLifetimeSetting {
|
||||
switch self {
|
||||
|
||||
Reference in New Issue
Block a user