Skip to content

Add queued transports (transferUserInfo + transferFile) to SundialKitConnectivity #82

@leogdion

Description

@leogdion

Epic: brightdigit/AtLeast#182

Add both queued WatchConnectivity transports end-to-end in Sources/SundialKitConnectivity. transferUserInfo is the queued dictionary transport; transferFile is the queued binary partner (encoded Data written to a temp file). One .queued SendOptions flag selects between them based on whether the message is BinaryMessagable.

⚠️ Adding methods to ConnectivitySession / ConnectivitySessionDelegate is a breaking protocol change — every conformer (observer, manager, test mocks in both packages) must implement them.

Tasks

  • ConnectivitySession.swift — add func transferUserInfo(_ userInfo: ConnectivityMessage) and func transferFile(_ fileURL: URL, metadata: ConnectivityMessage?).
  • WatchConnectivitySession+ConnectivitySession.swift — implement via session.transferUserInfo(_:) and session.transferFile(_:metadata:) (ignore returned transfer handles for now).
  • WatchConnectivitySession+WCSessionDelegate.swift — add receive delegates:
    • didReceiveUserInfo: → forward as ConnectivityMessage.
    • didReceive file: WCSessionFileread file.fileURL into Data synchronously (WC deletes the file once this returns), then forward Data + metadata.
  • ConnectivitySessionDelegate.swift — add didReceiveUserInfo: and didReceiveFile fileData: Data, metadata:. The file method carries Data, not URL, by design (symmetry with sendMessageData, sidesteps file-lifetime).
  • NeverConnectivitySession.swift — stub both as no-ops.
  • ConnectivityDelegateHandling.swift — add handleUserInfoReceived(_:) + handleFileReceived(_:metadata:) requirements and bridge methods.
  • SendOptions.swift — add static let queued (one flag; dict → userInfo, binary → file). Default behavior unchanged.
  • MessageTransport.swift / ConnectivitySendResult.context — add .userInfo and .file cases for result reporting.
  • Update test mocks to satisfy the new protocol members.

Notes

  • File-lifetime gotcha: the received WCSessionFile is deleted as soon as didReceive file: returns — the synchronous read is mandatory.
  • The binary type footer (BinaryMessageEncoder) is embedded in the Data, so transferFile metadata is not needed for type resolution — keep it optional (parity with sendMessageData).

Foundation for brightdigit/SundialKitStream routing and the Sundial example demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions