oficina / meet Public

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

Plain git — no account needed to clone.

Download

Download this file

1@_spi(Fixtures) import CallsKit
2import SwiftUI
3
4/// What the controls sheet was closed in order to open.
5enum MoreAction { case devices, chat, report }
6
7/// The full-screen call: the picture under the status bar and the home
8/// indicator, both of which go with the controls. A tap shows the
9/// controls and another hides them; they go on their own 3 s after the
10/// last touch (see ControlsVisibility for why that long, and what keeps
11/// them up). The bar is a controls menu on the left and End call on the
12/// right; everything else is in the menu.
13extension PhoneCall {
14 /// The round buttons' size, and the bar's height with its margin.
15 static let button: CGFloat = 56
16 static let barHeight: CGFloat = 56 + 16
17
18 /// How far up from the screen's bottom the self view's insets reach
19 /// while the bar shows: the bar over the safe area as ever, and never
20 /// less than its buttons' tops (they sit `max(safe, 16) + 4` up), so
21 /// with PiPLayout's 12 pt margin the view is at least 12 pt clear of them.
22 static func selfViewRaise(safeBottom: CGFloat) -> CGFloat {
23 max(safeBottom + barHeight, max(safeBottom, 16) + 4 + button)
24 }
25 static let tileBackdrop = Color(white: 0.13)
26
27 var fullScreen: some View {
28 GeometryReader { geometry in
29 let safe = geometry.safeAreaInsets
30 let size = CGSize(
31 width: geometry.size.width + safe.leading + safe.trailing,
32 height: geometry.size.height + safe.top + safe.bottom)
33 ZStack {
34 Color.black
35 stage(in: size, safe: safe)
36 .contentShape(Rectangle())
37 .onTapGesture { chrome.tapped() }
38 .accessibilityAddTraits(.allowsDirectInteraction)
39 if !grid, selfFloats { selfView(in: size, safe: safe) }
40 topOverlay(safe: safe)
41 // Gone rather than transparent while hidden, so nothing invisible
42 // can be tapped or found; the fade is the transition.
43 if chrome.visible { bar(safe: safe).transition(.opacity) }
44 // Space on a hardware keyboard, as the classic bar's Mute has it;
45 // the full-screen Mute is in the menu, so this stands in for it.
46 Button("Mute or unmute microphone") { call.mute() }
47 .keyboardShortcut(.space, modifiers: [])
48 .opacity(0).frame(width: 0, height: 0).accessibilityHidden(true)
49 }
50 .frame(width: size.width, height: size.height)
51 .ignoresSafeArea()
52 }
53 .toolbar(.hidden, for: .navigationBar)
54 .statusBarHidden(!chrome.visible)
55 .persistentSystemOverlays(chrome.visible ? .automatic : .hidden)
56 .animation(fade, value: chrome.visible)
57 .onAppear { updateHolds() }
58 .onChange(of: showingMore) { updateHolds() }
59 .onChange(of: showingDevices) { updateHolds() }
60 .onChange(of: showingChat) { updateHolds() }
61 .onChange(of: voiceOver) { updateHolds() }
62 .sheet(
63 isPresented: $showingMore,
64 onDismiss: {
65 switch afterMore {
66 case .devices?: showingDevices = true
67 case .chat?:
68 readChatCount = call.receivedChatCount
69 showingChat = true
70 case .report?: call.reportProblem()
71 case nil: break
72 }
73 afterMore = nil
74 }
75 ) {
76 MoreControls(
77 call: call, arrangement: arrangement, title: itemTitle, unread: unread,
78 open: { action in
79 afterMore = action
80 showingMore = false
81 },
82 close: { showingMore = false }
83 )
84 .presentationDetents([.medium, .large])
85 }
86 }
87
88 private var fade: Animation {
89 ControlsVisibility.fade(showing: chrome.visible, reduceMotion: reduceMotion)
90 }
91
92 private func updateHolds() {
93 chrome.set(.menuOpen, showingMore || showingDevices || showingChat)
94 chrome.set(.voiceOver, voiceOver)
95 }
96
97 // MARK: Stage
98
99 @ViewBuilder private func stage(in size: CGSize, safe: EdgeInsets) -> some View {
100 Group {
101 if let fixtureBackdrop {
102 fixtureBackdrop.view.accessibilityHidden(true).accessibilityIdentifier("callStage")
103 } else if grid {
104 grid(in: size, safe: safe).accessibilityIdentifier("callStage")
105 } else {
106 speakerStage(in: size, safe: safe)
107 }
108 }
109 .coordinateSpace(name: arrangeSpace)
110 .onPreferenceChange(TileFramesKey.self) { tileFrames = $0 }
111 }
112
113 /// Speaker view: the stage fills the whole screen, edge to edge, and
114 /// everyone else is a filmstrip floating over its bottom that scrolls
115 /// sideways, in this viewer's order (2026-10-05: until then the stage
116 /// stopped above the filmstrip, a black band behind it). The filmstrip
117 /// sits just above the home indicator and rises clear of the bar while
118 /// the controls show, as the self view does; the stage's name rides just
119 /// above it (StageLabel). In a call of two there is no filmstrip: the
120 /// other person fills the screen and you float.
121 private func speakerStage(in size: CGSize, safe: EdgeInsets) -> some View {
122 let strip = selfFloats ? [] : filmstrip
123 let thumb = Self.filmstripTile(in: size)
124 let band = strip.isEmpty ? 0 : thumb.height + 2 * Self.filmstripPadding
125 let raised = chrome.visible ? Self.barHeight : 0
126 let lift = EdgeInsets(
127 top: 0, leading: safe.leading,
128 bottom: safe.bottom + StageLabel.lift(bar: raised, band: band),
129 trailing: 0)
130 return ZStack(alignment: .bottom) {
131 Group {
132 if let focused {
133 phoneTile(focused, cornerRadius: 0, compact: true, labelInsets: lift, onStage: true)
134 } else {
135 ContentUnavailableView(
136 "Waiting for others", systemImage: "person.2",
137 description: Text("Others will appear here when they join.")
138 )
139 .foregroundStyle(.white.opacity(0.85))
140 .environment(\.colorScheme, .dark)
141 .frame(maxWidth: .infinity, maxHeight: .infinity)
142 }
143 }
144 // The stage, and not the filmstrip, is what the UI tests tap to
145 // bring the controls back.
146 .accessibilityIdentifier("callStage")
147 .frame(maxWidth: .infinity, maxHeight: .infinity)
148 // The pin, over the stage's top corner below the title; outside
149 // the stage's own accessibility identifier, so it keeps its own.
150 if let focused, arrangement.pinned == focused {
151 PinBadge(title: itemTitle(focused)) { arrangement.pin(nil) }
152 .padding(.top, max(safe.top, 12) + 60).padding(.trailing, safe.trailing + 12)
153 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing)
154 }
155 if !strip.isEmpty {
156 ScrollView(.horizontal) {
157 HStack(spacing: 6) {
158 ForEach(strip, id: \.self) { item in
159 phoneTile(item, cornerRadius: 10, compact: true, backdrop: Self.tileBackdrop, iconOnly: true)
160 .frame(width: thumb.width, height: thumb.height)
161 .modifier(arrangeable(item, tapToPin: true))
162 }
163 }
164 .padding(.horizontal, 10).padding(.vertical, Self.filmstripPadding)
165 .frame(minWidth: size.width - safe.leading - safe.trailing)
166 }
167 .scrollIndicators(.never)
168 .accessibilityElement(children: .contain)
169 .accessibilityLabel("Filmstrip")
170 .accessibilityIdentifier("filmstrip")
171 .padding(.leading, safe.leading).padding(.trailing, safe.trailing)
172 .padding(.bottom, safe.bottom + raised)
173 .animation(ControlsVisibility.fade(showing: chrome.visible, reduceMotion: reduceMotion), value: chrome.visible)
174 }
175 }
176 }
177
178 static let filmstripPadding: CGFloat = 6
179
180 /// A filmstrip tile: upright 3:4 in portrait, as a phone's camera sees
181 /// a face, 4:3 in landscape; about an eighth of the screen's height.
182 static func filmstripTile(in size: CGSize) -> CGSize {
183 if size.height >= size.width {
184 let height = min(132, max(96, (size.height / 7).rounded()))
185 return CGSize(width: (height * 3 / 4).rounded(), height: height)
186 }
187 let height = min(96, max(64, (size.height / 5).rounded()))
188 return CGSize(width: (height * 4 / 3).rounded(), height: height)
189 }
190
191 /// Every tile as large as fits inside the safe area, scrolling only
192 /// once they would be too small to see.
193 private func grid(in size: CGSize, safe: EdgeInsets) -> some View {
194 let items = gridItems
195 let count = items.count
196 let area = CGSize(
197 width: size.width - safe.leading - safe.trailing - 8,
198 height: size.height - safe.top - safe.bottom - 8)
199 let aspect: CGFloat = area.width > area.height ? 4 / 3 : 3 / 4
200 let columns = GridFit.columns(count: count, in: area, aspect: aspect)
201 let fitted = GridFit.tile(count: count, columns: columns, in: area, aspect: aspect)
202 let tile = fitted.width >= 110 ? fitted : CGSize(width: 110, height: 110 / aspect)
203 let across = fitted.width >= 110 ? columns : max(1, Int((area.width + 4) / (tile.width + 4)))
204 return ScrollView {
205 LazyVGrid(
206 columns: Array(repeating: GridItem(.fixed(tile.width), spacing: 4), count: across),
207 spacing: 4
208 ) {
209 ForEach(items, id: \.self) { item in
210 phoneTile(item, cornerRadius: 8, compact: true, backdrop: Self.tileBackdrop)
211 .frame(width: tile.width, height: tile.height)
212 .modifier(arrangeable(item, tapToPin: false))
213 }
214 }
215 .padding(4)
216 .frame(minHeight: area.height + 8)
217 }
218 .scrollIndicators(.never)
219 .padding(safe)
220 }
221
222 // MARK: Self view
223
224 /// You, small and floating: dragged anywhere, settling in the nearest
225 /// corner, above the bar while it shows. Muted is said on it always,
226 /// since the Mute button is a tap away inside the menu.
227 private func selfView(in size: CGSize, safe: EdgeInsets) -> some View {
228 let corner = PiPCorner(rawValue: pipCorner) ?? .bottomTrailing
229 let pip = PiPLayout.size(
230 in: size, touch: true, shape: selfShape ?? fixtureFeeds["me"].map(VideoShape.of))
231 // Above the bar while it shows: here its buttons are at the corners,
232 // End call in the bottom right, so the self view cannot stay put as
233 // the Mac's does. At least 12 pt above the buttons' tops (2026-10-30):
234 // a phone with no home indicator (safe.bottom 0) had it 8 pt off them.
235 let insets = EdgeInsets(
236 top: safe.top, leading: safe.leading,
237 bottom: chrome.visible ? Self.selfViewRaise(safeBottom: safe.bottom) : safe.bottom,
238 trailing: safe.trailing)
239 let frame = PiPLayout.frame(corner: corner, size: pip, in: size, insets: insets)
240 return PhoneVideoTile(
241 track: call.localTrack, label: "You", muted: call.muted, mirrored: true,
242 cameraOff: call.cameraOff, placeholder: call.selfPlaceholder, cornerRadius: 14,
243 compact: true, backdrop: Self.tileBackdrop, audio: call.selfAudio,
244 fixtureVideo: fixtureFeeds["me"], shaped: { selfShape = $0 }
245 )
246 .frame(width: pip.width, height: pip.height)
247 .shadow(color: .black.opacity(0.35), radius: 8, y: 3)
248 .position(x: frame.midX + pipDrag.width, y: frame.midY + pipDrag.height)
249 .onTapGesture { chrome.tapped() }
250 .gesture(
251 DragGesture()
252 .onChanged { pipDrag = $0.translation }
253 .onEnded { drag in
254 let dropped = CGPoint(
255 x: frame.midX + drag.translation.width, y: frame.midY + drag.translation.height)
256 let headed = CGPoint(
257 x: frame.midX + drag.predictedEndTranslation.width,
258 y: frame.midY + drag.predictedEndTranslation.height)
259 withAnimation(reduceMotion ? nil : .spring(duration: 0.3)) {
260 pipCorner = PiPLayout.corner(droppedAt: dropped, predicted: headed, in: size).rawValue
261 pipDrag = .zero
262 }
263 }
264 )
265 .animation(reduceMotion ? nil : .easeOut(duration: 0.2), value: frame)
266 .accessibilityIdentifier("selfView")
267 .accessibilityActions {
268 ForEach(PiPCorner.allCases, id: \.self) { place in
269 Button(moveTitle(place)) { pipCorner = place.rawValue }
270 }
271 }
272 }
273
274 private func moveTitle(_ corner: PiPCorner) -> String {
275 switch corner {
276 case .topLeading: "Move self view to top left"
277 case .topTrailing: "Move self view to top right"
278 case .bottomLeading: "Move self view to bottom left"
279 case .bottomTrailing: "Move self view to bottom right"
280 }
281 }
282
283 // MARK: Title and notices
284
285 private var notices: [CallNotice] {
286 CallNotices.notices(
287 phase: call.noticePhase, status: call.status, sharingScreen: call.sharingScreen,
288 screenNote: call.screenNote, floor: call.floor, screenRecovery: call.screenRecovery)
289 }
290
291 private func topOverlay(safe: EdgeInsets) -> some View {
292 VStack(spacing: 8) {
293 // No pill (2026-10-02, Paul approved): how the call is going is the
294 // notices' to say. A title someone chose is a small centred line at
295 // the top, inside the safe area, fading with the controls; a title
296 // Calls wrote is not shown (CallTitle).
297 if let shown = CallTitle.shown(title: call.title, named: call.named) {
298 Text(shown)
299 .font(.footnote.weight(.semibold)).foregroundStyle(.white)
300 .shadow(color: .black.opacity(0.5), radius: 2, y: 1)
301 .lineLimit(1).truncationMode(.tail)
302 .frame(maxWidth: .infinity)
303 .opacity(chrome.visible ? 1 : 0)
304 .allowsHitTesting(false)
305 .accessibilityHidden(!chrome.visible)
306 .accessibilityAddTraits(.isHeader)
307 .accessibilityIdentifier("callTitle")
308 }
309
310 ForEach(notices.filter { $0.important && !dismissedNotices.contains($0.id) }) { notice in
311 noticeView(notice)
312 }
313 ForEach(call.state?.waiting ?? []) { person in
314 HStack(spacing: 10) {
315 Text("\(person.name) is waiting").lineLimit(2)
316 Button("Let in") { call.admit(person.peer) }.buttonStyle(.borderedProminent)
317 }
318 .modifier(PhoneNoticeSurface())
319 }
320 // The relay warning goes with the controls; it lived in the pill.
321 ForEach(notices.filter { !$0.important }) { notice in
322 noticeView(notice)
323 .opacity(chrome.visible ? 1 : 0)
324 .allowsHitTesting(chrome.visible)
325 .accessibilityHidden(!chrome.visible)
326 }
327 }
328 .padding(.top, max(safe.top, 12) + 4)
329 .padding(.leading, safe.leading + 12).padding(.trailing, safe.trailing + 12)
330 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
331 }
332
333 @ViewBuilder private func noticeView(_ notice: CallNotice) -> some View {
334 HStack(spacing: 10) {
335 switch notice.kind {
336 case .sharing:
337 Label(notice.text, systemImage: "rectangle.on.rectangle")
338 .foregroundStyle(CallOverlay.alertText).bold()
339 case .screenRecovering:
340 Label(notice.text, systemImage: "arrow.clockwise")
341 case .connecting, .reconnecting, .waitingToJoin:
342 ProgressView().tint(.white)
343 Text(notice.text)
344 case .full:
345 Text(notice.text)
346 Button("Try joining again") { call.retryJoin() }
347 case .ended:
348 Label(notice.text, systemImage: "phone.down")
349 case .problem, .floor:
350 Label(notice.text, systemImage: "exclamationmark.triangle.fill")
351 }
352 if let action = notice.action {
353 // The same stop as the ⋯ sheet's, which ends the broadcast.
354 NoticeActionButton(action) { call.perform(action) }
355 }
356 if notice.dismissible {
357 Button("Dismiss", systemImage: "xmark") { dismissedNotices.insert(notice.id) }
358 .labelStyle(.iconOnly)
359 }
360 }
361 .modifier(PhoneNoticeSurface())
362 }
363
364 // MARK: Bar
365
366 private func bar(safe: EdgeInsets) -> some View {
367 HStack(spacing: 14) {
368 Button {
369 showingMore = true
370 } label: {
371 Label {
372 Text("More controls")
373 } icon: {
374 CallGlyph("ellipsis", rotation: .degrees(90))
375 }
376 .labelStyle(.iconOnly)
377 }
378 .buttonStyle(RoundCallButtonStyle(.normal))
379 .overlay(alignment: .topTrailing) {
380 if unread > 0 {
381 Text("\(unread)").font(.caption.bold()).foregroundStyle(.white)
382 .padding(5).background(CallOverlay.badgeFill, in: Capsule()).accessibilityHidden(true)
383 }
384 }
385 .accessibilityLabel(unread > 0 ? "More controls, \(unread) new chat messages" : "More controls")
386 .accessibilityIdentifier("moreControls")
387 if micBesideMenu {
388 Button(
389 call.muted ? "Unmute microphone" : "Mute microphone",
390 glyph: call.muted ? "mic.slash.fill" : "mic.fill"
391 ) { call.mute() }
392 .labelStyle(.iconOnly)
393 .buttonStyle(RoundCallButtonStyle(call.muted ? .off : .normal))
394 .accessibilityIdentifier("mute")
395 }
396 Spacer(minLength: 0)
397 Button("End call", glyph: "phone.down.fill", role: .destructive, action: leave)
398 .labelStyle(.iconOnly)
399 .buttonStyle(RoundCallButtonStyle(.leave))
400 .accessibilityIdentifier("leave")
401 }
402 .padding(.leading, safe.leading + 20).padding(.trailing, safe.trailing + 20)
403 .padding(.bottom, max(safe.bottom, 16) + 4)
404 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
405 .background(alignment: .bottom) {
406 // Enough shade under the buttons to read them over a white wall.
407 LinearGradient(colors: [.clear, .black.opacity(0.35)], startPoint: .top, endPoint: .bottom)
408 .frame(height: Self.barHeight + safe.bottom + 40)
409 .allowsHitTesting(false)
410 }
411 }
412}
413
414/// A round call button over the picture: a borderless glass circle with a
415/// white symbol, or filled for End call's red and a muted microphone's
416/// amber (see CallOverlay).
417struct RoundCallButtonStyle: ButtonStyle {
418 let tone: CallOverlayButtonStyle.Tone
419 init(_ tone: CallOverlayButtonStyle.Tone) { self.tone = tone }
420 func makeBody(configuration: Configuration) -> some View {
421 configuration.label.font(.title2.weight(.semibold))
422 .modifier(CallGlyphSizing(.round))
423 .foregroundStyle(tone == .on ? CallOverlay.onSymbol : .white)
424 .frame(width: PhoneCall.button, height: PhoneCall.button)
425 .background {
426 switch tone {
427 case .normal: Color.clear.callOverlaySurface(Circle())
428 case .on: Circle().fill(CallOverlay.onFill)
429 case .off: Circle().fill(CallOverlay.offFill)
430 case .leave: Circle().fill(CallOverlay.leaveFill)
431 }
432 }
433 .opacity(configuration.isPressed ? 0.7 : 1)
434 .contentShape(Circle())
435 }
436}
437
438/// A notice over the picture: the overlay's borderless glass, white text,
439/// and dark-appearance controls whatever the system's.
440struct PhoneNoticeSurface: ViewModifier {
441 func body(content: Content) -> some View {
442 content.font(.callout).foregroundStyle(.white)
443 .environment(\.colorScheme, .dark)
444 .padding(.horizontal, 14).padding(.vertical, 8)
445 // No Liquid Glass rim: see NoticeSurface on the Mac.
446 .callOverlaySurface(RoundedRectangle(cornerRadius: 16, style: .continuous), rim: false)
447 .shadow(color: .black.opacity(0.25), radius: 8, y: 2)
448 }
449}
450
451/// The controls menu: everything but End call, each a labelled button.
452/// A sheet rather than a pop-up menu, so it can hold the system's screen
453/// broadcast picker and a toggle, and show at a glance what is on.
454struct MoreControls: View {
455 @ObservedObject var call: Call
456 @ObservedObject var arrangement: CallArrangement
457 let title: (StageItem) -> String
458 let unread: Int
459 let open: (MoreAction) -> Void
460 let close: () -> Void
461 @StateObject private var micModes = MicrophoneModes()
462
463 private let columns = [GridItem(.adaptive(minimum: 96), spacing: 12)]
464
465 var body: some View {
466 NavigationStack {
467 ScrollView {
468 VStack(alignment: .leading, spacing: 20) {
469 LazyVGrid(columns: columns, spacing: 16) {
470 tile(call.muted ? "Unmute" : "Mute") {
471 Button(
472 call.muted ? "Unmute microphone" : "Mute microphone",
473 glyph: call.muted ? "mic.slash.fill" : "mic.fill"
474 ) { call.mute() }
475 .buttonStyle(
476 CallActionStyle(
477 color: call.muted ? Color(red: 0.65, green: 0.30, blue: 0.02) : CallsAppearance.accent,
478 emphasized: call.muted))
479 .accessibilityIdentifier("mute")
480 }
481 tile(call.cameraOff ? "Camera on" : "Camera off") {
482 Button(
483 call.cameraOff ? "Turn camera on" : "Turn camera off",
484 glyph: call.cameraOff ? "video.slash.fill" : "video.fill"
485 ) { call.toggleCamera() }
486 .buttonStyle(CallActionStyle(color: .blue, emphasized: call.cameraOff))
487 .accessibilityIdentifier("camera")
488 }
489 tile("Flip") {
490 Button("Flip camera", glyph: "arrow.triangle.2.circlepath.camera") {
491 if let next = CameraFlip.next(from: call.currentCamera, in: call.cameras) {
492 Task { await call.useCamera(next.id) }
493 }
494 }
495 .buttonStyle(CallActionStyle(color: .blue))
496 .disabled(CameraFlip.next(from: call.currentCamera, in: call.cameras) == nil)
497 .accessibilityIdentifier("flipCamera")
498 }
499 tile(call.sharingScreen ? "Stop sharing" : "Share screen") {
500 if call.sharingScreen {
501 Button("Stop sharing your screen", glyph: "rectangle.on.rectangle.slash") {
502 call.stopSharingScreen()
503 }
504 .buttonStyle(CallActionStyle(color: .orange, emphasized: true))
505 .accessibilityIdentifier("shareScreen")
506 } else {
507 BroadcastButton().frame(width: 44, height: 44)
508 .disabled(call.state?.phase != "admitted")
509 .accessibilityIdentifier("shareScreen")
510 }
511 }
512 tile("Devices") {
513 Button("Devices", glyph: "slider.horizontal.3") { open(.devices) }
514 .buttonStyle(CallActionStyle(color: .teal))
515 .accessibilityIdentifier("devices")
516 }
517 tile("Mic Mode") {
518 Button("Mic Mode", glyph: "waveform") { micModes.showPicker() }
519 .buttonStyle(CallActionStyle(color: .teal))
520 .accessibilityIdentifier("micModeQuick")
521 .accessibilityHint(micModes.summary)
522 }
523 tile(arrangement.layout.title) {
524 Menu {
525 LayoutChoices(call: call, arrangement: arrangement, title: title)
526 } label: {
527 Label {
528 Text("Video layout")
529 } icon: {
530 CallGlyph(arrangement.layout.symbol)
531 }
532 }
533 .buttonStyle(CallActionStyle(color: .gray))
534 .accessibilityIdentifier("videoLayout")
535 }
536 if call.standing == "member" {
537 tile("Share link") {
538 MeetingShareButton(call: call).buttonStyle(CallActionStyle(color: .indigo))
539 }
540 }
541 tile(unread > 0 ? "Chat (\(unread))" : "Chat") {
542 Button(unread == 0 ? "Chat" : "Chat (\(unread) new)", glyph: "bubble.left.and.bubble.right.fill") {
543 open(.chat)
544 }
545 .buttonStyle(CallActionStyle(color: .purple, emphasized: unread > 0))
546 .accessibilityIdentifier("openChat")
547 }
548 }
549 // Spec §15.26: this call's diagnostics, sent rather than copied.
550 ReportProblemButton { open(.report) }
551 .disabled(!call.canReportProblem)
552 VStack(alignment: .leading, spacing: 4) {
553 Toggle("Reduce background noise", isOn: $call.reduceNoise)
554 .accessibilityIdentifier("noiseReduction")
555 Text("Takes out typing, wind and room noise before others hear you.")
556 .font(.footnote).foregroundStyle(.secondary)
557 }
558 }
559 .padding(20)
560 }
561 .navigationTitle("Call controls").navigationBarTitleDisplayMode(.inline)
562 .toolbar {
563 ToolbarItem(placement: .confirmationAction) { Button("Done", action: close) }
564 }
565 .onAppear { micModes.refresh() }
566 }
567 }
568
569 /// A button with its caption under it. The caption is for the eye; the
570 /// button carries its own full label for VoiceOver.
571 private func tile(_ caption: String, @ViewBuilder _ content: () -> some View) -> some View {
572 VStack(spacing: 6) {
573 content()
574 Text(caption).font(.caption).foregroundStyle(.secondary).lineLimit(1)
575 .minimumScaleFactor(0.8).accessibilityHidden(true)
576 }
577 .frame(maxWidth: .infinity)
578 }
579}
580