oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1# Calls for iPhone
2
3A SwiftUI iOS 17+ app using the same Go authentication/signaling core and native
4WebRTC engine as Calls for Mac. No embedded webview is used. The Xcode project is
5generated from `project.yml`; edit that specification and the Swift sources.
6
7## Build
8
9Requires Xcode, Go, and XcodeGen (`brew install xcodegen`). Dependencies are pinned
10in the shared Swift package and the isolated native Go module.
11
12```sh
13make iphone
14# For a signed physical-device build:
15CALLS_DEVELOPMENT_TEAM=YOUR_TEAM_ID make iphone-device
16```
17
18Build products are `native/build/ios-simulator/Build/Products/Debug-iphonesimulator/CallsPhone.app`
19and `native/build/ios-device/Build/Products/Debug-iphoneos/CallsPhone.app`.
20The device build uses automatic development signing with your selected team; it
21does not upload an app to App Store Connect or TestFlight.
22
23Generate/open the Xcode project for normal device development:
24
25```sh
26xcodegen generate --spec native/ios/project.yml
27open native/ios/CallsPhone.xcodeproj
28```
29
30Select your development team and connected iPhone, then Run. Alternatively,
31install a signed app using `xcrun devicectl device install app --device DEVICE_ID`
32followed by the device build's `.app` path. The iPhone must be connected and
33available to Xcode, with Developer Mode enabled.
34
35## First phone milestone
36
37- **Sign in** to the Calls server (calls.oficina.works unless changed with the
38 home screen's gear), or **Join a call as a guest** with a pasted invite link;
39 sign in in Safari/the default browser.
40- Open the email link normally, compare the browser's code with Calls's code,
41 approve, then return to Calls. A member's session is kept in the Keychain
42 (this device only) and checked with the server at the next launch; see
43 [../README.md](../README.md). **Sign out** forgets it.
44- Join using the front camera and microphone; the local video display is mirrored.
45 Sent video and remote video retain their original orientation.
46- Native remote video, microphone/camera controls, guest admission, chat, and leave.
47- Chat is always available beside the call controls. Its button shows new-message
48 counts; opening it shows the latest messages and a composer without scrolling
49 past the video tiles. Opening chat keeps the call active.
50- Members have a Share button beside Chat, with Copy link and the system share menu.
51- Camera/microphone permission refusals appear in the app. Retry after changing
52 permission in Settings. The simulator has no physical camera.
53
54Calls are foreground-only in this milestone. Switching away ends the call,
55except while you are sharing your screen; sign-in survives switching to the
56browser. Camera switching, CallKit/background calling, and distribution are
57follow-up work. Physical camera, audible audio, Bluetooth routing, rotation while
58capturing, and interruption recovery need a real-device acceptance pass.
59
60## Sharing the screen
61
62**Share your screen** in the call is the system's broadcast button
63(`RPSystemBroadcastPickerView`, offering only Calls' own extension). The whole
64screen is shared, which is the only thing iOS lets any app share. The frames
65reach a **broadcast upload extension** (`Broadcast/SampleHandler.swift`, target
66`CallsBroadcast`), a separate process with a memory ceiling of about fifty
67megabytes. It links only `CallsBroadcastKit` and no WebRTC, which keeps it near
68600 KB. It shrinks each frame to 1280 on the long side, at up to fifteen a second,
69and passes it to the app over a Unix socket in the **App Group** container
70(`calls.sock`). The app is already in the call and sends the frames on the same
71`sendonly` screen transceiver the Mac and the browser use. Only one frame is in
72flight at a time; any frame that arrives while one is being written is dropped,
73never queued.
74
75Stopping works from either end. **Stop sharing** in the app closes the socket;
76the extension's next write fails and it ends the broadcast with "You stopped
77sharing your screen in Calls." Stopping from Control Center or the red status
78bar closes the socket from the other side, and the app stops the share. A
79broadcast started with no call to take it ends with "Join a call in Calls, then
80share your screen from there."
81
82A call that is sharing stays up when you leave the app, because showing other
83apps is the point. That needs the `audio` background mode. Every other call
84still ends when the app goes to the background. If the broadcast is stopped
85from outside while Calls is in the background, the call ends too.
86
87The App Group is one build setting, `CALLS_APP_GROUP` in `project.yml`
88(`group.works.oficina.calls`). It feeds both targets' entitlements and the
89`CallsAppGroup` key in both Info.plists. The extension's bundle identifier is the
90app's plus `.broadcast`. The app looks for its extension by that rule, so the
91two must stay in step.
92
93**Identifiers.** Paul ruled on 2026-11-14 that every Oficina build is
94`works.oficina.<app>`, App Store and direct download, iPhone and Mac. So the
95iPhone app is `works.oficina.calls`, the same identifier as the Mac app, and its
96extension is `works.oficina.calls.broadcast`. Earlier builds were
97`net.amadan.oficina.calls.ios` (development) and `works.oficina.meet`
98(`release/calls-testflight`); both are retired. To iOS a new identifier is a new
99app: it installs beside the old one, signed out, and asks for the camera and
100microphone again.
101
102**Delete the old iPhone apps first.** Before installing a `works.oficina.calls`
103build, delete every earlier Calls from the phone: the `net.amadan.oficina.calls.ios`
104development build ("Calls") and any `works.oficina.meet` TestFlight build. They
105all claim `oficina-calls://`, and when two apps claim a scheme iOS opens one of
106them arbitrarily, so "Join in the app" could land in the old one.
107
108**Signing.** The simulator build is unsigned, so it has no App Group and cannot
109broadcast; ReplayKit broadcasts need a device anyway. Before the first signed
110device build, in the Apple Developer portal (Certificates, Identifiers &
111Profiles):
112
1131. Identifiers → App Groups → **+** → `group.works.oficina.calls`, description
114 "Oficina Calls".
1152. Identifiers → **+** → App IDs → App → explicit `works.oficina.calls`,
116 description "Oficina Calls", with **App Groups** enabled and that group
117 chosen. Enable **Push Notifications** too if knocks should reach the phone.
1183. Identifiers → **+** → App IDs → App → explicit `works.oficina.calls.broadcast`,
119 description "Oficina Calls broadcast", with **App Groups** enabled and the
120 same group.
1214. `CALLS_DEVELOPMENT_TEAM=<team> make iphone-device`. Automatic signing makes
122 both development profiles once the identifiers exist, and
123 `-allowProvisioningUpdates` can also create steps 1–3 for you if you would
124 rather let Xcode do it.
125
126A TestFlight or App Store build needs App Store distribution profiles for **both**
127identifiers, and the extension goes up inside the app. The `works.oficina.meet`
128identifiers and profiles are no longer used by any build.
129
130## Verification
131
132```sh
133xcrun simctl list devices available
134# Choose an iPhone simulator UUID:
135CALLS_IOS_SIMULATOR=YOUR_SIMULATOR_UUID make iphone-browser
136```
137
138The Go harness creates isolated databases, meetings, and captured magic-link
139emails. iPhone UI tests use the real Safari handoff for members and guests and
140compare the authorization codes before returning to the app. No production
141credentials are used and no real email is sent. The UI tests launch with
142`-CallsForgetSignIn YES`, which signs the app out before anything else: the
143simulator's Keychain outlives reinstalls, and a session kept by an earlier run
144against a harness server long gone would otherwise decide what the next run sees.
145
146The native media test creates two iOS WebRTC peers with a synthetic camera,
147checks decoded video in both directions, continuity through three-second stream
148renewals, and removal of the departed peer. Hardware audio is disabled in this
149simulator-only test: it neither records the host microphone nor claims to prove
150physical audio quality. Synthetic capture is compiled only into test targets.
151Xcode logs and result bundles are retained under `native/build/`.
152