Skip to content

feat(ios): receive shares through an App Group inbox - #1935

Merged
houko merged 1 commit into
nsgo-dev:mainfrom
houko:feat/incoming-shares-655
Nov 24, 2026
Merged

houko merged 1 commit into
nsgo-dev:mainfrom
houko:feat/incoming-shares-655

Conversation

@houko

@houko houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the missing iOS receiving path beside Android's existing implementation from #1666. Apps declare apple.share_types as UTIs and keep using mobile.OnShared. A Go share extension imports provider objects/files into an atomic App Group inbox; the containing app copies files into its cache and delivers batches on activation or a Darwin notification while active.

Batches remain durable until the app's callback returns, including while no handler is registered. The core acknowledges each batch once, and disk cleanup runs off the engine goroutine. URL and text providers use typed object loading; attachments retain file contents and MIME metadata, with private file URLs requiring a grant or a provider temporary copy.

The tool builds and signs <id>.share without handwritten C or Swift. Xcode device runs give widget and share extensions independent signing targets; IPA builds use sign.share_profile or -share-profile. The extension remains available in vendored tool dependencies. Public docs, the NSGo skill, roadmap, and changelog fragment are updated.

Related to #655. Keep that issue open: this implements the supported inbox handoff, and does not claim full acceptance. Apple's NSExtensionContext.open documentation supports Today/iMessage extension points, not Share extensions; automatic foreground/cold-launch is therefore still an unsupported requirement.

Targets

  • Shared code (core, the nsgo tool and nsgotest)
  • iOS
  • Docs

Android's existing receiving path is unchanged. Shared-event consumers still accept the existing []SharedItem payload. App Clips, tvOS and watchOS do not receive a share extension.

Screenshots

None; system share-sheet UI acceptance is pending.

Verification

  • go tool nsgo check, including the dev client.
  • One multi-target go tool nsgo check -target macos,ios_simulator,tvos_simulator,android,web,windows,linux,harmonyos -jobs 3: all requested targets passed, including both desktop architectures.
  • Latest iOS simulator vet passed after the provider-loading changes.
  • All 814 core tests passed; durable acknowledgment, six inbox restart/limits/path-confinement cases, ReceiveShare, layering, skill, block-bridge and changelog-fragment checks passed.
  • 10 focused tool tests passed, including actual vendored Go extension compilation and codesign --verify --strict, Xcode project parsing with both extensions, profile bundle/group validation, and signing flag overrides.
  • Five focused native iPhone XR tests passed with no skips using a temporary task-only configuration without App Groups: real NSItemProvider callbacks for URL/plain-text links and an attachment file, direct URL/file copying, UTF-8 data including embedded NUL, rejection of unscoped private file URLs, and iOS nsgotest.ReceiveShare engine delivery. The original YAML was restored and the task app uninstalled.

Remaining acceptance

  • Physical App Group signing is blocked before installation: local Xcode has no configured Apple account, and its cached wildcard provisioning profile lacks App Groups. The real Go extension and both-target project build successfully up to provisioning.
  • App Group notification/activation integration in a simulator remains unproven: the dedicated remote simulator run stalled in CoreSimulator operations and exited with timeout 124 after the eight-minute command limit. No shared simulator service was restarted.
  • Safari/Files system share-sheet acceptance and actual extension-process startup remain pending. The native provider tests use real Foundation providers with a test context; they do not substitute for those system checks.

Checklist

  • Conventional Commit title.
  • Docs and skill updated; user-visible outcome recorded in changelog.d/ios-incoming-shares.md.
  • No new third-party code, assets, or dependencies.

@github-actions github-actions Bot added size/XL enhancement New feature or request documentation Improvements or additions to documentation iOS core cli labels Nov 22, 2026
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 22, 2026
@houko
houko force-pushed the feat/incoming-shares-655 branch from 5753a3e to 2cb5e34 Compare November 22, 2026 09:01
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 22, 2026
@houko
houko force-pushed the feat/incoming-shares-655 branch 2 times, most recently from d0575ac to 8ffa7cc Compare November 23, 2026 07:02
@houko
houko marked this pull request as ready for review November 23, 2026 11:11
A Go share extension (NSGoShare.appex, apple.share_types) copies shared text and files into the App Group as atomic batches. The app drains them on activation and on a Darwin notification, off the main thread, and acknowledges each batch after mobile.OnShared returns. A batch that cannot be read is set aside and removed after a day instead of failing on every activation. Xcode device signing and IPA builds (sign.share_profile, -share-profile) sign the extension as its own target, and the signing project keeps the App Clip's targets intact.

Refs nsgo-dev#655
@houko
houko force-pushed the feat/incoming-shares-655 branch from 533af06 to b506d77 Compare November 24, 2026 00:15
@houko

houko commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Reworked. Rebuilt on current main with only the share changes, dropping the stale-base doc and Xcode template reverts. The iOS surface now starts the inbox reader and wakes it on activation, so a real app drains the inbox. The signing template ranges over the extensions and keeps the App Clip's Frameworks phase and the project-level products directory; a new test checks that every referenced object ID is defined with widgets, a share extension and a Clip together. A batch that fails to read is set aside as .rejected-<batch> and removed after a day, and the docs state the cache copies' lifetime as on Android. Verified with go vet ./... on Linux, nsgo check for ios, ios_simulator and macos_arm64, the core, shareinbox, cmd/nsgo and layering tests, and the mobile catalogs. The share extension's simulator tests were not run, because the Mac Studio system disk is full.

@houko
houko merged commit 7a94d25 into nsgo-dev:main Nov 24, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation enhancement New feature or request iOS size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant