Skip to content

Mac: Finder "Send to Phone" Service and notification "Open link" action - #401

Open
marcoslor wants to merge 1 commit into
mainfrom
t3/mac-finder-send-open-link
Open

marcoslor wants to merge 1 commit into
mainfrom
t3/mac-finder-send-open-link

Conversation

@marcoslor

Copy link
Copy Markdown
Owner

Closes #366

What

  • SHARE-20 — Finder "Send to Phone" Service. A new NSServices entry in macos/scripts/bundle.sh (sendToPhone, NSSendFileTypes public.data, so any regular file and never a folder). LinkService.sendToPhone → SendToPhoneService.send reads the selection's file URLs, keeps the regular files in order and hands them to dropFiles(urls, target: nil) — the same route a Deck drop takes. A lone .apk/.apks/.xapk still goes to the installer (SHARE-11), and the 200 MiB cap, single-transfer busy refusal and offline refusal ("Connect a phone to send files to it.") apply unchanged. No dialog, setting or wire message. A selection with no file answers Services "Only files can be sent to the phone." The log carries the file count only.
  • NOTIFY-24 — Open link on forwarded banners. NotifyLink.find(title:text:) finds exactly one distinct http/https word in the title and text together. It counts words the same way Send to Mac does (ShareInPolicy.webLinkCandidates, factored out of classify) and checks the link with ShareInPolicy.webURL (LinkPolicy plus a host). Other schemes are never candidates, and two different links give none.
  • NotifyBannerExtras.plan decides the buttons. Copy code keeps its current rule and comes first. Open link is added last, only while the phone's actions plus Copy code number fewer than 3.
  • A press goes through the router's .openLink (pd.link) to performOpenLink, which only calls NSWorkspace.open. Nothing is sent to the phone, nothing is written to the pasteboard, and the record line is notify openlink id=…. The post line gains link=0/1, placed after category= so the existing e2e greps still match.
  • The category hash now covers whether Open link is shown, so a banner with it gets its own category.

Docs

docs/specs/share-clipboard.md (SHARE-20, SHARE-S9, phone-count rows, conventions), docs/specs/notifications.md (NOTIFY-24, NOTIFY-S11, NOTIFY-9's shape hash, banner state row, CONV-PD-07), docs/UX.md, docs/MAP.md, docs/design/notify.md.

Notes for review

  • The button reads Open link, not "Open Link". UX.md's copy rules ask for sentence case, and the sibling button is "Copy code". The Service is "Send to Phone", matching "Open on Phone" and "Install on Phone".
  • public.data was chosen over public.item so that Finder doesn't offer the Service for folders, which the drop transfer can't send.

Checks

Run locally (Tier 0 only, because of the 8 GB RAM limit): swiftc -parse on every changed Swift file, check-rules, check-ratchets, check-docs --fail-on-clarifications and check-format all pass. swift build / swift test were not run locally; CI runs them. New K2 tests: NotifyLinkTests (NOTIFY-24) and SendToPhoneServiceTests (SHARE-20).

🤖 Generated with Claude Code

…on (#366)

- SHARE-20: a "Send to Phone" NSServices entry (sendToPhone, NSSendFileTypes
  public.data) hands the selected regular files to dropFiles(urls, target: nil),
  so a lone .apk/.apks/.xapk installs and the rest take the drop transfer with
  its 200 MiB cap, busy refusal and offline refusal unchanged. No dialog, no
  setting, no wire message; the log carries the file count only.
- NOTIFY-24: a forwarded banner whose title+text hold exactly one distinct
  http(s) link that passes ShareInPolicy.webURL gets an "Open link" button
  after the phone's actions and Copy code, only while those number fewer than
  three. A press opens the link in the Mac's default browser only: no
  notify.action, no pasteboard write, the record names the id only.
- Pure NotifyLink.find and NotifyBannerExtras.plan, K2 NotifyLinkTests and
  SendToPhoneServiceTests naming the spec IDs; specs, UX.md, MAP.md and
  design/notify.md updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac: Finder "Send to Phone" Service and notification "Open Link" action

1 participant