Repository navigation
Conversation
Demonstrate the "App Clip as invite carrier" onboarding path on iOS. A QR
code that encodes a Buzz invite link launches a native SwiftUI App Clip
(`BuzzClip`, no Flutter, ~640 KB on the simulator, far under the 15 MB QR
limit) that parses the link with the same grammar as `deep_link.dart`,
shows the community the relay's NIP-11 document describes (or a clearly
labelled placeholder when the relay is unreachable), and on "Join" parks
the invite URL for the full app before presenting the App Store overlay.
When the full app launches it drains that record once and feeds it into
the existing pending deep-link queue, so the invite is handled exactly as
if it had arrived as a universal link.
- `ios/Shared/BuzzInviteLink.swift`: Swift mirror of `parseInviteDeepLink`
/ `validateInviteRelayUri`, including the IPv4/IPv6 public-address rules.
- `ios/Shared/BuzzPendingInviteStore.swift`: single-use record written to
the writer's own Keychain (iOS 15.4+ migrates an App Clip's Keychain
items into the full app at install) plus an App Group `UserDefaults`
copy; compiled into both Runner and the clip. App Clips cannot hold the
Keychain Sharing entitlement (the simulator refuses to install one that
does), so no access group is pinned on either side.
- `ios/BuzzClip/`: the clip target (model, view, Info.plist, entitlements
with `appclips:`, parent-application-identifiers, App Group). DEBUG
builds also read `_XCAppClipURL` themselves so `xcrun simctl launch`
drives the same flow as the Xcode scheme.
- `ios/Runner/AppClipInviteBridge.swift` + `AppDelegate.swift`:
`buzz/app_clip_invite` method channel exposing `takePendingInvite`.
- `lib/shared/deeplink/app_clip_invite_bridge.dart` +
`pending_deep_link_provider.dart`: pick the invite up at build time and
`open()` it; a Riverpod provider is the test seam.
- Runner gains `applinks:$(BUZZ_INVITE_LINK_HOST)`; the host is a
placeholder (`invite.buzz.example`) in Debug/Release.xcconfig.
- `BuzzClip.xcscheme` sets `_XCAppClipURL` so the clip can be launched
from Xcode without a QR code.
- `docs/app-clip-invite-demo.md`: how to run it, what is real vs stubbed,
and the production follow-ups (AASA `appclips` entry, App Store Connect
advanced experience, provisioning, size check, iOS < 15.4 fallback).
Verified: `flutter analyze` clean; `flutter test test/shared/deeplink/`
(34 tests) green; BuzzClip builds standalone; `flutter build ios
--simulator --debug` embeds `AppClips/BuzzClip.app` (arm64-only on Xcode
27.1, whose `lipo -verify_arch` rejects Flutter's two-arch check);
`BuzzInviteLinkTests` + `BuzzPendingInviteStoreTests` (10 tests) pass on
an iPhone 17 Pro simulator. On an iPhone 17 simulator the clip launched
via `simctl` with the demo URL renders the invite card, and the full app
drains a seeded App Group record on first launch into the join sheet
("localhost:3000 / Local Dev") with a no-op relaunch. The Join tap itself
was not driven on the simulator (no Simulator GUI or `axe` on this host).
Device signing is out of scope: the Runner `applinks` entitlement needs the
Associated Domains capability on the provisioning profile.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iOS has no first-party deferred deep link, so a scanned invite QR normally ends with "install the app, then go back to the web page and tap the link again". This demo uses an App Clip as the invite carrier:
BuzzClip, a small pure-SwiftUI App Clip (~640 KB on the simulator, far under the 15 MB QR-invocation cap) that parses the link with the same grammar asdeep_link.dartand shows the community from the relay's NIP-11 document.UserDefaults, then presents theSKOverlayApp Store card for the full app.PendingDeepLinkNotifier.build()callstakePendingInviteover a method channel, the native side returns the URL once and clears both copies, and the link flows through the existing pending-deep-link queue →InviteDeepLink→DeepLinkDispatcher→ invite join sheet, exactly as if it had arrived as a universal link.How to run it, what is real vs. stubbed, and the production follow-ups:
mobile/docs/app-clip-invite-demo.md.Demo
Watch for the green Invite saved footer at ~7 s (the real Join tap) before the App Store overlay slides up, then the full app's join sheet reading localhost:3000 / Local Dev at ~12–16 s, and the relaunch at ~19 s showing only the welcome screen (the record is single-use).
appclip-invite-handoff-demo-small.mp4
Changes
ios/BuzzClip/: the App Clip target (model, view, Info.plist, entitlements withappclips:, parent-application-identifiers, App Group). DEBUG builds also read_XCAppClipURLthemselves soxcrun simctl launchdrives the same flow as the Xcode scheme.ios/Shared/BuzzInviteLink.swift: Swift mirror ofparseInviteDeepLink/validateInviteRelayUri, including the IPv4/IPv6 public-address rules.ios/Shared/BuzzPendingInviteStore.swift: the single-use handoff record (Keychain + App Group), compiled into both Runner and the clip. App Clips cannot hold the Keychain Sharing entitlement (the simulator refuses to install one that does), so no access group is pinned on either side.ios/Runner/AppClipInviteBridge.swift+AppDelegate.swift:buzz/app_clip_invitemethod channel exposingtakePendingInvite.lib/shared/deeplink/app_clip_invite_bridge.dart+pending_deep_link_provider.dart: pick the invite up at build time andopen()it;appClipInvitePickupProvideris the test seam.applinks:$(BUZZ_INVITE_LINK_HOST); the host is a placeholder (invite.buzz.example) in Debug/Release.xcconfig.BuzzClip.xcschemesets_XCAppClipURLso the clip launches without a QR code.docs/app-clip-invite-demo.md: runbook, real-vs-stubbed, production follow-ups.Verified
flutter analyzeclean;flutter test test/shared/deeplink/green (34 tests).flutter build ios --simulator --debugembedsAppClips/BuzzClip.app(arm64-only on Xcode 27.1, whoselipo -verify_archrejects Flutter's two-arch check).BuzzInviteLinkTests+BuzzPendingInviteStoreTests: 10/10 on an iPhone 17 Pro simulator.simctl keychain reset, fresh App Group container): clip launched viasimctlwith the demo URL →axe tap --label Join --tap-style physical→defaults readon the App Group suite shows thebuzz.app-clip.pending-invite.v1record → full app launch opens the join sheet and the key is gone → relaunch shows only the welcome screen.Stubbed / demo-only
BuzzInviteLink's localhost fallback name and the card shows the "Community details unavailable" placeholder rather than NIP-11 metadata. The join sheet's own Join button was not tapped (with no relay and the sample code it would fail with "This invite is not valid")._XCAppClipURLinstead of the Camera. A real QR invocation needs the AASAappclipsentry and an App Store Connect advanced experience.invite.buzz.example); the Dart parser accepts any host, so there is no single invite domain to register yet.applinksentitlement needs Associated Domains on the provisioning profile.Known follow-ups
docs/app-clip-invite-demo.mdsays the App Store overlay "has nothing to show" on the simulator. It actually renders a "Get the full app … Developer Preview" card when the parent app is installed locally (middle screenshot). Doc tweak only.CFBundleDisplayName, so the overlay reads "Buzz (app-clip-invite-handoff-de…" under the worktree override. The clip should get its own display name.🤖 Generated with Claude Code