Repository navigation
Apple share: thicket-share-apple, UIActivityViewController (iOS) and NSSharingServicePicker (macOS) (#134) - #141
Conversation
…ery share checks (#134) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…osed with no choice (#134) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the tap (#134) The XCUITest's tear-down took 300-308 s after each tap here (3 runs); tap.sh now returns at the tap's own line: 7.15 s for a tap, 25.7 s for a miss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… READMEs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🔵 Needs a closer look
The change relies on Apple-only UI and Objective-C runtime integration (including share-sheet/picker presentation and potential ABI/memory/threading concerns) that cannot be compiled or runtime-validated in this Linux review environment, so it needs confirmation on macOS/iOS toolchains before merge.
No open issues 🎉
What changed in this PR
Adds Apple (iOS + macOS) support for Thicket’s Share device service via a new Scala Native module (thicket-share-apple) that presents the system share UI using an Objective‑C runtime C helper, wires the service into the Apple galleries, expands self-test coverage, and updates build/docs accordingly.
Changes:
- Introduces
thicket-share-appleimplementingShare.text,Share.file, andavailability(iOSUIActivityViewController, macOSNSSharingServicePicker) using a C helper over the Objective‑C runtime. - Adds/extends Apple gallery self-tests for share-sheet appearance/behavior (including iOS “Copy” flow via the XCTest tapper) and integrates
AppleShareinto iOS/macOS gallery apps. - Updates docs and build configuration to include the new module and reflect device-service status/release artifacts.
Outstanding review comments to address (all moderate):
examples/ios-host/tapper/tap.sh: rebuild check relies on directory mtime forbuild/Build/Products, which is not a reliable up-to-date signal.modules/share-apple/src/main/resources/scala-native/thicket_share.c: macOSthk_share_dismissmay report success even when no popover is visible due topickerremaining non-NULL after close.modules/share-apple/src/main/scala/thicket/share/apple/AppleShare.scala: pruning of shared copies is only triggered onfile(...), despite docs indicating pruning “at each share”.
| File | Summary |
|---|---|
README.md |
Notes/links share-apple within the module set. |
modules/share/README.md |
Documents Apple share behavior and the Apple gallery self-test approach. |
modules/share-apple/src/main/scala/thicket/share/apple/AppleShare.scala |
Implements AppleShare (Scala Native) and related test hooks; manages shared file copies under cache. |
modules/share-apple/src/main/resources/scala-native/thicket_share.c |
Objective‑C runtime helper implementing iOS/macOS share presentation + self-test introspection helpers. |
examples/ios-host/tapper/TapperUITests/TapperUITests.swift |
Extends tapper to activate an app and tap a labeled cell (used for share-sheet “Copy”). |
examples/ios-host/tapper/tap.sh |
Updates tapper runner to stop early (avoid long teardown) and adds rebuild logic/` |
examples/gallery/README.md |
Describes Apple share self-test strategy on macOS/iOS. |
examples/gallery/macos/src/main/scala/example/gallery/GalleryMac.scala |
Wires AppleShare(storage.dirs.cache) into macOS gallery services. |
examples/gallery/ios/src/main/scala/example/gallery/GalleryIos.scala |
Wires AppleShare(storage.dirs.cache) into iOS gallery services. |
examples/gallery/ios/ios-app/build-app.sh |
Adds/updates drive steps for iOS share checks (including “Copy” + pasteboard validation). |
examples/gallery/apple-shared/src/main/scala/example/gallery/GalleryShareChecks.scala |
Adds Apple share checks (sheet appearance, dismissal, item-source/subject behavior, shared-file copy verification). |
examples/gallery/apple-shared/src/main/scala/example/gallery/GallerySelfTest.scala |
Integrates share checks into the Apple self-test flow. |
docs/decisions.md |
Records the Apple share implementation decision and measured behavior. |
docs/16-device-services.md |
Updates device-services progress notes to reflect Apple Share support. |
docs/14-releasing.md |
Adds thicket-share-apple to release documentation/artifact lists. |
docs/12-component-status.md |
Updates component status/check counts to reflect Share on macOS/iOS. |
build.sbt |
Adds shareApple project and wires it into platforms and Apple gallery dependencies. |
This pull request requires changes.
Review effort: Balanced
Conflict only in docs/decisions.md: both 2026-11-02 entries kept. The rest merged cleanly. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors. Not checked: the Apple self-tests (they need the Mac). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both PRs add a gallery section and a tapper action, so they meet in ten files: - build.sbt, GalleryIos, GalleryMac: both shareApple and pickersApple, both services. - GallerySelfTest: motion -> share -> clipboard -> pickers -> sheet. Share stays before the clipboard (its "Copy" must not be the last copy, #134). - build-app.sh drive(): the four picker actions and share-copy. - Tapper: both fixes for XCTest's 300 s tear-down kept. TapperUITests keeps #125's actions and exit(0), with #134's '<bundle id>|<label>' tap first (ending in done() too); tap.sh is #134's wait-and-kill loop, passing #125's TEST_RUNNER_APP and TEST_RUNNER_FILE, rebuilt when a .swift is newer. - docs/12: both counts, noted as measured apart. docs/14: both modules. decisions.md: both entries. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors; bash -n on tap.sh and build-app.sh. Not checked: the Swift tapper compiling, and any Apple self-test (they need the Mac); the combined gallery is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both add a gallery section and a tapper form: - build.sbt, README, docs/14: cameraApple and shareApple both. - GallerySelfTest: motion -> camera -> share -> clipboard -> sheet; share stays right before the clipboard (#134). - build-app.sh drive(): photo and cancel (#129) and share-copy (#134). - Tapper: three forms. "app <bundle id> a|b" (#129) is checked before '<bundle id>|<label>' (#134), since the first also has '|' in it. Every form now prints "[tapper] done" or "[tapper] failed" (#129's signal; #134's form gained both, its assertion now a guard). tap.sh is one wait-and-kill loop on those lines (both PRs had one, for the same 300 s tear-down), rebuilding when a .swift is newer than the build. "[tapper] tapped" no longer ends the wait: #129's form taps more than once. - docs/12: Camera's row from #129, Share's from main; both counts, measured apart. decisions.md: both entries. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors; bash -n on tap.sh and build-app.sh. Not checked: the Swift tapper compiling, and any Apple self-test (they need the Mac); the combined gallery is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #134.
What
thicket-share-apple:Share.text(text, subject),Share.file(path, mimeType),availability.UIActivityViewController, presented over whatever is on top of the key window (anchored for an iPad popover).NSSharingServicePickerbelow the key window's content view.resources/scala-native/thicket_share.c), as in Apple clipboard and haptics: NSPasteboard / UIPasteboard, UIImpactFeedbackGenerator #123. The subject is kept.UIActivityItemSourceis a protocol, but the helper builds a class that adopts it at run time (objc_allocateClassPair,class_addMethod,class_addProtocol). That is about 30 lines of C, against a Swift library, a build script, an archive in the jar and a shim-gen ABI. macOS has no subject for a text, so it drops it.<cache>/thicket-shared, throughSharedFiles, and the copy's URL is what is handed over. The copy is made on the calling thread.share = Some(AppleShare(storage.dirs.cache)).shareAppleis inplatforms.Measured
The checks are in
examples/gallery/apple-shared/.../GalleryShareChecks.scala.macOS (8 checks):
_NSPopoverWindowholding anNSRemoteView) appears: 136–442 ms for the text, 23–53 ms for the file.closetakes the picker down in about 530 ms, and the delegate hears no choice.iOS, "iPhone 18 Pro" (9 checks):
UIActivityViewControlleris on top within 39–212 ms.DRIVE share-copyhas an XCUITest tap the sheet's "Copy" cell. The sheet goes, the change count rises, andxcrun simctl pbpastereads "Shared from the Thicket gallery" from outside the app.Gallery totals: macOS 208 checks (204 with the screen locked, in verify-apple); iOS 216. All passed.
Controls (the code broken on purpose, then restored)
pbpastedid not read the shared text, so theshare-copyDRIVE failed.bin/verify-apple.sh "iPhone 18 Pro"(run while holding the shared lock)17 of 18 steps passed.
ios-galleryfailed for reasons outside this change:simctlerror 405) during the location DRIVE. Nothing in the run itself shut it down.simctl pbpastematched the clipboard section's last copy.Tapper change (examples/ios-host/tapper)
tap.shnow returns as soon as the test prints its line, then stops xcodebuild. A tap takes 7.2 s and a miss 25.7 s.<bundle id>|<label>form activates an app and tap 8000 s a cell with that label. It only looks at cells because the gallery has its own "Copy" button, which otherwise matched first.element.tap()looks the cell up again after tapping, and fails because the sheet has already closed.Not measured / not driven
AXIsProcessTrustedis false here).pbpastestill read the earlier text for 5 s. I did not dig further; the check failed as it should.🤖 Generated with Claude Code