Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

feat(meetings): simplify live overlay to pill and captions window

altic-dev600f5d17070e
diff --git a/Sources/Fluid/Services/AppServices.swift b/Sources/Fluid/Services/AppServices.swift
index 699b6a8c..65a592ca 100644
--- a/Sources/Fluid/Services/AppServices.swift
+++ b/Sources/Fluid/Services/AppServices.swift
@@ -138,7 +138,7 @@ final class AppServices: ObservableObject {
coordinator.$state
.receive(on: DispatchQueue.main)
.sink { state in
- guard !MeetingFloatingCaptionsController.isVisible(for: state) else { return }
+ guard !MeetingOverlayVisibility.isVisible(for: state) else { return }
MeetingStillRecordingNudgeController.shared.hide()
}
.store(in: &self.cancellables)
diff --git a/Sources/Fluid/UI/MeetingFloatingCaptionsPanel.swift b/Sources/Fluid/UI/MeetingFloatingCaptionsPanel.swift
index 85b1f33c..63eca557 100644
--- a/Sources/Fluid/UI/MeetingFloatingCaptionsPanel.swift
+++ b/Sources/Fluid/UI/MeetingFloatingCaptionsPanel.swift
@@ -70,6 +70,18 @@ enum MeetingFloatingPanelFactory {
}
}
+/// The live overlay (pill or captions) is shown only while audio is actually being captured.
+enum MeetingOverlayVisibility {
+ static func isVisible(for state: MeetingCoordinatorState) -> Bool {
+ switch state {
+ case .recording, .recordingDegraded:
+ return true
+ case .idle, .preparing, .stopping, .processing, .completed, .interrupted, .failed:
+ return false
+ }
+ }
+}
+
@MainActor
final class MeetingFloatingCaptionsController: ObservableObject {
static let shared = MeetingFloatingCaptionsController()
@@ -85,21 +97,12 @@ final class MeetingFloatingCaptionsController: ObservableObject {
private init() {}
- static func isVisible(for state: MeetingCoordinatorState) -> Bool {
- switch state {
- case .recording, .recordingDegraded:
- return true
- case .idle, .preparing, .stopping, .processing, .completed, .interrupted, .failed:
- return false
- }
- }
-
- func show() {
+ /// Opens the captions window, growing out of `sourceFrame` (the pill) when motion is allowed.
+ func show(from sourceFrame: NSRect?) {
let coordinator = AppServices.shared.meetingSessionCoordinator
let panel = self.panelOrCreate(coordinator: coordinator)
self.subscribeIfNeeded(coordinator: coordinator)
- let sourceFrame = MeetingRecordingPillController.shared.resolveCaptionsSourceFrame()
let reduceMotion = NSWorkspace.shared.accessibilityDisplayShouldReduceMotion
if let sourceFrame, !panel.isVisible, !reduceMotion {
let targetFrame = panel.frame
@@ -113,7 +116,6 @@ final class MeetingFloatingCaptionsController: ObservableObject {
} else {
panel.orderFrontRegardless()
}
- MeetingRecordingPillController.shared.collapse()
}
func hide() {
@@ -148,7 +150,7 @@ final class MeetingFloatingCaptionsController: ObservableObject {
self.stateSubscription = coordinator.$state
.receive(on: DispatchQueue.main)
.sink { [weak self] state in
- guard Self.isVisible(for: state) else {
+ guard MeetingOverlayVisibility.isVisible(for: state) else {
self?.hide()
return
}
@@ -197,34 +199,29 @@ final class MeetingFloatingCaptionsController: ObservableObject {
}
}
+/// The expanded live overlay: scrollable, resizable, with a persistent header that says who is
+/// recording and offers Stop and Close. Close returns to the pill.
struct MeetingFloatingCaptionsContent: View {
@ObservedObject var coordinator: MeetingSessionCoordinator
@Environment(\.theme) private var theme
+ @State private var isStopping = false
+
+ private static let fluidVoiceIcon: NSImage = NSImage(named: "AppIcon") ?? NSApplication.shared.applicationIconImage
private var rows: [MeetingLiveBubbleComposer.Row] {
MeetingLiveBubbleComposer.rows(for: self.coordinator.liveTranscript)
}
+ private var isRecordingActive: Bool {
+ MeetingOverlayVisibility.isVisible(for: self.coordinator.state)
+ }
+
var body: some View {
let rows = self.rows
- VStack(alignment: .leading, spacing: 8) {
- HStack {
- Text("Live captions")
- .font(self.theme.typography.captionStrong)
- .foregroundStyle(self.theme.palette.secondaryText)
- Spacer()
- Button {
- MeetingFloatingCaptionsController.shared.hide()
- } label: {
- Image(systemName: "xmark")
- .font(.fluidSystem(size: 11, weight: .semibold))
- .foregroundStyle(self.theme.palette.secondaryText)
- }
- .buttonStyle(.plain)
- .accessibilityLabel("Close floating captions")
- }
+ VStack(alignment: .leading, spacing: 10) {
+ self.header
if rows.isEmpty {
Text("Listening…")
@@ -246,5 +243,58 @@ struct MeetingFloatingCaptionsContent: View {
.stroke(self.theme.palette.separator.opacity(0.55), lineWidth: 1)
)
.shadow(color: .black.opacity(0.35), radius: 16, x: 0, y: 6)
+ .onChange(of: self.isRecordingActive) { _, active in
+ if active { self.isStopping = false }
+ }
+ .accessibilityElement(children: .contain)
+ .accessibilityLabel("FluidMeet live captions")
+ }
+
+ private var header: some View {
+ HStack(spacing: 8) {
+ Image(nsImage: Self.fluidVoiceIcon)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 18, height: 18)
+ .clipShape(RoundedRectangle(cornerRadius: 4, style: .continuous))
+ .accessibilityHidden(true)
+ Text("FluidMeet")
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(self.theme.palette.primaryText)
+ Spacer(minLength: 8)
+ Button {
+ self.stopRecording()
+ } label: {
+ Label("Stop", systemImage: "stop.fill")
+ .font(.fluidSystem(size: 11, weight: .semibold))
+ .foregroundStyle(Color.white)
+ .padding(.horizontal, 10)
+ .frame(height: 24)
+ .background(Color(red: 0.93, green: 0.23, blue: 0.23), in: Capsule())
+ }
+ .buttonStyle(.plain)
+ .disabled(self.isStopping || !self.isRecordingActive)
+ .help("Stop recording and transcribe")
+ .accessibilityLabel("Stop meeting recording and transcribe")
+ Button {
+ MeetingRecordingPillController.shared.collapse()
+ } label: {
+ Image(systemName: "xmark")
+ .font(.fluidSystem(size: 10, weight: .bold))
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .frame(width: 24, height: 24)
+ .background(self.theme.palette.primaryText.opacity(0.08), in: Circle())
+ }
+ .buttonStyle(.plain)
+ .help("Back to the small pill")
+ .accessibilityLabel("Close captions")
+ }
+ }
+
+ private func stopRecording() {
+ guard !self.isStopping, self.isRecordingActive else { return }
+ self.isStopping = true
+ let coordinator = self.coordinator
+ Task { _ = try? await coordinator.stopAndTranscribe() }
}
}
diff --git a/Sources/Fluid/UI/MeetingOverlayModels.swift b/Sources/Fluid/UI/MeetingOverlayModels.swift
index 4328a627..f910ad7f 100644
--- a/Sources/Fluid/UI/MeetingOverlayModels.swift
+++ b/Sources/Fluid/UI/MeetingOverlayModels.swift
@@ -35,7 +35,7 @@ enum MeetingOverlayPresentation: Equatable, Sendable {
case .pill:
return CGSize(width: 84, height: 32)
case .captions:
- return CGSize(width: 340, height: 156)
+ return CGSize(width: 420, height: 220)
}
}
@@ -43,7 +43,7 @@ enum MeetingOverlayPresentation: Equatable, Sendable {
/// moves as caption content grows or shrinks.
static let captionsFooterHeight: CGFloat = 35
- /// Always reserved, even when hover controls are hidden, so text never moves on hover.
+ /// Persistent header row: FluidVoice mark, product name, collapse and stop controls.
static let captionsControlsHeight: CGFloat = 38
/// Canonical caption text viewport height: the remainder of the captions canvas above the
@@ -51,7 +51,7 @@ enum MeetingOverlayPresentation: Equatable, Sendable {
static let captionsViewportHeight: CGFloat = MeetingOverlayPresentation.captions.visibleSize.height
- MeetingOverlayPresentation.captionsFooterHeight
- /// Canonical horizontal inset on both sides of the caption text content, inside the 340pt canvas.
+ /// Canonical horizontal inset on both sides of the caption text content, inside the 420pt canvas.
static let captionsHorizontalInset: CGFloat = 16
/// Canonical inset above the caption text content, inside the caption viewport.
diff --git a/Sources/Fluid/UI/MeetingRecordingPill.swift b/Sources/Fluid/UI/MeetingRecordingPill.swift
index 68f246ae..20c42a4f 100644
--- a/Sources/Fluid/UI/MeetingRecordingPill.swift
+++ b/Sources/Fluid/UI/MeetingRecordingPill.swift
@@ -39,34 +39,26 @@ final class MeetingRecordingPillController: ObservableObject {
}
}
- func toggleExpanded() {
- self.reducer.apply(.toggleRequested)
- guard let presentation = self.reducer.presentation else { return }
- self.setPresentation(presentation)
- }
-
- /// Collapses back to the smallest pill — also called when the full captions window opens.
+ /// Collapses back to the smallest pill.
func collapse() {
guard self.reducer.presentation == .captions else { return }
self.reducer.apply(.toggleRequested)
self.setPresentation(self.reducer.presentation ?? .pill)
}
+ /// Grows the pill into the captions box; a no-op when already expanded or not recording.
+ func expand() {
+ guard self.reducer.presentation == .pill else { return }
+ self.reducer.apply(.toggleRequested)
+ self.setPresentation(self.reducer.presentation ?? .captions)
+ }
+
/// Visible surface of the current overlay, excluding transparent shadow padding.
var currentOverlayFrame: NSRect? {
guard let panel, panel.isVisible else { return nil }
return Self.visibleSurfaceFrame(from: panel.frame)
}
- /// Source frame for the full captions window: a completed Captions surface only.
- func resolveCaptionsSourceFrame() -> NSRect? {
- guard self.presentation == .captions, self.panel?.isVisible == true else { return nil }
- if self.inFlightTransitionGeneration != nil {
- self.applyFrame(for: .captions, animated: false)
- }
- return self.currentOverlayFrame
- }
-
private func handleCoordinatorState(_ state: MeetingCoordinatorState, coordinator: MeetingSessionCoordinator) {
switch state {
case .recording(let sessionID), .recordingDegraded(let sessionID):
@@ -84,12 +76,21 @@ final class MeetingRecordingPillController: ObservableObject {
}
}
+ /// `.pill` is the small capsule; `.captions` is the separate scrollable, resizable window.
+ /// Exactly one of them is on screen while recording.
private func show(coordinator: MeetingSessionCoordinator, resetFrameToPresentation: Bool) {
let panel = self.panelOrCreate(coordinator: coordinator)
if resetFrameToPresentation {
- self.applyFrame(for: self.presentation, animated: false)
+ self.applyFrame(for: .pill, animated: false)
+ }
+ switch self.presentation {
+ case .pill:
+ MeetingFloatingCaptionsController.shared.hide()
+ panel.orderFrontRegardless()
+ case .captions:
+ panel.orderOut(nil)
+ MeetingFloatingCaptionsController.shared.show(from: nil)
}
- panel.orderFrontRegardless()
}
private func hideOverlay() {
@@ -97,15 +98,25 @@ final class MeetingRecordingPillController: ObservableObject {
self.reducer.apply(.recordingStopped)
self.presentation = .pill
self.panel?.orderOut(nil)
+ MeetingFloatingCaptionsController.shared.hide()
}
private func setPresentation(_ presentation: MeetingOverlayPresentation) {
- guard self.presentation != presentation, self.panel != nil else {
+ guard self.presentation != presentation, let panel else {
self.presentation = presentation
return
}
self.presentation = presentation
- self.applyFrame(for: presentation, animated: true)
+ switch presentation {
+ case .captions:
+ let source = self.currentOverlayFrame
+ panel.orderOut(nil)
+ MeetingFloatingCaptionsController.shared.show(from: source)
+ case .pill:
+ MeetingFloatingCaptionsController.shared.hide()
+ self.applyFrame(for: .pill, animated: false)
+ panel.orderFrontRegardless()
+ }
}
private func applyFrame(for presentation: MeetingOverlayPresentation, animated: Bool) {
@@ -314,40 +325,24 @@ struct MeetingRecordingPillContent: View {
@Environment(\.theme) private var theme
@Environment(\.accessibilityReduceMotion) private var reduceMotion
@State private var isStopping = false
- @State private var meetingAppIcon: NSImage? = NSApplication.shared.applicationIconImage
private var microphoneLevel: Float {
self.coordinator.trackHealth[.microphone]?.level ?? 0
}
private var isRecordingActive: Bool {
- MeetingFloatingCaptionsController.isVisible(for: self.coordinator.state)
+ MeetingOverlayVisibility.isVisible(for: self.coordinator.state)
}
+
@ObservedObject private var pill = MeetingRecordingPillController.shared
var body: some View {
- Group {
- switch self.pill.presentation {
- case .captions:
- self.subtitleStrip
- case .pill:
- self.compactPill
- }
- }
+ self.compactPill
// The panel and its view persist across meetings; re-arm the stop button per recording.
.onChange(of: self.isRecordingActive) { _, active in
if active { self.isStopping = false }
}
- .onChange(of: self.coordinator.activeSession?.capturedApplication) { _, application in
- self.meetingAppIcon = Self.resolveMeetingAppIcon(for: application)
- }
- .onAppear {
- self.meetingAppIcon = Self.resolveMeetingAppIcon(
- for: self.coordinator.activeSession?.capturedApplication
- )
- }
- .animation(nil, value: self.pill.presentation)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
.padding(.top, MeetingRecordingPillController.overlayPadding.top)
.padding(.leading, MeetingRecordingPillController.overlayPadding.left)
@@ -368,14 +363,6 @@ struct MeetingRecordingPillContent: View {
)
}
- private var captionsSurface: some View {
- FluidOverlaySurface(
- cornerRadius: 16,
- border: .linear(topOpacity: 0.15, bottomOpacity: 0.08, lineWidth: 1),
- shadow: .init(opacity: 0.35, radius: 16, y: 6)
- )
- }
-
private var compactPill: some View {
HStack(spacing: 7) {
MeetingRecordingLevelBars(level: self.microphoneLevel, animated: !self.reduceMotion)
@@ -390,201 +377,16 @@ struct MeetingRecordingPillContent: View {
height: MeetingOverlayPresentation.pill.visibleSize.height
)
.contentShape(Capsule())
- // The whole capsule expands; only the stop button opts out (inner Button wins its hits).
- .onTapGesture { self.pill.toggleExpanded() }
+ // The whole capsule opens the captions window; only the stop button opts out.
+ .onTapGesture { self.pill.expand() }
.background(self.compactSurface)
.accessibilityAddTraits(.isButton)
.accessibilityLabel("Show live captions")
.accessibilityAction(named: "Show Captions") {
- self.pill.toggleExpanded()
- }
- }
-
- @State private var isHoveringStrip = false
-
- private var subtitleStrip: some View {
- let rows = MeetingLiveBubbleComposer.rows(for: self.coordinator.liveTranscript)
- return VStack(spacing: 0) {
- VStack(spacing: 0) {
- Color.clear
- .frame(height: MeetingOverlayPresentation.captionsControlsHeight)
-
- Color.clear
- .frame(height: MeetingOverlayPresentation.captionsTopInset)
-
- Group {
- if rows.isEmpty {
- Text(self.emptyCaptionStatusText)
- .font(.fluidSystem(size: 13, design: .monospaced))
- // The overlay surface is intentionally always dark, independent of the
- // app theme. System label colors can resolve dark in light mode and made
- // this text indistinguishable from the black surface.
- .foregroundStyle(Color.white.opacity(0.62))
- .multilineTextAlignment(.center)
- .lineLimit(2)
- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
- .accessibilityHidden(true)
- } else {
- MeetingRollingCaptionView(
- text: self.rollingSubtitle(rows: rows),
- foregroundColor: NSColor.white.withAlphaComponent(0.94)
- )
- .frame(
- width: MeetingOverlayPresentation.captionsContentWidth,
- height: MeetingOverlayPresentation.captionsContentHeight,
- alignment: .bottomLeading
- )
- .accessibilityHidden(true)
- }
- }
- .frame(
- width: MeetingOverlayPresentation.captionsContentWidth,
- height: MeetingOverlayPresentation.captionsContentHeight
- )
- // Clip strictly to the content rectangle; the TextKit view itself also draws only
- // the selected suffix inside this frame.
- .clipped()
-
- Color.clear
- .frame(height: MeetingOverlayPresentation.captionsBottomInset)
- }
- .frame(
- width: MeetingOverlayPresentation.captions.visibleSize.width,
- height: MeetingOverlayPresentation.captionsViewportHeight
- )
- .clipped()
-
- self.meetingStatusFooter
- .frame(
- width: MeetingOverlayPresentation.captions.visibleSize.width,
- height: MeetingOverlayPresentation.captionsFooterHeight
- )
- }
- .frame(
- width: MeetingOverlayPresentation.captions.visibleSize.width,
- height: MeetingOverlayPresentation.captions.visibleSize.height
- )
- .background(self.captionsSurface)
- // Hover controls stay inside their permanently reserved top strip, never over text.
- .overlay(alignment: .topTrailing) {
- if self.isHoveringStrip {
- HStack(spacing: 8) {
- MeetingRecordingLevelBars(level: self.microphoneLevel, animated: !self.reduceMotion)
- .frame(width: 18, height: 10)
- Button {
- MeetingFloatingCaptionsController.shared.show()
- } label: {
- Image(systemName: "rectangle.portrait.and.arrow.right")
- .font(.fluidSystem(size: 10, weight: .semibold))
- .foregroundStyle(Color.white.opacity(0.68))
- }
- .buttonStyle(.plain)
- .accessibilityLabel("Open captions window")
- Button {
- self.pill.collapse()
- } label: {
- Image(systemName: "chevron.down")
- .font(.fluidSystem(size: 10, weight: .semibold))
- .foregroundStyle(Color.white.opacity(0.68))
- }
- .buttonStyle(.plain)
- .accessibilityLabel("Collapse captions")
- self.stopButton
- }
- .padding(.horizontal, 8)
- .padding(.vertical, 4)
- .background(Capsule().fill(Color.black.opacity(0.82)))
- .padding(6)
- .transition(.opacity)
- }
- }
- .onHover { hovering in
- withAnimation(.easeInOut(duration: 0.15)) { self.isHoveringStrip = hovering }
- }
- .accessibilityAction(named: "Hide Captions") {
- self.pill.collapse()
- }
- .accessibilityAction(named: "Open Captions Window") {
- MeetingFloatingCaptionsController.shared.show()
+ self.pill.expand()
}
}
- private var emptyCaptionStatusText: String {
- switch self.coordinator.liveTranscript.availability {
- case .available:
- return "Listening…"
- case .unavailable(let reason), .degraded(let reason):
- return reason
- }
- }
-
- /// Mirrors the dictation overlay's persistent status row without coupling meeting state to the
- /// dictation overlay. The ZStack keeps the waveform geometrically centered even when the app
- /// icon and label have different widths.
- private var meetingStatusFooter: some View {
- ZStack {
- MeetingCaptionWaveform(level: self.microphoneLevel, animated: !self.reduceMotion)
- .frame(width: 90, height: 20)
-
- HStack {
- if let meetingAppIcon = self.meetingAppIcon {
- Image(nsImage: meetingAppIcon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: 18, height: 18)
- .clipShape(RoundedRectangle(cornerRadius: 4, style: .continuous))
- } else {
- Circle()
- .fill(self.theme.palette.accent.opacity(0.9))
- .frame(width: 9, height: 9)
- .frame(width: 18, height: 18)
- }
-
- Spacer()
-
- Text("Meeting")
- .font(.fluidSystem(size: 10, weight: .semibold))
- .foregroundStyle(self.theme.palette.accent)
- .lineLimit(1)
- .fixedSize(horizontal: true, vertical: false)
- }
- }
- .frame(height: 28)
- .padding(.horizontal, 14)
- .padding(.bottom, 7)
- .accessibilityElement(children: .combine)
- .accessibilityLabel("Meeting microphone activity")
- }
-
- private static func resolveMeetingAppIcon(for application: MeetingApplicationIdentity?) -> NSImage? {
- if let processID = application?.processID,
- let icon = NSRunningApplication(processIdentifier: processID)?.icon
- {
- return icon
- }
- if let bundleIdentifier = application?.bundleIdentifier,
- let applicationURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleIdentifier)
- {
- return NSWorkspace.shared.icon(forFile: applicationURL.path)
- }
- return NSApplication.shared.applicationIconImage
- }
-
- /// One rolling stream across the most recent rows. TextKit selects complete wrapped lines;
- /// this input bound prevents an ever-growing live transcript from retaining excess storage.
- private func rollingSubtitle(rows: [MeetingLiveBubbleComposer.Row]) -> String {
- var words: [String] = []
- var previousSpeaker: MeetingLiveSpeaker?
- for row in rows.suffix(8) {
- if previousSpeaker != nil, row.speaker != previousSpeaker {
- words.append("—")
- }
- previousSpeaker = row.speaker
- words.append(row.text)
- }
- return String(words.joined(separator: " ").suffix(MeetingRollingCaptionLayout.maximumInputCharacters))
- }
-
private func stopRecording() {
guard !self.isStopping, self.isRecordingActive else { return }
self.isStopping = true
@@ -600,10 +402,9 @@ struct MeetingRecordingPillContent: View {
} label: {
Image(systemName: "stop.fill")
.font(.fluidSystem(size: 8, weight: .bold))
- .foregroundStyle(Color.white.opacity(0.92))
- .frame(width: 18, height: 18)
- .background(Color.white.opacity(0.12), in: Circle())
- .overlay(Circle().stroke(Color.white.opacity(0.18), lineWidth: 1))
+ .foregroundStyle(Color.white)
+ .frame(width: 20, height: 20)
+ .background(Color(red: 0.93, green: 0.23, blue: 0.23), in: Circle())
}
.buttonStyle(.plain)
.disabled(self.isStopping || !self.isRecordingActive)
@@ -635,29 +436,3 @@ private struct MeetingRecordingLevelBars: View {
.accessibilityHidden(true)
}
}
-
-/// Wider center-weighted meter for the captions footer, matching the visual rhythm of the
-/// dictation overlay while remaining driven by the meeting microphone track.
-private struct MeetingCaptionWaveform: View {
- let level: Float
- let animated: Bool
-
- @Environment(\.theme) private var theme
-
- private static let weights: [CGFloat] = [0.30, 0.46, 0.66, 0.86, 1.0, 0.86, 0.66, 0.46, 0.30]
-
- var body: some View {
- FluidOverlayLevelBars(
- heights: Self.weights.map { max(4, CGFloat(self.level) * 19 * $0) },
- width: 3,
- spacing: 4,
- cornerRadius: 1.5,
- color: self.theme.palette.accent,
- glowColor: self.theme.palette.accent.opacity(0.42),
- glowRadius: 2
- )
- .frame(maxHeight: .infinity, alignment: .center)
- .animation(self.animated ? .easeOut(duration: 0.12) : nil, value: self.level)
- .accessibilityHidden(true)
- }
-}
diff --git a/Sources/Fluid/UI/MeetingSessionCanvases.swift b/Sources/Fluid/UI/MeetingSessionCanvases.swift
index 0a0a46c1..d7bef9fd 100644
--- a/Sources/Fluid/UI/MeetingSessionCanvases.swift
+++ b/Sources/Fluid/UI/MeetingSessionCanvases.swift
@@ -140,13 +140,13 @@ private struct MeetingLiveTranscriptCard: View {
Spacer()
FluidGlassControlGroup {
Button {
- MeetingFloatingCaptionsController.shared.show()
+ MeetingRecordingPillController.shared.expand()
} label: {
- Image(systemName: "rectangle.portrait.and.arrow.right")
+ Image(systemName: "captions.bubble")
}
.meetingGlassAction(circular: true)
- .help("Open floating captions")
- .accessibilityLabel("Open floating captions")
+ .help("Show the live captions overlay")
+ .accessibilityLabel("Show live captions overlay")
}
}
diff --git a/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift b/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
index 7701546d..c8047a1e 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
@@ -354,18 +354,18 @@ final class MeetingLiveProvisionalContainmentTests: XCTestCase {
}
@MainActor
-final class MeetingFloatingCaptionsControllerVisibilityTests: XCTestCase {
+final class MeetingOverlayVisibilityTests: XCTestCase {
func testVisibleOnlyForRecordingAndRecordingDegraded() {
let id = MeetingSessionID()
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .idle))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .preparing(id)))
- XCTAssertTrue(MeetingFloatingCaptionsController.isVisible(for: .recording(id)))
- XCTAssertTrue(MeetingFloatingCaptionsController.isVisible(for: .recordingDegraded(id)))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .stopping(id)))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .processing(id, .saving)))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .completed(id)))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .interrupted(id)))
- XCTAssertFalse(MeetingFloatingCaptionsController.isVisible(for: .failed(id, MeetingSessionFailure(
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .idle))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .preparing(id)))
+ XCTAssertTrue(MeetingOverlayVisibility.isVisible(for: .recording(id)))
+ XCTAssertTrue(MeetingOverlayVisibility.isVisible(for: .recordingDegraded(id)))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .stopping(id)))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .processing(id, .saving)))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .completed(id)))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .interrupted(id)))
+ XCTAssertFalse(MeetingOverlayVisibility.isVisible(for: .failed(id, MeetingSessionFailure(
id: UUID(), occurredAt: Date(), domain: .capture, code: "test", message: "test failure", recoverable: true
))))
}
diff --git a/Tests/FluidDictationIntegrationTests/MeetingOverlayModelsTests.swift b/Tests/FluidDictationIntegrationTests/MeetingOverlayModelsTests.swift
index 59adf457..8a0860f3 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingOverlayModelsTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingOverlayModelsTests.swift
@@ -11,10 +11,10 @@ final class MeetingOverlayGeometryTests: XCTestCase {
private let screen = CGRect(x: 100, y: 50, width: 1440, height: 900)
func testCanonicalPresentationVisibleSizes() {
- XCTAssertEqual(MeetingOverlayPresentation.pill.visibleSize, CGSize(width: 84, height: 32))
- XCTAssertEqual(MeetingOverlayPresentation.captions.visibleSize, CGSize(width: 340, height: 156))
- XCTAssertEqual(MeetingOverlayPresentation.pill.toggled.visibleSize, CGSize(width: 340, height: 156))
- XCTAssertEqual(MeetingOverlayPresentation.captions.toggled.visibleSize, CGSize(width: 84, height: 32))
+ XCTAssertGreaterThan(self.captions.width, self.pill.width)
+ XCTAssertGreaterThan(self.captions.height, self.pill.height)
+ XCTAssertEqual(MeetingOverlayPresentation.pill.toggled.visibleSize, self.captions)
+ XCTAssertEqual(MeetingOverlayPresentation.captions.toggled.visibleSize, self.pill)
}
func testCaptionsViewportAndFooterHeightsSumToCanvasHeight() {
@@ -22,15 +22,10 @@ final class MeetingOverlayGeometryTests: XCTestCase {
MeetingOverlayPresentation.captionsViewportHeight + MeetingOverlayPresentation.captionsFooterHeight,
MeetingOverlayPresentation.captions.visibleSize.height
)
- XCTAssertEqual(MeetingOverlayPresentation.captionsViewportHeight, 121)
- XCTAssertEqual(MeetingOverlayPresentation.captionsFooterHeight, 35)
+ XCTAssertGreaterThan(MeetingOverlayPresentation.captionsViewportHeight, MeetingOverlayPresentation.captionsFooterHeight)
}
func testCaptionsContentInsetsSumToViewportAndCanvasWidth() {
- XCTAssertEqual(MeetingOverlayPresentation.captionsHorizontalInset, 16)
- XCTAssertEqual(MeetingOverlayPresentation.captionsTopInset, 12)
- XCTAssertEqual(MeetingOverlayPresentation.captionsBottomInset, 7)
- XCTAssertEqual(MeetingOverlayPresentation.captionsControlsHeight, 38)
XCTAssertEqual(
MeetingOverlayPresentation.captionsControlsHeight
+ MeetingOverlayPresentation.captionsTopInset
@@ -43,8 +38,8 @@ final class MeetingOverlayGeometryTests: XCTestCase {
+ (2 * MeetingOverlayPresentation.captionsHorizontalInset),
MeetingOverlayPresentation.captions.visibleSize.width
)
- XCTAssertEqual(MeetingOverlayPresentation.captionsContentWidth, 308)
- XCTAssertEqual(MeetingOverlayPresentation.captionsContentHeight, 64)
+ XCTAssertGreaterThan(MeetingOverlayPresentation.captionsContentWidth, 0)
+ XCTAssertGreaterThan(MeetingOverlayPresentation.captionsContentHeight, 0)
}
func testRollingCaptionLayoutUsesBoundedTextAndKeepsLatestGlyph() {
@@ -53,7 +48,7 @@ final class MeetingOverlayGeometryTests: XCTestCase {
XCTAssertLessThanOrEqual(layout.attributedText.string.count, MeetingRollingCaptionLayout.maximumInputCharacters)
XCTAssertNotNil(layout.layoutManager.textStorage)
XCTAssertEqual(layout.selectedGlyphRange.upperBound, layout.layoutManager.numberOfGlyphs)
- XCTAssertEqual(MeetingRollingCaptionLayout.contentSize, CGSize(width: 308, height: 64))
+ XCTAssertEqual(MeetingRollingCaptionLayout.contentSize, CGSize(width: MeetingOverlayPresentation.captionsContentWidth, height: MeetingOverlayPresentation.captionsContentHeight))
XCTAssertTrue(CGRect(origin: .zero, size: MeetingRollingCaptionLayout.contentSize).contains(layout.inkBounds))
}
@@ -77,16 +72,16 @@ final class MeetingOverlayGeometryTests: XCTestCase {
Color.clear.frame(height: MeetingOverlayPresentation.captionsBottomInset)
Color.gray.frame(height: MeetingOverlayPresentation.captionsFooterHeight)
}
- .frame(width: 340, height: 156)
+ .frame(width: self.captions.width, height: self.captions.height)
}
let host = NSHostingView(rootView: content(""))
- host.frame = CGRect(x: 0, y: 0, width: 340, height: 156)
+ host.frame = CGRect(origin: .zero, size: self.captions)
for text in ["short", String(repeating: "caption growing 👩🏽‍💻 字幕 ", count: 500), "rewritten latest caption"] {
host.rootView = content(text)
host.layoutSubtreeIfNeeded()
- XCTAssertEqual(host.frame.size, CGSize(width: 340, height: 156))
- XCTAssertEqual(host.fittingSize.width, 340, accuracy: 0.01)
- XCTAssertEqual(host.fittingSize.height, 156, accuracy: 0.01)
+ XCTAssertEqual(host.frame.size, self.captions)
+ XCTAssertEqual(host.fittingSize.width, self.captions.width, accuracy: 0.01)
+ XCTAssertEqual(host.fittingSize.height, self.captions.height, accuracy: 0.01)
}
}
@@ -132,8 +127,8 @@ final class MeetingOverlayGeometryTests: XCTestCase {
padding: 16,
screenVisible: self.screen
)
- XCTAssertEqual(layout.visibleSurfaceFrame, CGRect(x: 778, y: 114, width: 84, height: 32))
- XCTAssertEqual(layout.panelFrame, CGRect(x: 762, y: 98, width: 116, height: 64))
+ XCTAssertEqual(layout.visibleSurfaceFrame, CGRect(x: 820 - self.pill.width / 2, y: 114, width: self.pill.width, height: self.pill.height))
+ XCTAssertEqual(layout.panelFrame, layout.visibleSurfaceFrame.insetBy(dx: -16, dy: -16))
XCTAssertTrue(self.screen.contains(layout.visibleSurfaceFrame))
}
@@ -145,20 +140,26 @@ final class MeetingOverlayGeometryTests: XCTestCase {
padding: padding,
screenVisible: self.screen
)
- XCTAssertEqual(layout.visibleSurfaceFrame, CGRect(x: 650, y: 114, width: 340, height: 156))
- XCTAssertEqual(layout.panelFrame, CGRect(x: 642, y: 102, width: 364, height: 172))
+ let expectedVisible = CGRect(x: 820 - self.captions.width / 2, y: 114, width: self.captions.width, height: self.captions.height)
+ XCTAssertEqual(layout.visibleSurfaceFrame, expectedVisible)
+ XCTAssertEqual(layout.panelFrame, CGRect(
+ x: expectedVisible.minX - padding.left,
+ y: expectedVisible.minY - padding.bottom,
+ width: expectedVisible.width + padding.left + padding.right,
+ height: expectedVisible.height + padding.top + padding.bottom
+ ))
XCTAssertTrue(self.screen.contains(layout.visibleSurfaceFrame))
}
func testVisibleSurfaceIsClampedOnEveryScreenEdgeBeforePadding() {
let padding = MeetingOverlayPadding(top: 10, left: 12, bottom: 14, right: 16)
let cases: [(MeetingOverlayVisibleAnchor, CGSize, CGRect)] = [
- (MeetingOverlayVisibleAnchor(centerX: self.screen.minX, bottomY: 200), self.pill, CGRect(x: 100, y: 200, width: 84, height: 32)),
- (MeetingOverlayVisibleAnchor(centerX: self.screen.maxX, bottomY: 200), self.pill, CGRect(x: 1456, y: 200, width: 84, height: 32)),
- (MeetingOverlayVisibleAnchor(centerX: 820, bottomY: self.screen.minY - 40), self.pill, CGRect(x: 778, y: 50, width: 84, height: 32)),
- (MeetingOverlayVisibleAnchor(centerX: 820, bottomY: self.screen.maxY), self.pill, CGRect(x: 778, y: 918, width: 84, height: 32)),
- (MeetingOverlayVisibleAnchor(centerX: self.screen.minX, bottomY: self.screen.minY - 8), self.captions, CGRect(x: 100, y: 50, width: 340, height: 156)),
- (MeetingOverlayVisibleAnchor(centerX: self.screen.maxX, bottomY: self.screen.maxY), self.captions, CGRect(x: 1200, y: 794, width: 340, height: 156)),
+ (MeetingOverlayVisibleAnchor(centerX: self.screen.minX, bottomY: 200), self.pill, CGRect(origin: CGPoint(x: self.screen.minX, y: 200), size: self.pill)),
+ (MeetingOverlayVisibleAnchor(centerX: self.screen.maxX, bottomY: 200), self.pill, CGRect(origin: CGPoint(x: self.screen.maxX - self.pill.width, y: 200), size: self.pill)),
+ (MeetingOverlayVisibleAnchor(centerX: 820, bottomY: self.screen.minY - 40), self.pill, CGRect(origin: CGPoint(x: 820 - self.pill.width / 2, y: self.screen.minY), size: self.pill)),
+ (MeetingOverlayVisibleAnchor(centerX: 820, bottomY: self.screen.maxY), self.pill, CGRect(origin: CGPoint(x: 820 - self.pill.width / 2, y: self.screen.maxY - self.pill.height), size: self.pill)),
+ (MeetingOverlayVisibleAnchor(centerX: self.screen.minX, bottomY: self.screen.minY - 8), self.captions, CGRect(origin: CGPoint(x: self.screen.minX, y: self.screen.minY), size: self.captions)),
+ (MeetingOverlayVisibleAnchor(centerX: self.screen.maxX, bottomY: self.screen.maxY), self.captions, CGRect(origin: CGPoint(x: self.screen.maxX - self.captions.width, y: self.screen.maxY - self.captions.height), size: self.captions)),
]
for (anchor, size, expectedVisible) in cases {