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

Polish Fluid Notes beta and harden meeting model and capture setup

altic-dev460888ef8e87
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 590286e0..4d4f86cc 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -1394,8 +1394,8 @@ struct ContentView: View {
self.sidebarNavigationLink(.fileTranscription, title: "File Transcription", systemImage: "doc.text.fill")
self.sidebarNavigationLink(
.meetingTranscription,
- title: "Meeting Transcription",
- systemImage: "person.2.wave.2.fill"
+ title: "Fluid Notes",
+ systemImage: "note.text"
)
} header: {
self.sidebarSectionHeader("Use")
@@ -5613,6 +5613,7 @@ private enum SidebarSymbolCache {
"text.book.closed.fill",
"terminal.fill",
"doc.text.fill",
+ "note.text",
"clock.arrow.circlepath",
"chart.bar.fill",
"house.fill",
diff --git a/Sources/Fluid/Services/AppServices.swift b/Sources/Fluid/Services/AppServices.swift
index 2a17f5f4..699b6a8c 100644
--- a/Sources/Fluid/Services/AppServices.swift
+++ b/Sources/Fluid/Services/AppServices.swift
@@ -32,6 +32,7 @@ final class AppServices: ObservableObject {
/// Heavy operations should wait until this is true.
@Published private(set) var isUIReady: Bool = false
@Published private(set) var meetingAutoDetectHealth: MeetingAutoDetector.Health?
+ @Published private(set) var meetingAutomaticTarget: MeetingAutoDetector.ResolvedTarget?
/// Call this once the main UI has finished its initial layout.
/// This signals that it's safe to start heavy services.
@@ -119,6 +120,14 @@ final class AppServices: ObservableObject {
audioArbiter: self.meetingAudioActivityArbiter,
preferredMicrophoneUID: { [weak self] in
self?.microphonePreferenceCoordinator.inputDeviceForCapture()?.uid
+ },
+ validateRecordingModels: {
+ try await Task.detached(priority: .utility) {
+ guard CPUArchitecture.isAppleSilicon else {
+ throw MeetingParakeetNemotronRuntimeError.unsupportedArchitecture
+ }
+ _ = try MeetingModelInstaller.validate(MeetingNemotronModelLocator().resolvedPackageURL())
+ }.value
}
)
self._meetingSessionCoordinator = coordinator
@@ -168,6 +177,9 @@ final class AppServices: ObservableObject {
}
private func wireMeetingAutoDetector(_ detector: MeetingAutoDetector) {
+ detector.onAutomaticTargetChanged = { [weak self] target in
+ self?.meetingAutomaticTarget = target
+ }
detector.onPromptRequested = { request in
MeetingDetectionPromptController.shared.present(request)
}
diff --git a/Sources/Fluid/Services/Meeting/Backend/MeetingModelInstaller.swift b/Sources/Fluid/Services/Meeting/Backend/MeetingModelInstaller.swift
new file mode 100644
index 00000000..287f63ec
--- /dev/null
+++ b/Sources/Fluid/Services/Meeting/Backend/MeetingModelInstaller.swift
@@ -0,0 +1,75 @@
+import CryptoKit
+import Darwin
+import Foundation
+
+/// Temporary offline beta installer. Checksums identify the shipped FP16 package,
+/// not an arbitrary CoreML model with a matching filename. Run off the main actor.
+nonisolated enum MeetingModelInstaller {
+ private static let installationLock = NSLock()
+ private static let expectedFiles = [
+ "Manifest.json": "419130ae729d97aa5eba50abf9439cf01c1d5971821ddc1899b5c54728b3f302",
+ "Data/com.apple.CoreML/model.mlmodel": "c6112ac5ec5e217d2cebaba9e1d961f6df6e3bbb8e063188423c8e1575dca029",
+ "Data/com.apple.CoreML/weights/weight.bin": "d4838b028504ab3f9df8d733380cb1241c6c19896c17142e42fd6396a67de6c5",
+ ]
+
+ enum InstallError: LocalizedError {
+ case wrongPackage
+ var errorDescription: String? {
+ "Choose the supplied beta Nemotron FP16 .mlpackage. This package is different or damaged."
+ }
+ }
+
+ static func validate(_ package: URL) throws -> MeetingNemotronModelArtifact {
+ let artifact = try MeetingNemotronModelLocator.validatePackage(at: package.standardizedFileURL)
+ for (path, expected) in Self.expectedFiles {
+ let handle = try FileHandle(forReadingFrom: package.appendingPathComponent(path))
+ defer { try? handle.close() }
+ var hash = SHA256()
+ while let chunk = try handle.read(upToCount: 1_048_576), !chunk.isEmpty {
+ try Task.checkCancellation()
+ hash.update(data: chunk)
+ }
+ guard hash.finalize().map({ String(format: "%02x", $0) }).joined() == expected else {
+ throw InstallError.wrongPackage
+ }
+ }
+ return artifact
+ }
+
+ static func install(from source: URL, to destination: URL = MeetingNemotronModelLocator.defaultPackageURL()) throws -> MeetingNemotronModelArtifact {
+ self.installationLock.lock()
+ defer { self.installationLock.unlock() }
+ let accessing = source.startAccessingSecurityScopedResource()
+ defer { if accessing { source.stopAccessingSecurityScopedResource() } }
+ _ = try Self.validate(source)
+ if source.standardizedFileURL == destination.standardizedFileURL {
+ return try Self.validate(destination)
+ }
+ let manager = FileManager.default
+ let parent = destination.deletingLastPathComponent()
+ try manager.createDirectory(at: parent, withIntermediateDirectories: true)
+ let staging = parent.appendingPathComponent("import-\(UUID().uuidString).mlpackage", isDirectory: true)
+ defer { try? manager.removeItem(at: staging) }
+ try manager.copyItem(at: source, to: staging)
+ let artifact = try Self.validate(staging)
+ try Task.checkCancellation()
+ if manager.fileExists(atPath: destination.path) {
+ // Atomically swap directory packages; staging then contains the old model.
+ let result = staging.withUnsafeFileSystemRepresentation { stagedPath in
+ destination.withUnsafeFileSystemRepresentation { destinationPath in
+ renameatx_np(AT_FDCWD, stagedPath, AT_FDCWD, destinationPath, UInt32(RENAME_SWAP))
+ }
+ }
+ guard result == 0 else { throw POSIXError(POSIXErrorCode(rawValue: errno) ?? .EIO) }
+ } else {
+ try manager.moveItem(at: staging, to: destination)
+ }
+ return MeetingNemotronModelArtifact(
+ packageURL: destination,
+ totalByteCount: artifact.totalByteCount,
+ fileCount: artifact.fileCount,
+ manifestSHA256: artifact.manifestSHA256,
+ entryMetadataSHA256: artifact.entryMetadataSHA256
+ )
+ }
+}
diff --git a/Sources/Fluid/Services/Meeting/Backend/MeetingNemotronModelLocator.swift b/Sources/Fluid/Services/Meeting/Backend/MeetingNemotronModelLocator.swift
index 95f46f39..945789fd 100644
--- a/Sources/Fluid/Services/Meeting/Backend/MeetingNemotronModelLocator.swift
+++ b/Sources/Fluid/Services/Meeting/Backend/MeetingNemotronModelLocator.swift
@@ -36,7 +36,7 @@ nonisolated enum MeetingNemotronModelReadinessError: LocalizedError, Equatable {
switch self {
case let .modelNotInstalled(path):
return "The Nemotron diarization model is not installed at \(path). "
- + "Meeting model preparation has not run."
+ + "Open Fluid Notes settings and load the supplied speaker separation model before recording."
case let .invalidModelPackage(reason):
return "The Nemotron diarization model package is invalid (\(reason))."
case let .artifactChanged(path):
diff --git a/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingLiveTrackEngine.swift b/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingLiveTrackEngine.swift
index 54b7cbc7..700f70a7 100644
--- a/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingLiveTrackEngine.swift
+++ b/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingLiveTrackEngine.swift
@@ -148,7 +148,9 @@ actor MeetingLiveTrackEngine {
try Task.checkCancellation()
// Shares FluidAudio's default cache dir, so a Parakeet Flash download for
// dictation already satisfies this — first-run cost is paid at most once.
- try await manager.prepareModels()
+ try await MeetingModelPreparationQueue.shared.run {
+ try await manager.prepareModels()
+ }
guard !Task.isCancelled else { return }
await self.warmUp()
guard !Task.isCancelled else { return }
@@ -164,6 +166,9 @@ actor MeetingLiveTrackEngine {
func stop() async {
self.loadTask?.cancel()
self.drainTask?.cancel()
+ await self.loadTask?.value
+ self.loadTask = nil
+ self.isModelReady = false
await self.drainTask?.value
self.drainTask = nil
await self.resetRecognizer()
@@ -339,7 +344,8 @@ actor MeetingLiveTrackEngine {
if self.diagnosticsEnabled {
self.diagnosticSnapshot.partialCallbacks += 1
if self.diagnosticSnapshot.firstPartialAfterResetSeconds == nil,
- let reset = self.diagnosticResetUptime {
+ let reset = self.diagnosticResetUptime
+ {
self.diagnosticSnapshot.firstPartialAfterResetSeconds = self.uptime() - reset
}
}
diff --git a/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingModelPreparationQueue.swift b/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingModelPreparationQueue.swift
new file mode 100644
index 00000000..71e70c05
--- /dev/null
+++ b/Sources/Fluid/Services/Meeting/LiveTranscription/MeetingModelPreparationQueue.swift
@@ -0,0 +1,34 @@
+import Foundation
+
+/// Serializes model preparation across suspension points, not just actor entry.
+/// Separate recognizers retain independent decoder state but never write the cache concurrently.
+actor MeetingModelPreparationQueue {
+ static let shared = MeetingModelPreparationQueue()
+ private var tail: Task<Void, Error>?
+ private var tailID: UUID?
+
+ func run(_ operation: @escaping @Sendable () async throws -> Void) async throws {
+ try Task.checkCancellation()
+ let previous = self.tail
+ let id = UUID()
+ let task = Task {
+ _ = await previous?.result
+ try Task.checkCancellation()
+ try await operation()
+ }
+ self.tail = task
+ self.tailID = id
+ defer {
+ if self.tailID == id {
+ self.tail = nil
+ self.tailID = nil
+ }
+ }
+ try await withTaskCancellationHandler {
+ try await task.value
+ try Task.checkCancellation()
+ } onCancel: {
+ task.cancel()
+ }
+ }
+}
diff --git a/Sources/Fluid/Services/Meeting/MeetingAudioChunkWriter.swift b/Sources/Fluid/Services/Meeting/MeetingAudioChunkWriter.swift
index 9c16cbe0..647dae97 100644
--- a/Sources/Fluid/Services/Meeting/MeetingAudioChunkWriter.swift
+++ b/Sources/Fluid/Services/Meeting/MeetingAudioChunkWriter.swift
@@ -402,12 +402,17 @@ final nonisolated class MeetingAudioChunkWriter: @unchecked Sendable {
var presentationTime = sourcePresentationTime + self.canonicalTimelineOffset
var backwardReset = false
if let previousEnd, presentationTime < previousEnd {
+ // SCK nanosecond stamps and frame-derived durations can differ by tens of
+ // nanoseconds after CMTime rescaling. Keep them contiguous without creating
+ // hundreds of tiny analysis epochs. A real one-frame overlap still rotates.
+ let overlap = previousEnd - presentationTime
+ let isRoundingOverlap = overlap <= CMTime(value: 1, timescale: 1_000_000)
// Establish (or re-establish) the mapping once, then keep applying it. Anchoring the
// offset instead of clamping each sample preserves the producer's internal spacing.
self.canonicalTimelineOffset = previousEnd - sourcePresentationTime
self.canonicalTimelineOffsetEpoch = producerEpoch
presentationTime = previousEnd
- backwardReset = true
+ backwardReset = !isRoundingOverlap
} else if self.canonicalTimelineOffsetEpoch == nil {
self.canonicalTimelineOffsetEpoch = producerEpoch
}
@@ -480,7 +485,8 @@ final nonisolated class MeetingAudioChunkWriter: @unchecked Sendable {
guard var activeChunk = self.activeChunk else { return }
let receipt = try activeChunk.sink.append(sampleBuffer)
guard receipt.framesAccepted == receipt.framesWritten,
- receipt.framesAccepted == Int64(CMSampleBufferGetNumSamples(sampleBuffer)) else {
+ receipt.framesAccepted == Int64(CMSampleBufferGetNumSamples(sampleBuffer))
+ else {
throw MeetingCaptureError.writerFailed("PCM sink reported a short write.")
}
diff --git a/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift b/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift
index c1856858..260427e5 100644
--- a/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift
+++ b/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift
@@ -46,6 +46,9 @@ final class MeetingAutoDetector {
var onSuggestDisablingAutoDetect: (() -> Void)?
var onEpisodeInvalidated: ((UUID) -> Void)?
var onHealthChanged: ((Health) -> Void)?
+ /// Independent of prompt presentation/consumption; selecting a source never starts capture.
+ var onAutomaticTargetChanged: ((ResolvedTarget?) -> Void)?
+ private(set) var automaticTarget: ResolvedTarget?
private struct CandidateRecord {
var incarnation: UInt64
@@ -93,9 +96,15 @@ final class MeetingAutoDetector {
private let isNativeDetectionEnabled: () -> Bool
private let isBrowserDetectionEnabled: () -> Bool
- private var records: [Int32: CandidateRecord] = [:]
+ private var records: [Int32: CandidateRecord] = [:] {
+ didSet { self.publishAutomaticTarget() }
+ }
+
private var lastMicReleaseAt: Date?
- private var episodesByKey: [String: Episode] = [:]
+ private var episodesByKey: [String: Episode] = [:] {
+ didSet { self.publishAutomaticTarget() }
+ }
+
private var activeConsumedEpisodeKey: String?
private var dismissedBundleUntil: [String: Date] = [:]
private var dismissalTimestamps: [Date] = []
@@ -154,6 +163,8 @@ final class MeetingAutoDetector {
}
func stop() {
+ self.automaticTarget = nil
+ self.onAutomaticTargetChanged?(nil)
self.runGeneration &+= 1
self.pollTask?.cancel()
self.pollTask = nil
@@ -321,7 +332,7 @@ final class MeetingAutoDetector {
// to make output-only activity meaningful. Zoom's muted output-only path remains
// supported because Zoom also requires an explicit meeting-window title.
let hasEstablishedEpisode = self.episodesByKey.values.contains { $0.pid == pid }
- if isActive && !hasInput && record.bundleIdentifier != "us.zoom.xos" && !hasEstablishedEpisode {
+ if isActive, !hasInput, record.bundleIdentifier != "us.zoom.xos", !hasEstablishedEpisode {
self.handleAudioProcessActivity(false, pid: pid, at: now)
continue
}
@@ -332,7 +343,7 @@ final class MeetingAutoDetector {
func handleAudioProcessActivity(_ isActive: Bool, pid: Int32, at now: Date) {
guard var record = self.records[pid], record.tier == .nativeTier1 else { return }
record.processAudioObserved = true
- if isActive && record.processAudioWasActive {
+ if isActive, record.processAudioWasActive {
// A continuous stream is still fresh evidence. Refreshing here allows a late window
// snapshot/activation to confirm without synthesizing duplicate episodes.
record.audioEvidenceAt = now
@@ -342,7 +353,7 @@ final class MeetingAutoDetector {
self.attemptConfirm(pid: pid, at: now)
return
}
- if !isActive && !record.processAudioWasActive {
+ if !isActive, !record.processAudioWasActive {
// Inactivity must be continuously observed; an unknown snapshot resets this timer.
if record.processAudioInactiveAt == nil { record.processAudioInactiveAt = now }
self.records[pid] = record
@@ -382,7 +393,8 @@ final class MeetingAutoDetector {
let matched = self.matchingNativeWindow(ownedWindows, bundleIdentifier: bundleIdentifier)
if matched == nil, bundleIdentifier == "us.zoom.xos",
- let unreadableWindow = ownedWindows.first(where: { $0.title == nil }) {
+ let unreadableWindow = ownedWindows.first(where: { $0.title == nil })
+ {
guard !self.titleEnrichmentInFlight.contains(pid) else { continue }
self.titleEnrichmentInFlight.insert(pid)
let generation = (self.titleEnrichmentGeneration[pid] ?? 0) &+ 1
@@ -602,6 +614,27 @@ final class MeetingAutoDetector {
return ResolvedTarget(bundleIdentifier: episode.bundleIdentifier, pid: episode.pid, windowID: episode.windowID)
}
+ private func publishAutomaticTarget() {
+ let eligible = self.episodesByKey.values.filter { episode in
+ guard self.isNativeDetectionEnabled(),
+ episode.tier == .nativeTier1 || self.isBrowserDetectionEnabled(),
+ let record = self.records[episode.pid],
+ record.bundleIdentifier == episode.bundleIdentifier,
+ episode.key == "pid:\(episode.pid)|\(record.windowEvidenceKey ?? "")",
+ record.hasLiveWindow,
+ record.processAudioInactiveAt == nil
+ else { return false }
+ return true
+ }
+ // Ambiguity requires an explicit source, never arbitrary dictionary order.
+ let target = eligible.count == 1 ? eligible.first.map {
+ ResolvedTarget(bundleIdentifier: $0.bundleIdentifier, pid: $0.pid, windowID: $0.windowID)
+ } : nil
+ guard target != self.automaticTarget else { return }
+ self.automaticTarget = target
+ self.onAutomaticTargetChanged?(target)
+ }
+
/// Explicit "X" dismiss: suppresses the bundle for 30 minutes and counts toward the rolling
/// 14-day counter. A 20s auto-dismiss timeout must call `timeoutDismissed` instead.
func dismissTapped(episodeID: UUID, at now: Date) {
@@ -632,6 +665,7 @@ final class MeetingAutoDetector {
// MARK: Tick — grace, release, episode teardown, still-recording nudge
func tick(at now: Date) {
+ defer { self.publishAutomaticTarget() }
for pid in self.records.keys {
guard var record = self.records[pid] else { continue }
if let windowLostAt = record.windowLostAt, now.timeIntervalSince(windowLostAt) > Self.windowLossGraceSeconds {
diff --git a/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift b/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
index 8223575c..5f7e9395 100644
--- a/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
+++ b/Sources/Fluid/Services/Meeting/MeetingSessionCoordinator.swift
@@ -186,6 +186,7 @@ final class MeetingSessionCoordinator: ObservableObject {
}
private var correctionUndoStacks: [MeetingSessionID: [TranscriptCorrection]] = [:]
+ private let validateRecordingModels: @MainActor () async throws -> Void
private static let correctionUndoStackCap = 50
init(
@@ -193,13 +194,15 @@ final class MeetingSessionCoordinator: ObservableObject {
capture: any MeetingCaptureControlling,
processing: any MeetingProcessingControlling,
audioArbiter: any MeetingAudioActivityArbitrating,
- preferredMicrophoneUID: @escaping @MainActor () -> String? = { nil }
+ preferredMicrophoneUID: @escaping @MainActor () -> String? = { nil },
+ validateRecordingModels: @escaping @MainActor () async throws -> Void = {}
) {
self.store = store
self.capture = capture
self.processing = processing
self.audioArbiter = audioArbiter
self.preferredMicrophoneUID = preferredMicrophoneUID
+ self.validateRecordingModels = validateRecordingModels
}
var currentSession: MeetingSession? {
@@ -369,6 +372,8 @@ final class MeetingSessionCoordinator: ObservableObject {
// Permission prompts are outside the exclusive audio lease. A prompt can remain
// open indefinitely; reserving meeting audio first would unnecessarily block dictation.
+ try await self.validateRecordingModels()
+ try Task.checkCancellation()
try await self.capture.preflightPermissions()
try Task.checkCancellation()
guard self.startReservation == reservation,
diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swift
index 595e8058..ca497146 100644
--- a/Sources/Fluid/Services/MenuBarManager.swift
+++ b/Sources/Fluid/Services/MenuBarManager.swift
@@ -925,7 +925,7 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {
self.meetingStatusMenuItem = meetingStatusItem
let openMeetingItem = NSMenuItem(
- title: "Open Meeting Transcription",
+ title: "Open Fluid Notes",
action: #selector(openMeetingTranscription),
keyEquivalent: ""
)
@@ -1077,24 +1077,24 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {
break
case .preparing:
self.meetingStatusMenuItem?.title = "Starting meeting recording…"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .recording:
let source = self.meetingMenuPresentation.sourceName ?? "Meeting"
let elapsed = self.meetingMenuPresentation.startedAt.map { Self.elapsedText(now.timeIntervalSince($0)) } ?? "0:00"
self.meetingStatusMenuItem?.title = "Recording \(source) · \(elapsed)"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .stopping:
self.meetingStatusMenuItem?.title = "Finalizing meeting audio…"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .processing:
self.meetingStatusMenuItem?.title = "Transcribing meeting…"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .interrupted:
self.meetingStatusMenuItem?.title = self.meetingMenuPresentation.attentionStatus ?? "Recording interrupted"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .failed:
self.meetingStatusMenuItem?.title = self.meetingMenuPresentation.attentionStatus ?? "Meeting setup failed"
- self.openMeetingTranscriptionMenuItem?.title = "Open Meeting Transcription"
+ self.openMeetingTranscriptionMenuItem?.title = "Open Fluid Notes"
case .completed:
self.openMeetingTranscriptionMenuItem?.title = "Open Latest Meeting Transcript"
}
diff --git a/Sources/Fluid/Theme/Components/FluidDropdown.swift b/Sources/Fluid/Theme/Components/FluidDropdown.swift
index e5210060..4a12639e 100644
--- a/Sources/Fluid/Theme/Components/FluidDropdown.swift
+++ b/Sources/Fluid/Theme/Components/FluidDropdown.swift
@@ -42,15 +42,47 @@ struct FluidDropdownChevron: View {
}
private struct FluidDropdownControlStyle: ViewModifier {
+ var fillsWidth = false
+
@Environment(\.theme) private var theme
- func body(content: Content) -> some View {
- content
- .menuStyle(.borderlessButton)
- .buttonStyle(.plain)
- .menuIndicator(.hidden)
- .labelsHidden()
+
+ @ViewBuilder func body(content: Content) -> some View {
+ if self.fillsWidth {
+ content
+ .menuStyle(.button)
+ .buttonStyle(FluidDropdownButtonStyle(fillsWidth: true))
+ .menuIndicator(.hidden)
+ .labelsHidden()
+ } else {
+ content
+ .menuStyle(.borderlessButton)
+ .buttonStyle(.plain)
+ .menuIndicator(.hidden)
+ .labelsHidden()
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.theme.palette.primaryText)
+ .padding(.leading, 12)
+ .padding(.trailing, 30)
+ .padding(.vertical, 9)
+ .fluidDropdownSurface()
+ .overlay(alignment: .trailing) {
+ FluidDropdownChevron().padding(.trailing, 12).allowsHitTesting(false)
+ }
+ }
+ }
+}
+
+/// Keep the surface inside the native control's label, so its padding and
+/// expanded width participate in hit testing, not just the selected text.
+private struct FluidDropdownButtonStyle: ButtonStyle {
+ @Environment(\.theme) private var theme
+ let fillsWidth: Bool
+
+ func makeBody(configuration: Configuration) -> some View {
+ configuration.label
.font(self.theme.typography.bodySmall)
.foregroundStyle(self.theme.palette.primaryText)
+ .frame(maxWidth: self.fillsWidth ? .infinity : nil, alignment: .leading)
.padding(.leading, 12)
.padding(.trailing, 30)
.padding(.vertical, 9)
@@ -64,7 +96,11 @@ private struct FluidDropdownControlStyle: ViewModifier {
extension View {
/// Apply outside a native menu/picker, rather than inside its label:
/// macOS may flatten label styling when building the native control.
- func fluidDropdownStyle() -> some View { modifier(FluidDropdownControlStyle()) }
+ /// Full-width selectors use a Menu containing an inline Picker. Native
+ /// menu Pickers and borderless menus ignore custom ButtonStyle hit geometry.
+ func fluidDropdownStyle(fillsWidth: Bool = false) -> some View {
+ modifier(FluidDropdownControlStyle(fillsWidth: fillsWidth))
+ }
/// For custom searchable controls that provide their own label and chevron.
func fluidDropdownSurface(cornerRadius: CGFloat = 10) -> some View {
diff --git a/Sources/Fluid/Theme/Components/FluidGlassControls.swift b/Sources/Fluid/Theme/Components/FluidGlassControls.swift
index 3abe3afd..1f062b3f 100644
--- a/Sources/Fluid/Theme/Components/FluidGlassControls.swift
+++ b/Sources/Fluid/Theme/Components/FluidGlassControls.swift
@@ -37,24 +37,30 @@ private struct FluidGlassActionModifier: ViewModifier {
@Environment(\.accessibilityReduceTransparency) private var reduceTransparency
let prominent: Bool
let circular: Bool
+ let tone: Color?
+ let spacious: Bool
@ViewBuilder func body(content: Content) -> some View {
if #available(macOS 26, *), !self.reduceTransparency {
if self.prominent {
- content.buttonStyle(.glassProminent).tint(FluidBrandColors.blue)
- .controlSize(.large).buttonBorderShape(.capsule)
+ content.buttonStyle(.glassProminent).tint(self.tone ?? FluidBrandColors.blue)
+ .controlSize(self.spacious ? .extraLarge : .large).buttonBorderShape(.capsule)
} else {
- content.buttonStyle(.glass).controlSize(.large).buttonBorderShape(self.circular ? .circle : .capsule)
+ content.buttonStyle(.glass).controlSize(self.spacious ? .extraLarge : .large).buttonBorderShape(self.circular ? .circle : .capsule)
}
} else {
- content.fluidButton(self.prominent ? .accent : .secondary, size: .large)
+ if self.prominent {
+ content.buttonStyle(AccentButtonStyle(tone: self.tone ?? FluidBrandColors.blue))
+ } else {
+ content.buttonStyle(FluidOutlinedButtonStyle(height: FluidButtonSize.large.controlHeight))
+ }
}
}
}
extension View {
- func fluidGlassAction(prominent: Bool = false, circular: Bool = false) -> some View {
- self.modifier(FluidGlassActionModifier(prominent: prominent, circular: circular))
+ func fluidGlassAction(prominent: Bool = false, circular: Bool = false, tone: Color? = nil, spacious: Bool = false) -> some View {
+ self.modifier(FluidGlassActionModifier(prominent: prominent, circular: circular, tone: tone, spacious: spacious))
.fixedSize(horizontal: true, vertical: false)
}
}
diff --git a/Sources/Fluid/Theme/Components/FluidIconTile.swift b/Sources/Fluid/Theme/Components/FluidIconTile.swift
new file mode 100644
index 00000000..3f20f25c
--- /dev/null
+++ b/Sources/Fluid/Theme/Components/FluidIconTile.swift
@@ -0,0 +1,21 @@
+import SwiftUI
+
+/// Shared icon tile extracted from Dashboard, with its original defaults preserved.
+struct FluidIconTile: View {
+ let icon: String
+ let tint: Color
+ var size: CGFloat = 34
+
+ var body: some View {
+ Image(systemName: self.icon)
+ .font(.fluidSystem(size: self.size > 34 ? 20 : 15, weight: .medium))
+ .foregroundStyle(self.tint)
+ .frame(width: self.size, height: self.size)
+ .background(
+ LinearGradient(colors: [self.tint.opacity(0.18), self.tint.opacity(0.07)], startPoint: .top, endPoint: .bottom),
+ in: RoundedRectangle(cornerRadius: 10, style: .continuous)
+ )
+ .overlay(RoundedRectangle(cornerRadius: 10, style: .continuous).strokeBorder(self.tint.opacity(0.16), lineWidth: 1))
+ .accessibilityHidden(true)
+ }
+}
diff --git a/Sources/Fluid/Theme/Components/FluidSheetOutsideDismiss.swift b/Sources/Fluid/Theme/Components/FluidSheetOutsideDismiss.swift
new file mode 100644
index 00000000..afd41bda
--- /dev/null
+++ b/Sources/Fluid/Theme/Components/FluidSheetOutsideDismiss.swift
@@ -0,0 +1,58 @@
+import AppKit
+import SwiftUI
+
+/// Opt-in click-away cancellation for a native sheet. The click is consumed so
+/// dismissing settings cannot also activate a control in the underlying window.
+struct FluidSheetOutsideDismiss: NSViewRepresentable {
+ let onCancel: () -> Void
+
+ func makeNSView(context _: Context) -> MonitorView {
+ let view = MonitorView()
+ view.onCancel = self.onCancel
+ return view
+ }
+
+ func updateNSView(_ view: MonitorView, context _: Context) {
+ view.onCancel = self.onCancel
+ }
+
+ static func dismantleNSView(_ view: MonitorView, coordinator _: ()) {
+ view.stopMonitoring()
+ }
+
+ final class MonitorView: NSView {
+ var onCancel: (() -> Void)?
+ private var monitor: Any?
+
+ override func hitTest(_: NSPoint) -> NSView? { nil }
+
+ override func viewDidMoveToWindow() {
+ super.viewDidMoveToWindow()
+ self.stopMonitoring()
+ guard self.window != nil else { return }
+ self.monitor = NSEvent.addLocalMonitorForEvents(matching: .leftMouseDown) { [weak self] event in
+ guard let self,
+ let sheet = self.window,
+ let parent = sheet.sheetParent,
+ parent.attachedSheet === sheet,
+ sheet.isVisible,
+ let eventWindow = event.window,
+ eventWindow === parent || eventWindow === sheet
+ else { return event }
+ let point = eventWindow.convertPoint(toScreen: event.locationInWindow)
+ guard parent.frame.contains(point), !sheet.frame.contains(point) else { return event }
+ self.stopMonitoring()
+ self.onCancel?()
+ return nil
+ }
+ }
+
+ func stopMonitoring() {
+ guard let monitor else { return }
+ NSEvent.removeMonitor(monitor)
+ self.monitor = nil
+ }
+
+ deinit { self.stopMonitoring() }
+ }
+}
diff --git a/Sources/Fluid/UI/DashboardView.swift b/Sources/Fluid/UI/DashboardView.swift
index 86416fe5..72b70e7f 100644
--- a/Sources/Fluid/UI/DashboardView.swift
+++ b/Sources/Fluid/UI/DashboardView.swift
@@ -354,7 +354,7 @@ private struct DashboardQuickAction: View {
var body: some View {
Button(action: self.action) {
HStack(spacing: 12) {
- DashboardIconTile(icon: self.icon, tint: self.tint)
+ FluidIconTile(icon: self.icon, tint: self.tint)
VStack(alignment: .leading, spacing: 3) {
Text(self.title).font(self.theme.typography.bodySmallStrong)
Text(self.detail).font(self.theme.typography.caption).foregroundStyle(.secondary)
@@ -390,7 +390,7 @@ private struct DashboardLessonCard: View {
var body: some View {
Button(action: self.action) {
HStack(spacing: 12) {
- DashboardIconTile(icon: self.icon, tint: self.theme.palette.accent)
+ FluidIconTile(icon: self.icon, tint: self.theme.palette.accent)
VStack(alignment: .leading, spacing: 3) {
Text(self.title).font(self.theme.typography.bodySmallStrong)
Text(self.detail).font(self.theme.typography.caption).foregroundStyle(.secondary)
@@ -418,23 +418,6 @@ private struct DashboardLessonCard: View {
}
}
-private struct DashboardIconTile: View {
- let icon: String
- let tint: Color
-
- var body: some View {
- Image(systemName: self.icon)
- .font(.fluidSystem(size: 15, weight: .medium))
- .foregroundStyle(self.tint)
- .frame(width: 34, height: 34)
- .background(
- LinearGradient(colors: [self.tint.opacity(0.18), self.tint.opacity(0.07)], startPoint: .top, endPoint: .bottom),
- in: RoundedRectangle(cornerRadius: 10, style: .continuous)
- )
- .overlay(RoundedRectangle(cornerRadius: 10, style: .continuous).strokeBorder(self.tint.opacity(0.16), lineWidth: 1))
- }
-}
-
private struct DashboardTileModifier: ViewModifier {
let hovered: Bool
let horizontalPadding: CGFloat
diff --git a/Sources/Fluid/UI/MeetingLiveCaptionBubbles.swift b/Sources/Fluid/UI/MeetingLiveCaptionBubbles.swift
index 7f4c2602..4b260098 100644
--- a/Sources/Fluid/UI/MeetingLiveCaptionBubbles.swift
+++ b/Sources/Fluid/UI/MeetingLiveCaptionBubbles.swift
@@ -12,9 +12,13 @@ struct MeetingBubbleStyle {
static func final(fill: Color, foreground: Color) -> MeetingBubbleStyle {
MeetingBubbleStyle(
- font: .system(size: 15, design: .monospaced), lineSpacing: 5,
- horizontalPadding: 18, verticalPadding: 12, cornerRadius: 18,
- fill: fill, foreground: foreground
+ font: .system(size: 15, design: .monospaced),
+ lineSpacing: 5,
+ horizontalPadding: 18,
+ verticalPadding: 12,
+ cornerRadius: 18,
+ fill: fill,
+ foreground: foreground
)
}
}
@@ -36,6 +40,7 @@ extension View {
struct MeetingLiveBubbleScrollList: View {
let rows: [MeetingLiveBubbleComposer.Row]
var hidesPartialFromAccessibility = true
+ var documentStyle = false
@Environment(\.theme) private var theme
@Environment(\.accessibilityReduceMotion) private var reduceMotion
@@ -53,7 +58,7 @@ struct MeetingLiveBubbleScrollList: View {
ScrollView {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
ForEach(self.rows) { row in
- MeetingLiveBubbleRow(row: row, hidesPartialFromAccessibility: self.hidesPartialFromAccessibility)
+ MeetingLiveBubbleRow(row: row, hidesPartialFromAccessibility: self.hidesPartialFromAccessibility, documentStyle: self.documentStyle)
.equatable()
.id(row.id)
.transition(.opacity)
@@ -115,11 +120,12 @@ struct MeetingLiveBubbleScrollList: View {
struct MeetingLiveBubbleRow: View, Equatable {
let row: MeetingLiveBubbleComposer.Row
var hidesPartialFromAccessibility: Bool = true
+ var documentStyle = false
@Environment(\.theme) private var theme
static func == (lhs: MeetingLiveBubbleRow, rhs: MeetingLiveBubbleRow) -> Bool {
- lhs.row == rhs.row && lhs.hidesPartialFromAccessibility == rhs.hidesPartialFromAccessibility
+ lhs.row == rhs.row && lhs.hidesPartialFromAccessibility == rhs.hidesPartialFromAccessibility && lhs.documentStyle == rhs.documentStyle
}
private var isMicrophone: Bool { self.row.speaker == .you }
@@ -135,7 +141,7 @@ struct MeetingLiveBubbleRow: View, Equatable {
}
var body: some View {
- VStack(alignment: self.isMicrophone ? .trailing : .leading, spacing: 4) {
+ VStack(alignment: self.isMicrophone && !self.documentStyle ? .trailing : .leading, spacing: 4) {
if self.row.showsLabel {
Text(self.sourceLabel)
.font(self.theme.typography.captionStrong)
@@ -144,12 +150,26 @@ struct MeetingLiveBubbleRow: View, Equatable {
Text(self.row.text)
// The partial→final color swap solidifies in place; it must never animate.
.transaction { $0.animation = nil }
- .meetingBubbleStyle(.final(fill: self.fill, foreground: self.row.isPartial ? self.theme.palette.secondaryText : self.theme.palette.primaryText))
+ .meetingBubbleStyle(self.presentationStyle)
}
- .frame(maxWidth: .infinity, alignment: self.isMicrophone ? .trailing : .leading)
- .padding(self.isMicrophone ? .leading : .trailing, 32)
+ .frame(maxWidth: .infinity, alignment: self.isMicrophone && !self.documentStyle ? .trailing : .leading)
+ .padding(self.isMicrophone ? .leading : .trailing, self.documentStyle ? 0 : 32)
.accessibilityElement(children: .combine)
.accessibilityLabel("\(self.sourceLabel), \(self.row.text)")
.accessibilityHidden(self.hidesPartialFromAccessibility && self.row.isPartial)
}
+
+ private var presentationStyle: MeetingBubbleStyle {
+ let foreground = self.row.isPartial ? self.theme.palette.secondaryText : self.theme.palette.primaryText
+ guard self.documentStyle else { return .final(fill: self.fill, foreground: foreground) }
+ return MeetingBubbleStyle(
+ font: self.theme.typography.body,
+ lineSpacing: 5,
+ horizontalPadding: 0,
+ verticalPadding: self.theme.metrics.spacing.sm,
+ cornerRadius: 0,
+ fill: .clear,
+ foreground: foreground
+ )
+ }
}
diff --git a/Sources/Fluid/UI/MeetingModelSettingsSection.swift b/Sources/Fluid/UI/MeetingModelSettingsSection.swift
new file mode 100644
index 00000000..663c5f5b
--- /dev/null
+++ b/Sources/Fluid/UI/MeetingModelSettingsSection.swift
@@ -0,0 +1,83 @@
+import AppKit
+import SwiftUI
+
+struct MeetingModelSettingsSection: View {
+ @Environment(\.theme) private var theme
+ @State private var installed: MeetingNemotronModelArtifact?
+ @State private var isBusy = true
+ @State private var message: String?
+
+ var body: some View {
+ FluidManagementGroup(title: "Speaker separation model") {
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.md) {
+ HStack(spacing: self.theme.metrics.spacing.lg) {
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
+ if self.isBusy {
+ HStack { ProgressView().controlSize(.small); Text("Validating model…") }
+ } else if let installed {
+ Label("Ready", systemImage: "checkmark.circle.fill")
+ .foregroundStyle(self.theme.palette.success)
+ Text("Nemotron FP16 · \(ByteCountFormatter.string(fromByteCount: installed.totalByteCount, countStyle: .file))")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ } else {
+ Text("Not installed").font(self.theme.typography.bodyStrong)
+ }
+ }
+ Spacer(minLength: self.theme.metrics.spacing.md)
+ Button(self.installed == nil ? "Load model…" : "Replace model…", action: self.choosePackage)
+ .fluidGlassAction()
+ .disabled(self.isBusy || !CPUArchitecture.isAppleSilicon)
+ }
+ Text(CPUArchitecture.isAppleSilicon
+ ? "Beta: choose the supplied .mlpackage. A copy is saved in FluidVoice and stays ready after restarting. No recording starts."
+ : "Speaker separation requires an Apple silicon Mac.")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ if let message {
+ Text(message).font(self.theme.typography.caption).foregroundStyle(self.theme.palette.warning)
+ }
+ }
+ }
+ .task {
+ let result = await Task.detached(priority: .utility) {
+ try? MeetingModelInstaller.validate(MeetingNemotronModelLocator().resolvedPackageURL())
+ }.value
+ self.installed = result
+ self.isBusy = false
+ }
+ }
+
+ private func choosePackage() {
+ guard MeetingNemotronModelLocator().resolvedPackageURL().standardizedFileURL
+ == MeetingNemotronModelLocator.defaultPackageURL().standardizedFileURL
+ else {
+ self.message = "A development model path is active. Remove that override and restart FluidVoice before importing."
+ return
+ }
+ let panel = NSOpenPanel()
+ panel.title = "Load speaker separation model"
+ panel.message = "Choose nemotron_diar_fp16.mlpackage from the beta model download."
+ panel.canChooseFiles = true
+ panel.canChooseDirectories = true
+ panel.treatsFilePackagesAsDirectories = false
+ panel.allowsMultipleSelection = false
+ // CoreML package types are not registered on every beta tester's Mac.
+ // Let the installer validate the selection instead of greying out valid packages.
+ panel.begin { response in
+ guard response == .OK, let source = panel.url else { return }
+ self.isBusy = true
+ self.message = nil
+ Task {
+ do {
+ self.installed = try await Task.detached(priority: .utility) {
+ try MeetingModelInstaller.install(from: source)
+ }.value
+ } catch {
+ self.message = error.localizedDescription
+ }
+ self.isBusy = false
+ }
+ }
+ }
+}
diff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swift
index e8634ce9..8dc48aec 100644
--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift
+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift
@@ -27,12 +27,17 @@ struct MeetingTranscriptionSetupDraft: Equatable {
var mode: MeetingCaptureMode = .onlineCall
var title: String = Self.defaultTitle(mode: .onlineCall, applicationDisplayName: nil)
var selectedApplicationID: String?
+ var usesAutomaticApplication = true
var selectedMicrophoneID: String?
/// Once true, the default title stops following the selected application/mode.
var titleWasEdited = false
+ var autoDetectEnabled: Bool
+ var browserDetectionEnabled: Bool
init(settings: SettingsStore = .shared) {
let defaults = settings.meetingRecordingDefaults
+ self.autoDetectEnabled = settings.meetingAutoDetectEnabled
+ self.browserDetectionEnabled = settings.meetingAutoDetectBrowserEnabled
self.mode = defaults.mode
self.title = Self.defaultTitle(mode: defaults.mode, applicationDisplayName: nil)
self.selectedApplicationID = nil
@@ -84,6 +89,7 @@ struct MeetingSetupReadiness: Equatable {
struct MeetingTranscriptionView: View {
@ObservedObject var coordinator: MeetingSessionCoordinator
@ObservedObject var asrService: ASRService
+ @ObservedObject private var appServices = AppServices.shared
let onOpenVoiceEngine: () -> Void
@Environment(\.theme) private var theme
@@ -124,7 +130,7 @@ struct MeetingTranscriptionView: View {
let initialDraft = MeetingTranscriptionSetupDraft(settings: .shared)
self._setupDraft = State(initialValue: initialDraft)
self._setupDraftBeforeEditing = State(initialValue: initialDraft)
- self._isShowingMeetingSettings = State(initialValue: !SettingsStore.shared.meetingRecordingDefaults.isConfigured)
+ self._isShowingMeetingSettings = State(initialValue: false)
}
var body: some View {
@@ -147,57 +153,75 @@ struct MeetingTranscriptionView: View {
Divider()
- HStack(spacing: 0) {
- MeetingTranscriptionCanvas(
- setupDraft: self.$setupDraft,
- state: self.canvasState,
- applications: self.applications,
- microphones: self.microphones,
- readiness: self.readiness,
- errorMessage: self.actionErrorMessage,
- onRefreshSources: self.refreshSourcesFromUserAction,
- onStart: self.startRecording,
- onStop: self.stopAndTranscribe,
- onRetrySession: { self.retryProcessingSession(id: $0.id) },
- onRevealAudio: self.revealCapturedAudio,
- onRecordAgain: self.recordAgain,
- onCopyTranscript: self.copyTranscript,
- onExportTranscript: self.exportTranscript,
- onReassignSegment: self.reassignSegment,
- onNameUnknownSegment: self.nameUnknownSegment,
- onRenameSpeaker: self.renameSpeaker,
- onMergeSpeakers: self.mergeSpeakers,
- onUndoCorrection: self.undoTranscriptCorrection,
- onRenameSession: self.renameMeetingSession,
- onAssignSpeakers: self.assignSpeakers,
- canUndoCorrection: { self.coordinator.canUndoCorrection(sessionID: $0) },
- isQuiescent: self.coordinator.isQuiescent,
- onOpenMeetingSettings: self.openMeetingSettings,
- isRetrying: self.isRetrying,
- onCloseSelection: self.closeCanvasAction
- )
-
- if self.isMeetingHistoryVisible {
- Divider()
- MeetingHistoryInspector(
- sessions: self.meetingHistory,
- selectedSessionID: Binding(
- get: { self.selectedHistorySessionID },
- set: { if self.canBrowseMeetingHistory { self.selectedHistorySessionID = $0 } }
- ),
- errorMessage: self.meetingHistoryError,
- isQuiescent: self.coordinator.isQuiescent,
- onRefresh: { Task { await self.loadMeetingHistory() } },
- onRetry: { self.retryProcessingSession(id: $0) },
+ GeometryReader { geometry in
+ ZStack(alignment: .trailing) {
+ MeetingTranscriptionCanvas(
+ setupDraft: self.$setupDraft,
+ state: self.canvasState,
+ applications: self.applications,
+ microphones: self.microphones,
+ readiness: self.readiness,
+ errorMessage: self.actionErrorMessage,
+ onStart: self.startRecording,
+ onStop: self.stopAndTranscribe,
+ onRetrySession: { self.retryProcessingSession(id: $0.id) },
onRevealAudio: self.revealCapturedAudio,
- onExportAudio: self.exportAudio,
- onExportTranscript: { self.exportTranscript($0, format: $1, includeEchoes: false) },
- onDeleteAudioRequest: { self.pendingDeleteAudioSessionID = $0 },
- onDeleteRequest: { self.pendingDeleteSessionID = $0 },
- onRecordAgain: self.recordAgain
+ onRecordAgain: self.recordAgain,
+ onCopyTranscript: self.copyTranscript,
+ onExportTranscript: self.exportTranscript,
+ onReassignSegment: self.reassignSegment,
+ onNameUnknownSegment: self.nameUnknownSegment,
+ onRenameSpeaker: self.renameSpeaker,
+ onMergeSpeakers: self.mergeSpeakers,
+ onUndoCorrection: self.undoTranscriptCorrection,
+ onRenameSession: self.renameMeetingSession,
+ onAssignSpeakers: self.assignSpeakers,
+ canUndoCorrection: { self.coordinator.canUndoCorrection(sessionID: $0) },
+ isQuiescent: self.coordinator.isQuiescent,
+ onRepairSetup: self.repairRecordingSetup,
+ isRetrying: self.isRetrying,
+ onCloseSelection: self.closeCanvasAction
)
- .frame(width: 290)
- .transition(.move(edge: .trailing).combined(with: .opacity))
+ .padding(.trailing, self.isMeetingHistoryVisible && geometry.size.width >= 810 ? 290 : 0)
+ .allowsHitTesting(!self.isMeetingHistoryVisible || geometry.size.width >= 810)
+ .accessibilityHidden(self.isMeetingHistoryVisible && geometry.size.width < 810)
+
+ if self.isMeetingHistoryVisible {
+ if geometry.size.width < 810 {
+ Button {
+ self.isMeetingHistoryVisible = false
+ } label: {
+ self.theme.palette.windowBackground.opacity(0.65)
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel("Close meeting history")
+ }
+ MeetingHistoryInspector(
+ sessions: self.meetingHistory,
+ selectedSessionID: Binding(
+ get: { self.selectedHistorySessionID },
+ set: {
+ if self.canBrowseMeetingHistory {
+ self.selectedHistorySessionID = $0
+ if geometry.size.width < 810 { self.isMeetingHistoryVisible = false }
+ }
+ }
+ ),
+ errorMessage: self.meetingHistoryError,
+ isQuiescent: self.coordinator.isQuiescent,
+ onRefresh: { Task { await self.loadMeetingHistory() } },
+ onRetry: { self.retryProcessingSession(id: $0) },
+ onRevealAudio: self.revealCapturedAudio,
+ onExportAudio: self.exportAudio,
+ onExportTranscript: { self.exportTranscript($0, format: $1, includeEchoes: false) },
+ onDeleteAudioRequest: { self.pendingDeleteAudioSessionID = $0 },
+ onDeleteRequest: { self.pendingDeleteSessionID = $0 },
+ onRecordAgain: self.recordAgain
+ )
+ .frame(width: min(290, geometry.size.width))
+ .overlay(alignment: .leading) { Divider() }
+ .transition(.move(edge: .trailing).combined(with: .opacity))
+ }
}
}
}
@@ -217,11 +241,11 @@ struct MeetingTranscriptionView: View {
.onChange(of: self.setupDraft.selectedApplicationID) { _, _ in
self.regenerateDefaultTitleIfNeeded()
}
- .onChange(of: self.asrService.isAsrReady) { _, isReady in
- self.cachedModelReady = isReady || self.asrService.modelsExistOnDisk
- }
- .onChange(of: self.asrService.modelsExistOnDisk) { _, existsOnDisk in
- self.cachedModelReady = self.asrService.isAsrReady || existsOnDisk
+ .onChange(of: self.appServices.meetingAutomaticTarget) { _, _ in
+ guard self.setupDraft.usesAutomaticApplication, !self.isShowingMeetingSettings,
+ self.coordinator.isQuiescent, !self.isStarting else { return }
+ self.selectPreferredApplication(from: self.applications.map(\.identity))
+ Task { await self.refreshSources(requestPermissions: false) }
}
.onChange(of: self.coordinator.latestCompletedSession?.id) { _, _ in
Task { await self.loadMeetingHistory() }
@@ -243,8 +267,6 @@ struct MeetingTranscriptionView: View {
microphones: self.microphones,
readiness: self.readiness,
isFirstSetup: !SettingsStore.shared.meetingRecordingDefaults.isConfigured,
- savedApplicationName: Self.savedApplicationName,
- savedApplicationBundleIdentifier: SettingsStore.shared.meetingRecordingDefaults.applicationBundleIdentifier,
onRefreshSources: self.refreshSourcesFromUserAction,
onOpenMicrophoneSettings: { Self.openMicrophoneSettings() },
onOpenScreenRecordingSettings: { self.openScreenRecordingSettings() },
@@ -252,7 +274,8 @@ struct MeetingTranscriptionView: View {
onCancel: self.cancelMeetingSettings,
onSave: self.saveMeetingSettings
)
- .interactiveDismissDisabled(!SettingsStore.shared.meetingRecordingDefaults.isConfigured)
+ .background(FluidSheetOutsideDismiss(onCancel: self.cancelMeetingSettings))
+ .interactiveDismissDisabled()
}
.alert(
"Delete Meeting?",
@@ -408,6 +431,10 @@ struct MeetingTranscriptionView: View {
} else if !self.cachedStorageReady {
let trackCount = MeetingPCMStoragePolicy.trackCount(for: self.setupDraft.mode)
blockingMessage = "Free at least \(MeetingPCMStoragePolicy.requiredFreeSpaceDescription(trackCount: trackCount)) of storage before recording."
+ } else if !CPUArchitecture.isAppleSilicon {
+ blockingMessage = "Fluid Notes requires an Apple silicon Mac."
+ } else if !modelReady {
+ blockingMessage = "Load the supplied speaker separation model in Fluid Notes settings before recording."
} else {
blockingMessage = nil
}
@@ -418,7 +445,7 @@ struct MeetingTranscriptionView: View {
meetingAudioReady: meetingAudioReady,
microphoneStatus: microphoneStatusText,
microphoneReady: microphoneReady && !self.microphones.isEmpty,
- modelStatus: modelReady ? "Installed · runs after Stop" : "Will prepare after Stop",
+ modelStatus: modelReady ? "Speaker model installed · transcription prepares after Stop" : "Load speaker model in Settings",
modelReady: modelReady,
storageStatus: self.cachedStorageStatus,
storageReady: self.cachedStorageReady,
@@ -438,6 +465,9 @@ struct MeetingTranscriptionView: View {
private func refreshSources(requestPermissions: Bool) async {
guard !self.isRefreshingSources else { return }
self.isRefreshingSources = true
+ self.cachedModelReady = await Task.detached(priority: .utility) {
+ CPUArchitecture.isAppleSilicon && (try? MeetingNemotronModelLocator().locate()) != nil
+ }.value
self.refreshCachedReadiness()
defer {
self.refreshCachedReadiness()
@@ -525,34 +555,27 @@ struct MeetingTranscriptionView: View {
private func selectPreferredApplication(from identities: [MeetingApplicationIdentity]) {
let options = identities.map(MeetingApplicationOption.init)
+ if self.setupDraft.usesAutomaticApplication {
+ let target = self.appServices.meetingAutomaticTarget
+ self.setupDraft.selectedApplicationID = options.first {
+ $0.identity.bundleIdentifier == target?.bundleIdentifier && $0.identity.processID == target?.pid
+ }?.id
+ return
+ }
if let selectedID = setupDraft.selectedApplicationID,
options.contains(where: { $0.id == selectedID })
{
return
}
- let defaults = SettingsStore.shared.meetingRecordingDefaults
- if defaults.isConfigured {
- let savedIdentity = defaults.savedApplication(in: identities)
- self.setupDraft.selectedApplicationID = savedIdentity.map { MeetingApplicationOption(identity: $0).id }
- return
- }
-
- let preferredBundleIdentifiers = [
- "us.zoom.xos",
- "com.google.Chrome",
- "com.microsoft.teams2",
- ]
- let preferredIdentity = preferredBundleIdentifiers.lazy.compactMap { bundleIdentifier in
- identities.first(where: { $0.bundleIdentifier == bundleIdentifier })
- }.first ?? identities.first
- self.setupDraft.selectedApplicationID = preferredIdentity.map { MeetingApplicationOption(identity: $0).id }
+ self.setupDraft.selectedApplicationID = nil
}
private func startRecording() {
guard !self.isStarting else { return }
let readiness = self.readiness
guard readiness.activityReady,
+ readiness.modelReady,
readiness.storageReady,
readiness.microphoneReady,
self.setupDraft.mode == .inRoom || readiness.meetingAudioReady,
@@ -587,7 +610,13 @@ struct MeetingTranscriptionView: View {
let applicationOption = self.applications.first(where: { $0.id == self.setupDraft.selectedApplicationID })
if self.setupDraft.mode == .onlineCall, applicationOption == nil { return nil }
- let application = self.setupDraft.mode == .onlineCall ? applicationOption?.identity : nil
+ var application = self.setupDraft.mode == .onlineCall ? applicationOption?.identity : nil
+ if self.setupDraft.mode == .onlineCall, self.setupDraft.usesAutomaticApplication {
+ guard let target = self.appServices.meetingAutomaticTarget,
+ application?.bundleIdentifier == target.bundleIdentifier,
+ application?.processID == target.pid else { return nil }
+ application?.windowID = target.windowID
+ }
return MeetingCaptureConfiguration(
mode: self.setupDraft.mode,
@@ -927,6 +956,8 @@ struct MeetingTranscriptionView: View {
do {
try self.coordinator.resetForNewMeeting()
self.selectedHistorySessionID = nil
+ self.setupDraft.usesAutomaticApplication = true
+ self.selectPreferredApplication(from: self.applications.map(\.identity))
self.resetDraftTitleToDefault()
self.actionErrorMessage = nil
} catch {
@@ -949,18 +980,24 @@ struct MeetingTranscriptionView: View {
}
}
- private static var savedApplicationName: String? {
- let defaults = SettingsStore.shared.meetingRecordingDefaults
- guard defaults.isConfigured, let bundleIdentifier = defaults.applicationBundleIdentifier else { return nil }
- return defaults.applicationDisplayName ?? bundleIdentifier
- }
-
private func openMeetingSettings() {
+ self.setupDraft.autoDetectEnabled = SettingsStore.shared.meetingAutoDetectEnabled
+ self.setupDraft.browserDetectionEnabled = SettingsStore.shared.meetingAutoDetectBrowserEnabled
self.setupDraftBeforeEditing = self.setupDraft
self.draftMeetingAudioRetentionPolicy = SettingsStore.shared.meetingAudioRetentionPolicy
self.isShowingMeetingSettings = true
}
+ private func repairRecordingSetup() {
+ if self.readiness.showMicrophoneSettingsAction {
+ Self.openMicrophoneSettings()
+ } else if self.readiness.showScreenRecordingSettingsAction {
+ self.openScreenRecordingSettings()
+ } else {
+ self.openMeetingSettings()
+ }
+ }
+
private func cancelMeetingSettings() {
self.setupDraft = self.setupDraftBeforeEditing
self.draftMeetingAudioRetentionPolicy = SettingsStore.shared.meetingAudioRetentionPolicy
@@ -974,40 +1011,29 @@ struct MeetingTranscriptionView: View {
return
}
- // A settings-only change must not require the meeting app to be running:
- // fall back to the previously saved app; recording re-validates availability anyway.
- // The fallback never applies while the saved app IS running — a nil selection then
- // means the user deliberately deselected it.
+ // Automatic is session-scoped and never rewrites the user's legacy saved source.
+ // Source availability is checked again when recording starts.
let settings = SettingsStore.shared
let previousDefaults = settings.meetingRecordingDefaults
let application = self.applications.first(where: { $0.id == self.setupDraft.selectedApplicationID })
- var applicationBundleIdentifier = application?.identity.bundleIdentifier
- var applicationDisplayName = application?.identity.displayName
- if application == nil {
- let savedIsRunning = previousDefaults.applicationBundleIdentifier.map { saved in
- self.applications.contains { $0.identity.bundleIdentifier == saved }
- } ?? false
- if self.setupDraft.mode == .onlineCall,
- savedIsRunning || previousDefaults.applicationBundleIdentifier == nil
- {
- self.actionErrorMessage = "Choose an available meeting application before saving."
- return
- }
- applicationBundleIdentifier = previousDefaults.applicationBundleIdentifier
- applicationDisplayName = previousDefaults.applicationDisplayName
+ if self.setupDraft.mode == .onlineCall, !self.setupDraft.usesAutomaticApplication, application == nil {
+ self.actionErrorMessage = "Choose an available audio source or Automatic before saving."
+ return
}
settings.meetingRecordingDefaults = MeetingRecordingDefaults(
isConfigured: true,
mode: self.setupDraft.mode,
- applicationBundleIdentifier: applicationBundleIdentifier,
- applicationDisplayName: applicationDisplayName,
+ applicationBundleIdentifier: previousDefaults.applicationBundleIdentifier,
+ applicationDisplayName: previousDefaults.applicationDisplayName,
microphoneCaptureDeviceID: microphone.identity.captureDeviceID,
microphoneCoreAudioUID: microphone.identity.coreAudioUID,
microphoneRole: .unknown
)
let previousRetentionPolicy = settings.meetingAudioRetentionPolicy
+ settings.meetingAutoDetectEnabled = self.setupDraft.autoDetectEnabled
+ settings.meetingAutoDetectBrowserEnabled = self.setupDraft.browserDetectionEnabled
settings.meetingAudioRetentionPolicy = self.draftMeetingAudioRetentionPolicy
if previousRetentionPolicy != self.draftMeetingAudioRetentionPolicy {
Task { await self.coordinator.sweepExpiredAudio() }
@@ -1016,6 +1042,7 @@ struct MeetingTranscriptionView: View {
self.setupDraftBeforeEditing = self.setupDraft
self.actionErrorMessage = nil
self.isShowingMeetingSettings = false
+ self.selectPreferredApplication(from: self.applications.map(\.identity))
}
private func copyTranscript(_ session: MeetingSession, includeEchoes: Bool) {
@@ -1074,9 +1101,6 @@ struct MeetingTranscriptionView: View {
private func refreshCachedReadiness() {
self.cachedMicrophoneStatus = AVCaptureDevice.authorizationStatus(for: .audio)
self.cachedScreenCaptureAccess = CGPreflightScreenCaptureAccess()
- self.cachedModelReady = self.asrService.isAsrReady ||
- self.asrService.modelsExistOnDisk ||
- SettingsStore.shared.selectedSpeechModel.isInstalled
let storage = Self.storageReadiness(trackCount: MeetingPCMStoragePolicy.trackCount(for: self.setupDraft.mode))
self.cachedStorageStatus = storage.status
self.cachedStorageReady = storage.ready
@@ -1137,7 +1161,6 @@ struct MeetingTranscriptionCanvas: View {
let microphones: [MeetingMicrophoneOption]
let readiness: MeetingSetupReadiness
let errorMessage: String?
- let onRefreshSources: () -> Void
let onStart: () -> Void
let onStop: () -> Void
let onRetrySession: (MeetingSession) -> Void
@@ -1154,7 +1177,7 @@ struct MeetingTranscriptionCanvas: View {
let onAssignSpeakers: (MeetingSessionID, [SessionSpeakerID: String]) async -> String?
let canUndoCorrection: (MeetingSessionID) -> Bool
let isQuiescent: Bool
- let onOpenMeetingSettings: () -> Void
+ let onRepairSetup: () -> Void
let isRetrying: Bool
let onCloseSelection: (() -> Void)?
@@ -1164,7 +1187,7 @@ struct MeetingTranscriptionCanvas: View {
/// its transcript list is its own scroller, and nested scrolling would fight it.
private var fillsCanvasHeight: Bool {
switch self.state {
- case .recording, .stopping: true
+ case .recording, .stopping, .result: true
default: false
}
}
@@ -1173,7 +1196,7 @@ struct MeetingTranscriptionCanvas: View {
Group {
if self.fillsCanvasHeight {
self.canvasContent
- .frame(maxWidth: 820)
+ .frame(maxWidth: AppTheme.Metrics.Showcase.pageMaxWidth)
.padding(self.theme.metrics.spacing.xxl)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
} else {
@@ -1191,75 +1214,74 @@ struct MeetingTranscriptionCanvas: View {
@ViewBuilder
private var canvasContent: some View {
- Group {
- switch self.state {
- case let .setup(isStarting, recentSession):
- MeetingSetupCanvas(
- draft: self.$setupDraft,
- applications: self.applications,
- microphones: self.microphones,
- readiness: self.readiness,
- isStarting: isStarting,
- errorMessage: self.errorMessage,
- recentSession: recentSession,
- onRefreshSources: self.onRefreshSources,
- onStart: self.onStart,
- onOpenMeetingSettings: self.onOpenMeetingSettings
- )
- case let .recording(session, trackHealth, liveTranscript):
- MeetingRecordingCanvas(
- session: session,
- trackHealth: trackHealth,
- liveTranscript: liveTranscript,
- isStopping: false,
- onStop: self.onStop
- )
- case let .stopping(session, trackHealth, liveTranscript):
- MeetingRecordingCanvas(
- session: session,
- trackHealth: trackHealth,
- liveTranscript: liveTranscript,
- isStopping: true,
- onStop: self.onStop
- )
- case let .processing(session, stage):
- MeetingProcessingCanvas(session: session, stage: stage)
- case let .result(session):
- MeetingResultCanvas(
- session: session,
- isQuiescent: self.isQuiescent,
- canUndo: self.canUndoCorrection(session.id),
- onCopyTranscript: self.onCopyTranscript,
- onExportTranscript: self.onExportTranscript,
- onReassignSegment: { segmentID, speakerID in
- self.onReassignSegment(session.id, segmentID, speakerID)
- },
- onNameUnknownSegment: { segmentID, name in
- self.onNameUnknownSegment(session.id, segmentID, name)
- },
- onRenameSpeaker: { speakerID, name in
- self.onRenameSpeaker(session.id, speakerID, name)
- },
- onMergeSpeakers: { source, target in
- self.onMergeSpeakers(session.id, source, target)
- },
- onUndo: { self.onUndoCorrection(session.id) },
- onRenameSession: { title in self.onRenameSession(session.id, title) },
- onAssignSpeakers: { names in await self.onAssignSpeakers(session.id, names) },
- onClose: self.onCloseSelection
- )
- case let .failed(session, message):
- MeetingFailureCanvas(
- session: session,
- message: self.errorMessage ?? message,
- isRetrying: self.isRetrying,
- onRetrySession: self.onRetrySession,
- onRevealAudio: self.onRevealAudio,
- onRecordAgain: self.onRecordAgain,
- onClose: self.onCloseSelection
- )
- }
+ Group {
+ switch self.state {
+ case let .setup(isStarting, recentSession):
+ MeetingSetupCanvas(
+ draft: self.$setupDraft,
+ applications: self.applications,
+ microphones: self.microphones,
+ readiness: self.readiness,
+ isStarting: isStarting,
+ errorMessage: self.errorMessage,
+ recentSession: recentSession,
+ onStart: self.onStart,
+ onRepairSetup: self.onRepairSetup
+ )
+ case let .recording(session, trackHealth, liveTranscript):
+ MeetingRecordingCanvas(
+ session: session,
+ trackHealth: trackHealth,
+ liveTranscript: liveTranscript,
+ isStopping: false,
+ onStop: self.onStop
+ )
+ case let .stopping(session, trackHealth, liveTranscript):
+ MeetingRecordingCanvas(
+ session: session,
+ trackHealth: trackHealth,
+ liveTranscript: liveTranscript,
+ isStopping: true,
+ onStop: self.onStop
+ )
+ case let .processing(session, stage):
+ MeetingProcessingCanvas(session: session, stage: stage)
+ case let .result(session):
+ MeetingResultCanvas(
+ session: session,
+ isQuiescent: self.isQuiescent,
+ canUndo: self.canUndoCorrection(session.id),
+ onCopyTranscript: self.onCopyTranscript,
+ onExportTranscript: self.onExportTranscript,
+ onReassignSegment: { segmentID, speakerID in
+ self.onReassignSegment(session.id, segmentID, speakerID)
+ },
+ onNameUnknownSegment: { segmentID, name in
+ self.onNameUnknownSegment(session.id, segmentID, name)
+ },
+ onRenameSpeaker: { speakerID, name in
+ self.onRenameSpeaker(session.id, speakerID, name)
+ },
+ onMergeSpeakers: { source, target in
+ self.onMergeSpeakers(session.id, source, target)
+ },
+ onUndo: { self.onUndoCorrection(session.id) },
+ onRenameSession: { title in self.onRenameSession(session.id, title) },
+ onAssignSpeakers: { names in await self.onAssignSpeakers(session.id, names) },
+ onClose: self.onCloseSelection
+ )
+ case let .failed(session, message):
+ MeetingFailureCanvas(
+ session: session,
+ message: self.errorMessage ?? message,
+ isRetrying: self.isRetrying,
+ onRetrySession: self.onRetrySession,
+ onRevealAudio: self.onRevealAudio,
+ onRecordAgain: self.onRecordAgain,
+ onClose: self.onCloseSelection
+ )
}
+ }
}
}
@@ -1274,13 +1296,18 @@ private struct MeetingTranscriptionHeader: View {
var body: some View {
HStack(spacing: self.theme.metrics.spacing.md) {
- Image(systemName: "person.2.wave.2.fill")
+ Image(systemName: "note.text")
.font(self.theme.typography.titleIcon)
.foregroundStyle(self.theme.palette.accent)
- Text("Meeting Transcription")
- .font(self.theme.typography.title)
- .foregroundStyle(self.theme.palette.primaryText)
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
+ Text("Fluid Notes")
+ .font(self.theme.typography.title)
+ .foregroundStyle(self.theme.palette.primaryText)
+ Text("Your conversations, kept close.")
+ .font(self.theme.typography.caption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ }
Spacer()
@@ -1297,9 +1324,10 @@ private struct MeetingTranscriptionHeader: View {
MeetingHeaderIconButton(
systemImage: "gearshape",
- label: "Meeting Settings",
+ label: "Fluid Notes settings",
action: self.onOpenMeetingSettings
)
+ .disabled(!self.canEditSetup)
.accessibilityHint("Change the saved recording application, microphone, and meeting defaults")
MeetingHeaderIconButton(
@@ -1324,6 +1352,14 @@ private struct MeetingTranscriptionHeader: View {
return false
}
}
+
+ private var canEditSetup: Bool {
+ switch self.state {
+ case let .setup(isStarting, _): !isStarting
+ case .result, .failed: true
+ case .recording, .stopping, .processing: false
+ }
+ }
}
private struct MeetingHeaderIconButton: View {
@@ -1333,38 +1369,15 @@ private struct MeetingHeaderIconButton: View {
let action: () -> Void
@Environment(\.theme) private var theme
- @State private var isHovered = false
-
var body: some View {
Button(action: self.action) {
Image(systemName: self.systemImage)
- .font(.fluidSystem(size: 14, weight: .semibold))
.foregroundStyle(self.isSelected ? self.theme.palette.accent : self.theme.palette.primaryText)
- .frame(width: 32, height: 30)
- .background(self.backgroundColor, in: RoundedRectangle(
- cornerRadius: self.theme.metrics.corners.md,
- style: .continuous
- ))
- .overlay {
- RoundedRectangle(cornerRadius: self.theme.metrics.corners.md, style: .continuous)
- .stroke(self.theme.palette.separator.opacity(0.55), lineWidth: 1)
- }
}
- .buttonStyle(.plain)
- .contentShape(RoundedRectangle(cornerRadius: self.theme.metrics.corners.md, style: .continuous))
- .onHover { self.isHovered = $0 }
+ .fluidGlassAction(circular: true)
.help(self.label)
.accessibilityLabel(self.label)
- }
-
- private var backgroundColor: Color {
- if self.isSelected {
- return self.theme.palette.accent.opacity(0.14)
- }
- if self.isHovered {
- return self.theme.palette.contentBackground.opacity(0.9)
- }
- return self.theme.palette.contentBackground.opacity(0.55)
+ .accessibilityAddTraits(self.isSelected ? .isSelected : [])
}
}
@@ -1420,7 +1433,7 @@ private struct MeetingHistoryInspector: View {
var body: some View {
VStack(spacing: 0) {
HStack(spacing: self.theme.metrics.spacing.sm) {
- Text("Meetings")
+ Text("Your meetings")
.font(self.theme.typography.sectionTitle)
Text("\(self.sessions.count)")
.font(self.theme.typography.badge)
@@ -1437,10 +1450,14 @@ private struct MeetingHistoryInspector: View {
.padding(.top, self.theme.metrics.spacing.lg)
.padding(.bottom, self.theme.metrics.spacing.md)
- TextField("Search meetings", text: self.$searchText)
- .textFieldStyle(.roundedBorder)
- .padding(.horizontal, self.theme.metrics.spacing.lg)
- .padding(.bottom, self.theme.metrics.spacing.md)
+ HStack(spacing: self.theme.metrics.spacing.sm) {
+ Image(systemName: "magnifyingglass").foregroundStyle(.secondary)
+ TextField("Search meetings", text: self.$searchText).textFieldStyle(.plain)
+ }
+ .padding(self.theme.metrics.spacing.md)
+ .fluidDropdownSurface()
+ .padding(.horizontal, self.theme.metrics.spacing.lg)
+ .padding(.bottom, self.theme.metrics.spacing.md)
Divider()
@@ -1462,51 +1479,51 @@ private struct MeetingHistoryInspector: View {
// Rows draw their own selection/hover fill (never the saturated system blue),
// so a plain ScrollView replaces List here instead of fighting its native highlight.
ScrollViewReader { proxy in
- ScrollView {
- LazyVStack(alignment: .leading, spacing: 2, pinnedViews: [.sectionHeaders]) {
- ForEach(self.groupedSessions, id: \.key) { group in
- Section {
- ForEach(group.sessions) { session in
- MeetingHistoryRow(
- session: session,
- isSelected: self.selectedSessionID == session.id,
- isQuiescent: self.isQuiescent,
- onRetry: { self.onRetry(session.id) },
- onRecordAgain: { self.onRecordAgain(session) }
- )
- .id(session.id)
- .onTapGesture { self.selectedSessionID = session.id }
- .contextMenu { self.contextMenu(for: session) }
+ ScrollView {
+ LazyVStack(alignment: .leading, spacing: 2, pinnedViews: [.sectionHeaders]) {
+ ForEach(self.groupedSessions, id: \.key) { group in
+ Section {
+ ForEach(group.sessions) { session in
+ MeetingHistoryRow(
+ session: session,
+ isSelected: self.selectedSessionID == session.id,
+ isQuiescent: self.isQuiescent,
+ onRetry: { self.onRetry(session.id) },
+ onRecordAgain: { self.onRecordAgain(session) }
+ )
+ .id(session.id)
+ .onTapGesture { self.selectedSessionID = session.id }
+ .contextMenu { self.contextMenu(for: session) }
+ }
+ } header: {
+ Text(group.key)
+ .font(self.theme.typography.captionSmall)
+ .tracking(1.1)
+ .textCase(.uppercase)
+ .foregroundStyle(self.theme.palette.tertiaryText)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, self.theme.metrics.spacing.lg)
+ .padding(.top, self.theme.metrics.spacing.md)
+ .padding(.bottom, self.theme.metrics.spacing.xs)
+ .background(self.theme.palette.elevatedCardBackground)
}
- } header: {
- Text(group.key)
- .font(self.theme.typography.captionSmall)
- .tracking(1.1)
- .textCase(.uppercase)
- .foregroundStyle(self.theme.palette.tertiaryText)
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.horizontal, self.theme.metrics.spacing.lg)
- .padding(.top, self.theme.metrics.spacing.md)
- .padding(.bottom, self.theme.metrics.spacing.xs)
- .background(self.theme.palette.sidebarBackground)
}
}
+ .padding(.horizontal, self.theme.metrics.spacing.sm)
+ .padding(.bottom, self.theme.metrics.spacing.md)
+ }
+ // Dropping List for a custom highlight also drops its arrow-key traversal.
+ .focusable()
+ .onMoveCommand { direction in
+ guard let moved = self.sessionID(movingFrom: self.selectedSessionID, direction: direction)
+ else { return }
+ self.selectedSessionID = moved
+ withAnimation(.easeOut(duration: 0.12)) { proxy.scrollTo(moved, anchor: .center) }
}
- .padding(.horizontal, self.theme.metrics.spacing.sm)
- .padding(.bottom, self.theme.metrics.spacing.md)
- }
- // Dropping List for a custom highlight also drops its arrow-key traversal.
- .focusable()
- .onMoveCommand { direction in
- guard let moved = self.sessionID(movingFrom: self.selectedSessionID, direction: direction)
- else { return }
- self.selectedSessionID = moved
- withAnimation(.easeOut(duration: 0.12)) { proxy.scrollTo(moved, anchor: .center) }
- }
}
}
}
- .background(self.theme.palette.sidebarBackground)
+ .background(self.theme.materials.sidebar)
}
private func sessionID(
@@ -1607,15 +1624,7 @@ private struct MeetingHistoryRow: View {
}
private var tile: some View {
- Image(systemName: self.tileIcon)
- .font(.fluidSystem(size: 14, weight: .medium))
- .foregroundStyle(self.tileIconColor)
- .frame(width: 34, height: 34)
- .background(self.theme.palette.contentBackground, in: RoundedRectangle(
- cornerRadius: self.theme.metrics.corners.md,
- style: .continuous
- ))
- .accessibilityHidden(true)
+ FluidIconTile(icon: self.tileIcon, tint: self.tileIconColor, size: 44)
}
@ViewBuilder
@@ -1745,7 +1754,6 @@ private struct MeetingHistoryRow: View {
private struct MeetingRecordingSettingsSheet: View {
@Binding var draft: MeetingTranscriptionSetupDraft
@Binding var retentionPolicy: MeetingAudioRetentionPolicy
- @ObservedObject private var settings = SettingsStore.shared
@ObservedObject private var dismissalAdvisor = MeetingAutoDetectDismissalAdvisor.shared
@ObservedObject private var appServices = AppServices.shared
@@ -1753,8 +1761,6 @@ private struct MeetingRecordingSettingsSheet: View {
let microphones: [MeetingMicrophoneOption]
let readiness: MeetingSetupReadiness
let isFirstSetup: Bool
- let savedApplicationName: String?
- let savedApplicationBundleIdentifier: String?
let onRefreshSources: () -> Void
let onOpenMicrophoneSettings: @MainActor @Sendable () -> Void
let onOpenScreenRecordingSettings: @MainActor @Sendable () -> Void
@@ -1764,30 +1770,18 @@ private struct MeetingRecordingSettingsSheet: View {
@Environment(\.theme) private var theme
- private var savedApplicationIsRunning: Bool {
- guard let savedApplicationBundleIdentifier else { return false }
- return self.applications.contains { $0.identity.bundleIdentifier == savedApplicationBundleIdentifier }
- }
-
- private var usesSavedApplicationFallback: Bool {
- self.draft.mode == .onlineCall
- && self.draft.selectedApplicationID == nil
- && self.savedApplicationName != nil
- && !self.savedApplicationIsRunning
- }
-
private var canSave: Bool {
guard self.draft.selectedMicrophoneID != nil else { return false }
return self.draft.mode == .inRoom
+ || self.draft.usesAutomaticApplication
|| self.draft.selectedApplicationID != nil
- || self.usesSavedApplicationFallback
}
private var separationDescription: String {
if !CPUArchitecture.isAppleSilicon {
return "Plain transcript on Intel"
}
- return self.readiness.modelReady ? "Automatic after Stop" : "Prepares after Stop"
+ return self.readiness.modelReady ? "Automatic after Stop" : "Load supplied model below"
}
private var saveHelp: String? {
@@ -1809,9 +1803,9 @@ private struct MeetingRecordingSettingsSheet: View {
.foregroundStyle(self.theme.palette.accent)
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
- Text(self.isFirstSetup ? "Set up meeting recording" : "Meeting Settings")
+ Text(self.isFirstSetup ? "Set up Fluid Notes" : "Fluid Notes settings")
.font(self.theme.typography.title)
- Text("Saved for future meetings until you change it.")
+ Text("Set recording defaults and choose this meeting’s audio source.")
.font(self.theme.typography.bodySmall)
.foregroundStyle(self.theme.palette.secondaryText)
}
@@ -1824,19 +1818,22 @@ private struct MeetingRecordingSettingsSheet: View {
ScrollView {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.lg) {
- ThemedCard(style: .subtle, padding: 0) {
+ FluidManagementGroup(title: "Recording") {
VStack(spacing: 0) {
MeetingAdaptiveSetupRow(
title: "Meeting type",
detail: "Choose the setup you use most often."
) {
- Picker("Meeting type", selection: self.$draft.mode) {
- Text("Online call").tag(MeetingCaptureMode.onlineCall)
- Text("In-room").tag(MeetingCaptureMode.inRoom)
+ Menu {
+ Picker("Meeting type", selection: self.$draft.mode) {
+ Text("Online call").tag(MeetingCaptureMode.onlineCall)
+ Text("In-room").tag(MeetingCaptureMode.inRoom)
+ }
+ .pickerStyle(.inline)
+ } label: {
+ Text(self.draft.mode == .onlineCall ? "Online call" : "In-room")
}
- .pickerStyle(.segmented)
- .labelsHidden()
- .frame(width: 320, alignment: .trailing)
+ .fluidDropdownStyle(fillsWidth: true)
.accessibilityLabel("Default meeting type")
}
@@ -1844,34 +1841,43 @@ private struct MeetingRecordingSettingsSheet: View {
Divider()
MeetingAdaptiveSetupRow(
title: "Meeting audio",
- detail: self.usesSavedApplicationFallback
- ? "\(self.savedApplicationName ?? "Your saved app") is saved but not running — it will be captured next time it's open."
- : "FluidVoice records audio from this application."
+ detail: "Automatic uses the detected meeting. You can also choose an audio source for this meeting."
) {
- Picker("Meeting audio", selection: self.$draft.selectedApplicationID) {
- Text(self.usesSavedApplicationFallback
- ? "\(self.savedApplicationName ?? "Saved app") (not running)"
- : "Choose application…").tag(String?.none)
- ForEach(self.applications) { option in
- Text(option.identity.displayName).tag(Optional(option.id))
+ Menu {
+ Picker("Meeting audio", selection: Binding(
+ get: { self.draft.usesAutomaticApplication ? nil : self.draft.selectedApplicationID },
+ set: {
+ self.draft.usesAutomaticApplication = $0 == nil
+ self.draft.selectedApplicationID = $0
+ }
+ )) {
+ Text("Automatic").tag(String?.none)
+ ForEach(self.applications) { option in
+ Text(option.identity.displayName).tag(Optional(option.id))
+ }
}
+ .pickerStyle(.inline)
+ } label: {
+ Text(self.draft.usesAutomaticApplication ? "Automatic" :
+ (self.applications.first(where: { $0.id == self.draft.selectedApplicationID })?.identity.displayName ?? "Source unavailable"))
}
- .labelsHidden()
- .frame(width: 320, alignment: .trailing)
- .accessibilityLabel("Default meeting application")
+ .fluidDropdownStyle(fillsWidth: true)
+ .accessibilityLabel("Meeting audio source")
}
}
- if self.settings.meetingAutoDetectEnabled,
- self.appServices.meetingAutoDetectHealth == .zoomWindowTitleUnreadable {
+ if self.draft.autoDetectEnabled,
+ self.appServices.meetingAutoDetectHealth == .zoomWindowTitleUnreadable
+ {
MeetingAdaptiveSetupRow(
title: "Zoom window access needs repair",
- detail: "Screen Recording or Accessibility access is preventing FluidVoice from reading Zoom meeting windows. Recording has not started.") {
- Button("Open Screen Recording Settings") {
- self.onOpenScreenRecordingSettings()
- }
- .fluidButton(.compact, size: .small)
+ detail: "Screen Recording or Accessibility access is preventing FluidVoice from reading Zoom meeting windows. Recording has not started."
+ ) {
+ Button("Open Screen Recording Settings") {
+ self.onOpenScreenRecordingSettings()
}
+ .fluidButton(.compact, size: .small)
+ }
}
Divider()
@@ -1879,14 +1885,18 @@ private struct MeetingRecordingSettingsSheet: View {
title: "Microphone",
detail: "Used for your voice and in-room meetings."
) {
- Picker("Microphone", selection: self.$draft.selectedMicrophoneID) {
- Text("Choose microphone…").tag(String?.none)
- ForEach(self.microphones) { option in
- Text(option.identity.displayName).tag(Optional(option.id))
+ Menu {
+ Picker("Microphone", selection: self.$draft.selectedMicrophoneID) {
+ Text("Choose microphone…").tag(String?.none)
+ ForEach(self.microphones) { option in
+ Text(option.identity.displayName).tag(Optional(option.id))
+ }
}
+ .pickerStyle(.inline)
+ } label: {
+ Text(self.microphones.first(where: { $0.id == self.draft.selectedMicrophoneID })?.identity.displayName ?? "Choose microphone…")
}
- .labelsHidden()
- .frame(width: 320, alignment: .trailing)
+ .fluidDropdownStyle(fillsWidth: true)
.accessibilityLabel("Default meeting microphone")
}
@@ -1903,48 +1913,60 @@ private struct MeetingRecordingSettingsSheet: View {
.font(self.theme.typography.bodyStrong)
.frame(maxWidth: .infinity, alignment: .leading)
}
-
- Divider()
+ }
+ }
+ FluidManagementGroup(title: "Storage & detection") {
+ VStack(spacing: 0) {
MeetingAdaptiveSetupRow(
title: "Keep audio",
detail: "Applies to all recordings, including past ones. Audio is deleted only "
+ "while FluidVoice is running; transcripts are always kept."
) {
- Picker("Keep audio", selection: self.$retentionPolicy) {
- ForEach(MeetingAudioRetentionPolicy.allCases, id: \.self) { policy in
- Text(policy.displayName).tag(policy)
+ Menu {
+ Picker("Keep audio", selection: self.$retentionPolicy) {
+ ForEach(MeetingAudioRetentionPolicy.allCases, id: \.self) { policy in
+ Text(policy.displayName).tag(policy)
+ }
}
+ .pickerStyle(.inline)
+ } label: {
+ Text(self.retentionPolicy.displayName)
}
- .labelsHidden()
- .frame(width: 320, alignment: .trailing)
+ .fluidDropdownStyle(fillsWidth: true)
.accessibilityLabel("Audio retention")
}
Divider()
MeetingAdaptiveSetupRow(
title: "Detect meetings automatically",
- detail: "Shows a \"Meeting detected\" prompt for Zoom, Teams, and Webex. Never starts recording on its own."
+ detail: "Shows a \"Meeting detected\" prompt for Zoom, Teams, and Webex. Never starts recording on its own.",
+ trailingSwitch: true
) {
- Toggle("", isOn: self.$settings.meetingAutoDetectEnabled)
+ Toggle("", isOn: self.$draft.autoDetectEnabled)
.labelsHidden()
.toggleStyle(.switch)
+ .accessibilityLabel("Detect meetings automatically")
}
- if self.settings.meetingAutoDetectEnabled {
+ if self.draft.autoDetectEnabled {
Divider()
MeetingAdaptiveSetupRow(
title: "Also check browser tabs",
detail: "Checks the address of the frontmost browser tab against a fixed list of meeting "
- + "sites (Google Meet, Zoom, Teams, Whereby, Jitsi). Nothing is stored or sent."
+ + "sites (Google Meet, Zoom, Teams, Whereby, Jitsi). Nothing is stored or sent.",
+ trailingSwitch: true
) {
- Toggle("", isOn: self.$settings.meetingAutoDetectBrowserEnabled)
+ Toggle("", isOn: self.$draft.browserDetectionEnabled)
.labelsHidden()
.toggleStyle(.switch)
+ .accessibilityLabel("Also check browser tabs")
}
}
}
}
+ MeetingModelSettingsSection()
+
if self.dismissalAdvisor.shouldSuggest {
ThemedCard(style: .subtle, padding: self.theme.metrics.spacing.md) {
HStack(spacing: self.theme.metrics.spacing.md) {
@@ -1955,8 +1977,8 @@ private struct MeetingRecordingSettingsSheet: View {
.font(self.theme.typography.bodySmall)
Spacer()
Button("Turn Off") {
- self.settings.meetingAutoDetectEnabled = false
- self.settings.meetingAutoDetectBrowserEnabled = false
+ self.draft.autoDetectEnabled = false
+ self.draft.browserDetectionEnabled = false
self.dismissalAdvisor.shouldSuggest = false
}
.fluidButton(.compact, size: .small)
@@ -1994,24 +2016,24 @@ private struct MeetingRecordingSettingsSheet: View {
HStack(spacing: self.theme.metrics.spacing.md) {
Button(self.isFirstSetup ? "Not Now" : "Cancel", action: self.onCancel)
- .fluidButton(.compact, size: .medium)
+ .fluidGlassAction(spacious: true)
.keyboardShortcut(.cancelAction)
Spacer()
Button(self.readiness.isCheckingSources ? "Refreshing…" : "Refresh Sources", systemImage: "arrow.clockwise") {
self.onRefreshSources()
}
- .fluidButton(.compact, size: .medium)
+ .fluidGlassAction(spacious: true)
.disabled(self.readiness.isCheckingSources)
Button(self.isFirstSetup ? "Save Setup" : "Save Changes", action: self.onSave)
- .fluidButton(.accent, size: .medium)
+ .fluidGlassAction(prominent: true, spacious: true)
.disabled(!self.canSave)
.keyboardShortcut(.defaultAction)
}
.padding(self.theme.metrics.spacing.lg)
}
- .frame(minWidth: 560, idealWidth: 720, maxWidth: 720)
- .frame(minHeight: 540, idealHeight: 620)
+ .frame(width: 720)
+ .frame(minHeight: 540, idealHeight: 700)
.background(self.theme.palette.windowBackground)
}
@@ -2029,10 +2051,6 @@ private struct MeetingRecordingSettingsSheet: View {
)
.fluidButton(.compact, size: .small)
}
- if !self.readiness.modelReady {
- Button("Voice Engine", systemImage: "waveform", action: self.onOpenVoiceEngine)
- .fluidButton(.compact, size: .small)
- }
}
}
@@ -2045,9 +2063,8 @@ private struct MeetingSetupCanvas: View {
let isStarting: Bool
let errorMessage: String?
let recentSession: MeetingSession?
- let onRefreshSources: () -> Void
let onStart: () -> Void
- let onOpenMeetingSettings: () -> Void
+ let onRepairSetup: () -> Void
@Environment(\.theme) private var theme
@@ -2056,6 +2073,7 @@ private struct MeetingSetupCanvas: View {
self.readiness.microphoneReady &&
self.readiness.storageReady &&
self.readiness.activityReady &&
+ self.readiness.modelReady &&
(self.draft.mode == .inRoom || self.readiness.meetingAudioReady)
}
@@ -2069,15 +2087,27 @@ private struct MeetingSetupCanvas: View {
return self.draft.mode == .inRoom || self.draft.selectedApplicationID != nil
}
+ private var waitingForMeeting: Bool {
+ self.draft.usesAutomaticApplication && self.draft.autoDetectEnabled &&
+ self.draft.mode == .onlineCall && self.draft.selectedApplicationID == nil &&
+ self.draft.selectedMicrophoneID != nil && self.requiredSystemsReady
+ }
+
private var startHelp: String? {
if let blockingMessage = readiness.blockingMessage, !self.requiredSystemsReady {
return blockingMessage
}
if self.draft.selectedMicrophoneID == nil {
- return "Choose a microphone to continue."
+ return "Choose a microphone in Settings to continue."
}
if self.draft.mode == .onlineCall, self.draft.selectedApplicationID == nil {
- return "Choose the application playing meeting audio."
+ if self.waitingForMeeting {
+ return "Join a supported meeting. Its audio source will be detected automatically."
+ }
+ if self.draft.usesAutomaticApplication, !self.draft.autoDetectEnabled {
+ return "Meeting detection is off. Enable it in Settings, or choose a source manually."
+ }
+ return "Open your meeting app, or choose an audio source in Settings."
}
if self.draft.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
return "Add a title for this meeting."
@@ -2096,100 +2126,67 @@ private struct MeetingSetupCanvas: View {
private var microphoneName: String {
self.microphones.first(where: { $0.id == self.draft.selectedMicrophoneID })?.identity.displayName
- ?? "Choose microphone"
- }
-
- private var setupSummary: String {
- [self.applicationName, self.microphoneName]
- .compactMap { $0 }
- .joined(separator: " · ")
+ ?? "No microphone selected"
}
var body: some View {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xl) {
- ThemedCard(style: .subtle, padding: 0) {
- VStack(spacing: 0) {
- ViewThatFits(in: .horizontal) {
- HStack(alignment: .center, spacing: self.theme.metrics.spacing.lg) {
- VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
- Text(self.modeName)
- .font(self.theme.typography.sectionTitle)
- .foregroundStyle(self.theme.palette.primaryText)
- Text(self.setupSummary)
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.theme.palette.secondaryText)
- .lineLimit(1)
- .truncationMode(.middle)
- }
- Spacer(minLength: self.theme.metrics.spacing.lg)
- Button("Edit setup…", systemImage: "slider.horizontal.3", action: self.onOpenMeetingSettings)
- .fluidButton(.compact, size: .small)
- }
-
- VStack(alignment: .leading, spacing: self.theme.metrics.spacing.md) {
- VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
- Text(self.modeName)
- .font(self.theme.typography.sectionTitle)
- Text(self.setupSummary)
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.theme.palette.secondaryText)
- }
- Button("Edit setup…", systemImage: "slider.horizontal.3", action: self.onOpenMeetingSettings)
- .fluidButton(.compact, size: .small)
+ Text("Ready for your next conversation.")
+ .font(.fluidSystem(size: 30, weight: .regular, design: .serif))
+ .fixedSize(horizontal: false, vertical: true)
+ .accessibilityAddTraits(.isHeader)
+
+ ThemedCard(style: .standard, padding: self.theme.metrics.spacing.xxl) {
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xl) {
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
+ HStack {
+ Text("Meeting title").font(self.theme.typography.caption).foregroundStyle(.secondary)
+ Spacer()
+ Label(self.modeName, systemImage: self.draft.mode == .onlineCall ? "video" : "person.2")
+ .font(self.theme.typography.captionStrong)
+ .foregroundStyle(self.theme.palette.secondaryText)
}
- }
- .padding(.horizontal, self.theme.metrics.spacing.lg)
- .padding(.vertical, self.theme.metrics.spacing.md)
- .accessibilityElement(children: .contain)
-
- Divider()
-
- MeetingAdaptiveSetupRow(title: "Meeting title") {
- // A plain $draft.title binding can't tell a user keystroke apart from
- // the programmatic default-title regeneration, so route edits through here.
TextField("Meeting title", text: Binding(
get: { self.draft.title },
- set: { newValue in
- self.draft.title = newValue
- self.draft.titleWasEdited = true
- }
+ set: { self.draft.title = $0; self.draft.titleWasEdited = true }
))
- .textFieldStyle(.roundedBorder)
+ .textFieldStyle(.plain)
+ .font(self.theme.typography.sectionTitle)
+ .padding(self.theme.metrics.spacing.md)
+ .fluidDropdownSurface()
.accessibilityLabel("Meeting title")
+ .disabled(self.isStarting)
}
- Divider()
-
+ if self.draft.mode == .onlineCall {
+ self.sourceRow(
+ "Meeting audio",
+ value: self.draft.usesAutomaticApplication
+ ? "Automatic · \(self.applicationName ?? "No meeting detected")"
+ : (self.applicationName ?? "Source unavailable"),
+ icon: "macwindow"
+ )
+ }
+ self.sourceRow("Microphone", value: self.microphoneName, icon: "mic")
+ Divider().opacity(0.4)
+ MeetingReadyStatus(
+ isReady: self.canStart,
+ isWaiting: self.waitingForMeeting,
+ title: self.readiness.isCheckingSources ? "Checking recording setup…" :
+ (self.canStart ? "Ready to record" : (self.waitingForMeeting ? "Waiting for a meeting" : "Setup needs attention")),
+ detail: self.canStart ? "English · \(self.readiness.storageStatus)" : (self.startHelp ?? "Check the recording setup.")
+ )
ViewThatFits(in: .horizontal) {
- HStack(spacing: self.theme.metrics.spacing.md) {
- MeetingReadyStatus(
- isReady: self.canStart,
- title: self.canStart ? "Ready to record" : "Setup needs attention",
- detail: self.canStart
- ? "English · \(self.readiness.storageStatus)"
- : (self.startHelp ?? "Check the recording setup.")
- )
- Spacer(minLength: self.theme.metrics.spacing.md)
- Button("Refresh", systemImage: "arrow.clockwise", action: self.onRefreshSources)
- .fluidButton(.compact, size: .small)
- .disabled(self.readiness.isCheckingSources || self.isStarting)
+ HStack(spacing: self.theme.metrics.spacing.lg) {
+ self.permissionAction
+ Spacer(minLength: self.theme.metrics.spacing.lg)
+ self.startAction
}
-
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.md) {
- MeetingReadyStatus(
- isReady: self.canStart,
- title: self.canStart ? "Ready to record" : "Setup needs attention",
- detail: self.canStart
- ? "English · \(self.readiness.storageStatus)"
- : (self.startHelp ?? "Check the recording setup.")
- )
- Button("Refresh", systemImage: "arrow.clockwise", action: self.onRefreshSources)
- .fluidButton(.compact, size: .small)
- .disabled(self.readiness.isCheckingSources || self.isStarting)
+ self.permissionAction
+ self.startAction.frame(maxWidth: .infinity, alignment: .trailing)
}
}
- .padding(.horizontal, self.theme.metrics.spacing.lg)
- .padding(.vertical, self.theme.metrics.spacing.md)
}
}
@@ -2213,24 +2210,6 @@ private struct MeetingSetupCanvas: View {
.accessibilityLabel("Could not start recording. \(errorMessage)")
}
- HStack {
- Spacer()
- Button(action: self.onStart) {
- if self.isStarting {
- HStack(spacing: self.theme.metrics.spacing.sm) {
- ProgressView()
- .controlSize(.small)
- Text("Starting…")
- }
- } else {
- Label("Start recording", systemImage: "record.circle")
- }
- }
- .fluidButton(.accent, size: .medium)
- .disabled(!self.canStart || self.isStarting)
- .keyboardShortcut(.defaultAction)
- }
-
if let recentSession {
Divider()
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
@@ -2258,6 +2237,47 @@ private struct MeetingSetupCanvas: View {
}
}
}
+ .padding(.top, self.theme.metrics.spacing.xl)
+ }
+
+ private func sourceRow(_ title: String, value: String, icon: String) -> some View {
+ HStack(spacing: self.theme.metrics.spacing.lg) {
+ FluidIconTile(icon: icon, tint: self.theme.palette.accent, size: 44)
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
+ Text(title).font(self.theme.typography.bodyStrong).foregroundStyle(self.theme.palette.primaryText)
+ Text(value).font(self.theme.typography.bodySmall).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)
+ }
+ Spacer(minLength: 0)
+ }
+ .padding(.vertical, self.theme.metrics.spacing.sm)
+ .accessibilityElement(children: .combine)
+ }
+
+ @ViewBuilder private var permissionAction: some View {
+ if !self.canStart, !self.readiness.isCheckingSources,
+ self.readiness.showMicrophoneSettingsAction || self.readiness.showScreenRecordingSettingsAction ||
+ !self.readiness.modelReady ||
+ (self.draft.mode == .onlineCall && self.draft.selectedApplicationID == nil)
+ {
+ Button(
+ self.readiness.showMicrophoneSettingsAction ? "Allow microphone access" :
+ (self.readiness.showScreenRecordingSettingsAction ? "Allow meeting audio access" :
+ (!self.readiness.modelReady ? "Load speaker model…" : "Choose source manually…")),
+ systemImage: self.readiness.showMicrophoneSettingsAction || self.readiness.showScreenRecordingSettingsAction ? "arrow.up.right" : "gearshape",
+ action: self.onRepairSetup
+ )
+ .fluidGlassAction(spacious: true)
+ .disabled(self.isStarting)
+ }
+ }
+
+ private var startAction: some View {
+ Button(action: self.onStart) {
+ Label(self.isStarting ? "Starting…" : "Start recording", systemImage: self.isStarting ? "hourglass" : "record.circle")
+ }
+ .fluidGlassAction(prominent: true, spacious: true)
+ .disabled(!self.canStart || self.isStarting)
+ .keyboardShortcut(.defaultAction)
}
private static func durationText(_ duration: TimeInterval) -> String {
@@ -2277,6 +2297,9 @@ private struct MeetingRecordingCanvas: View {
var body: some View {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xl) {
+ Text(self.session.title)
+ .font(self.theme.typography.title)
+ .lineLimit(2)
TimelineView(.periodic(from: .now, by: 1)) { context in
HStack {
Label(
@@ -2305,28 +2328,21 @@ private struct MeetingRecordingCanvas: View {
)
}
- ThemedCard(style: .prominent) {
- VStack(spacing: self.theme.metrics.spacing.lg) {
- if self.session.mode == .onlineCall {
- MeetingTrackHealthRow(
- title: "Meeting audio",
- health: self.trackHealth[.applicationAudio] ?? .waiting
- )
- }
- MeetingTrackHealthRow(
- title: "Microphone",
- health: self.trackHealth[.microphone] ?? .waiting
- )
+ ThemedCard(style: .subtle, padding: self.theme.metrics.spacing.md) {
+ ViewThatFits(in: .horizontal) {
+ HStack(spacing: self.theme.metrics.spacing.xl) { self.sourceHealth }
+ VStack(spacing: self.theme.metrics.spacing.md) { self.sourceHealth }
}
}
+ MeetingLiveTranscriptCard(snapshot: self.liveTranscript)
+
if self.isStopping {
Text("Saving captured audio before offline transcription begins…")
.font(self.theme.typography.body)
.foregroundStyle(self.theme.palette.secondaryText)
} else {
- MeetingLiveTranscriptCard(snapshot: self.liveTranscript)
- Text("When the meeting ends, stop recording to transcribe it offline.")
+ Text("Speaker labels are added after recording.")
.font(self.theme.typography.caption)
.foregroundStyle(self.theme.palette.secondaryText)
}
@@ -2345,13 +2361,20 @@ private struct MeetingRecordingCanvas: View {
Label("Stop & Transcribe", systemImage: "stop.fill")
}
}
- .fluidButton(.destructive, size: .medium)
+ .fluidGlassAction(prominent: true, tone: Color(nsColor: .systemRed), spacious: true)
.disabled(self.isStopping)
- .keyboardShortcut(.defaultAction)
}
}
}
+ @ViewBuilder
+ private var sourceHealth: some View {
+ if self.session.mode == .onlineCall {
+ MeetingTrackHealthRow(title: "Meeting audio", health: self.trackHealth[.applicationAudio] ?? .waiting)
+ }
+ MeetingTrackHealthRow(title: "Microphone", health: self.trackHealth[.microphone] ?? .waiting)
+ }
+
private var sourceSummary: String {
let microphoneName = self.session.selectedMicrophone.displayName
guard self.session.mode == .onlineCall else { return microphoneName }
@@ -2430,7 +2453,7 @@ private struct MeetingLiveTranscriptCard: View {
}
private var scrollingBubbleList: some View {
- MeetingLiveBubbleScrollList(rows: self.rows)
+ MeetingLiveBubbleScrollList(rows: self.rows, documentStyle: true)
.frame(minHeight: 120, maxHeight: .infinity)
}
}
@@ -2456,8 +2479,8 @@ private struct MeetingProcessingCanvas: View {
.fixedSize()
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
- Text("Transcribing meeting…")
- .font(self.theme.typography.sectionTitle)
+ Text("Preparing your transcript")
+ .font(self.theme.typography.title)
.accessibilityAddTraits(.isHeader)
Text("You can close this window. Processing will continue.")
.font(self.theme.typography.bodySmall)
@@ -2465,7 +2488,7 @@ private struct MeetingProcessingCanvas: View {
}
}
- ThemedCard {
+ FluidManagementGroup(title: self.session.title) {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.lg) {
ForEach(Array(self.stages.enumerated()), id: \.element) { index, stage in
HStack(spacing: self.theme.metrics.spacing.md) {
@@ -2482,7 +2505,7 @@ private struct MeetingProcessingCanvas: View {
}
}
- Text(self.session.title)
+ Label("Processing on this Mac", systemImage: "lock")
.font(self.theme.typography.caption)
.foregroundStyle(self.theme.palette.secondaryText)
}
@@ -2561,6 +2584,8 @@ private struct MeetingResultCanvas: View {
@State private var pendingRenameSessionText = ""
@State private var isShowingAssignSpeakers = false
@State private var assignSpeakersFocus: SessionSpeakerID?
+ @State private var copied = false
+ @State private var copyRevision = 0
/// Naming is reached by clicking a speaker's name, so the sheet opens on the one clicked.
private func presentAssignSpeakers(focusing speakerID: SessionSpeakerID?) {
@@ -2670,67 +2695,62 @@ private struct MeetingResultCanvas: View {
}
}
+ ViewThatFits(in: .horizontal) {
+ HStack(spacing: self.theme.metrics.spacing.sm) { self.transcriptActions(hasText: !visibleSegments.isEmpty) }
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) { self.transcriptActions(hasText: !visibleSegments.isEmpty) }
+ }
+
+ Divider().opacity(0.4)
+
if visibleSegments.isEmpty {
ContentUnavailableView(
"No transcript text",
systemImage: "waveform.slash",
- description: Text("The recording is preserved if you need to retry processing.")
+ description: Text(self.session.hasRetryableAudio
+ ? "The recording is available if you need to retry processing."
+ : "There is no transcript text available for this meeting.")
)
.frame(maxWidth: .infinity, minHeight: 180)
} else {
- VStack(alignment: .leading, spacing: 28) {
- ForEach(rows, id: \.segment.id) { row in
- MeetingTranscriptSegmentRow(
- segment: row.segment,
- speakerName: MeetingTranscriptExporter.speakerLabel(
- for: row.segment,
- in: self.session,
- speakerNames: speakerNames
- ),
- speakerTint: row.segment.speakerID.flatMap { speakerTints[$0] },
- onRenameSpeakerTapped: {
- if let speakerID = row.segment.speakerID {
- self.presentAssignSpeakers(focusing: speakerID)
- } else {
- self.pendingNameUnknownSegmentID = row.segment.id
- self.pendingUnknownSpeakerName = ""
- }
- },
- isLocalUser: row.isLocal,
- showsSpeakerLabel: row.showsLabel,
- reassignTargets: activeSpeakers.filter { $0.id != row.segment.speakerID },
- isQuiescent: self.isQuiescent,
- onReassign: { speakerID in self.onReassignSegment(row.segment.id, speakerID) }
- )
+ ScrollView {
+ LazyVStack(alignment: .leading, spacing: self.theme.metrics.spacing.xl) {
+ ForEach(rows, id: \.segment.id) { row in
+ MeetingTranscriptSegmentRow(
+ segment: row.segment,
+ speakerName: MeetingTranscriptExporter.speakerLabel(
+ for: row.segment,
+ in: self.session,
+ speakerNames: speakerNames
+ ),
+ speakerTint: row.segment.speakerID.flatMap { self.speakerTints[$0] },
+ onRenameSpeakerTapped: {
+ if let speakerID = row.segment.speakerID {
+ self.presentAssignSpeakers(focusing: speakerID)
+ } else {
+ self.pendingNameUnknownSegmentID = row.segment.id
+ self.pendingUnknownSpeakerName = ""
+ }
+ },
+ isLocalUser: row.isLocal,
+ showsSpeakerLabel: row.showsLabel,
+ reassignTargets: activeSpeakers.filter { $0.id != row.segment.speakerID },
+ isQuiescent: self.isQuiescent,
+ onReassign: { speakerID in self.onReassignSegment(row.segment.id, speakerID) }
+ )
+ }
}
+ .frame(maxWidth: 760)
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, self.theme.metrics.spacing.lg)
}
- .frame(maxWidth: 760)
- .frame(maxWidth: .infinity)
- .padding(.vertical, self.theme.metrics.spacing.lg)
- }
-
- HStack(spacing: self.theme.metrics.spacing.sm) {
- Button("Copy Transcript", systemImage: "doc.on.doc") {
- self.onCopyTranscript(self.session, self.showsProbableEchoes)
- }
- .fluidButton(.compact, size: .medium)
- .disabled(visibleSegments.isEmpty)
-
- Menu("Export Transcript", systemImage: "square.and.arrow.up") {
- Button("Text…") { self.onExportTranscript(self.session, .text, self.showsProbableEchoes) }
- Button("JSON…") { self.onExportTranscript(self.session, .json, self.showsProbableEchoes) }
- }
- .fluidButton(.compact, size: .medium)
- .disabled(visibleSegments.isEmpty)
-
- Button("Undo", systemImage: "arrow.uturn.backward") {
- self.onUndo()
- }
- .fluidButton(.compact, size: .medium)
- .keyboardShortcut("z", modifiers: .command)
- .disabled(!self.canUndo || !self.isQuiescent)
+ .id(self.session.id)
}
}
+ .task(id: self.copyRevision) {
+ guard self.copied else { return }
+ do { try await Task.sleep(for: .seconds(2)) } catch { return }
+ self.copied = false
+ }
.alert(
"Rename Speaker",
isPresented: Binding(
@@ -2776,6 +2796,7 @@ private struct MeetingResultCanvas: View {
}
// Prevents an echo toggle left on for one meeting from leaking into the next.
.onChange(of: self.session.id) { _, _ in
+ self.copied = false
self.showsProbableEchoes = false
self.isShowingAssignSpeakers = false
self.pendingNameUnknownSegmentID = nil
@@ -2795,6 +2816,25 @@ private struct MeetingResultCanvas: View {
}
}
+ @ViewBuilder private func transcriptActions(hasText: Bool) -> some View {
+ Button(self.copied ? "Copied" : "Copy transcript", systemImage: self.copied ? "checkmark" : "doc.on.doc") {
+ self.onCopyTranscript(self.session, self.showsProbableEchoes)
+ self.copied = true
+ self.copyRevision += 1
+ }
+ .fluidGlassAction(prominent: true, spacious: true)
+ .disabled(!hasText)
+ Menu("Export", systemImage: "square.and.arrow.up") {
+ Button("Text…") { self.onExportTranscript(self.session, .text, self.showsProbableEchoes) }
+ Button("JSON…") { self.onExportTranscript(self.session, .json, self.showsProbableEchoes) }
+ }
+ .fluidGlassAction(spacious: true)
+ .disabled(!hasText)
+ Button("Undo correction", systemImage: "arrow.uturn.backward", action: self.onUndo)
+ .fluidGlassAction(spacious: true)
+ .disabled(!self.canUndo || !self.isQuiescent)
+ }
+
@ViewBuilder
private func speakerChipMenu(for speaker: MeetingSessionSpeaker) -> some View {
Button("Rename…", systemImage: "pencil") {
@@ -2927,7 +2967,7 @@ private struct MeetingFailureCanvas: View {
}
var body: some View {
- ThemedCard(style: .prominent) {
+ FluidManagementGroup(title: self.session?.title ?? "Recording setup") {
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.lg) {
HStack(alignment: .firstTextBaseline) {
Label(self.title, systemImage: "exclamationmark.triangle.fill")
@@ -2979,6 +3019,7 @@ private struct MeetingFailureCanvas: View {
private struct MeetingAdaptiveSetupRow<Content: View>: View {
let title: String
var detail: String?
+ let trailingSwitch: Bool
@ViewBuilder let content: Content
@Environment(\.theme) private var theme
@@ -2986,30 +3027,41 @@ private struct MeetingAdaptiveSetupRow<Content: View>: View {
init(
title: String,
detail: String? = nil,
+ trailingSwitch: Bool = false,
@ViewBuilder content: () -> Content
) {
self.title = title
self.detail = detail
+ self.trailingSwitch = trailingSwitch
self.content = content()
}
var body: some View {
- ViewThatFits(in: .horizontal) {
- HStack(alignment: .center, spacing: self.theme.metrics.spacing.lg) {
- self.label
- .frame(width: 164, alignment: .leading)
- self.content
- .frame(width: 320, alignment: .leading)
- Spacer(minLength: 0)
- }
+ Group {
+ if self.trailingSwitch {
+ HStack(alignment: .center, spacing: self.theme.metrics.spacing.lg) {
+ self.label.frame(maxWidth: .infinity, alignment: .leading)
+ self.content.fixedSize()
+ }
+ } else {
+ ViewThatFits(in: .horizontal) {
+ HStack(alignment: .center, spacing: self.theme.metrics.spacing.lg) {
+ self.label
+ .frame(width: 220, alignment: .leading)
+ self.content
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
- VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
- self.label
- self.content
- .frame(maxWidth: .infinity, alignment: .leading)
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
+ self.label
+ self.content
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ }
}
}
- .padding(.horizontal, self.theme.metrics.spacing.lg)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, self.theme.metrics.spacing.xs)
.padding(.vertical, self.theme.metrics.spacing.md)
}
@@ -3030,6 +3082,7 @@ private struct MeetingAdaptiveSetupRow<Content: View>: View {
private struct MeetingReadyStatus: View {
let isReady: Bool
+ var isWaiting = false
let title: String
let detail: String
@@ -3037,8 +3090,8 @@ private struct MeetingReadyStatus: View {
var body: some View {
HStack(spacing: self.theme.metrics.spacing.md) {
- Image(systemName: self.isReady ? "checkmark.circle.fill" : "exclamationmark.circle.fill")
- .foregroundStyle(self.isReady ? self.theme.palette.success : self.theme.palette.warning)
+ Image(systemName: self.isReady ? "checkmark.circle.fill" : (self.isWaiting ? "clock" : "exclamationmark.circle.fill"))
+ .foregroundStyle(self.isReady ? self.theme.palette.success : (self.isWaiting ? self.theme.palette.secondaryText : self.theme.palette.warning))
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: self.theme.metrics.spacing.xs) {
Text(self.title)
@@ -3090,7 +3143,7 @@ private struct MeetingTrackHealthRow: View {
ProgressView(value: min(max(Double(self.health.level), 0), 1))
.progressViewStyle(.linear)
- .frame(width: 150)
+ .frame(width: 80)
.accessibilityLabel("\(self.title) level")
Label(
@@ -3152,11 +3205,23 @@ private struct MeetingTranscriptSegmentRow: View {
@State private var isHoveringSpeaker = false
var body: some View {
- Group {
- if self.isLocalUser {
- self.localBubble
- } else {
- self.remoteMessage
+ HStack(alignment: .top, spacing: self.theme.metrics.spacing.lg) {
+ Text(MeetingTranscriptExporter.timestampText(self.segment.start.seconds))
+ .font(self.theme.typography.codeCaption)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .frame(width: 58, alignment: .leading)
+ .padding(.top, 2)
+ VStack(alignment: .leading, spacing: self.theme.metrics.spacing.sm) {
+ if self.showsSpeakerLabel { self.speakerLabel }
+ Text(self.segment.text)
+ .font(self.theme.typography.body)
+ .foregroundStyle(self.theme.palette.primaryText)
+ .lineSpacing(5)
+ .textSelection(.enabled)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ if self.segment.isEcho {
+ Text("Probable echo").font(self.theme.typography.caption).foregroundStyle(.secondary)
+ }
}
}
.opacity(self.segment.isEcho ? 0.6 : 1)
@@ -3176,17 +3241,11 @@ private struct MeetingTranscriptSegmentRow: View {
)
}
- /// A wash of the speaker's own tint, faint enough that a wall of turns still reads as text.
- private var bubbleFill: Color {
- (self.isLocalUser ? self.theme.palette.accent : self.speakerTint)?.opacity(0.10)
- ?? self.theme.palette.contentBackground
- }
-
private var speakerLabel: some View {
let name = Text(self.speakerName)
.foregroundColor(self.nameColor)
.fontWeight(.semibold)
- .font(.fluidSystem(size: 14, design: .monospaced))
+ .font(self.theme.typography.bodySmallStrong)
return HStack(spacing: 8) {
if let onRenameSpeakerTapped = self.onRenameSpeakerTapped {
@@ -3208,9 +3267,6 @@ private struct MeetingTranscriptSegmentRow: View {
} else {
name
}
- Text(MeetingTranscriptExporter.timestampText(self.segment.start.seconds))
- .font(.fluidSystem(size: 14, design: .monospaced))
- .foregroundColor(self.theme.palette.tertiaryText)
}
}
@@ -3218,40 +3274,4 @@ private struct MeetingTranscriptSegmentRow: View {
if self.isLocalUser { return self.theme.palette.accent }
return self.speakerTint ?? self.theme.palette.tertiaryText
}
-
- private var localBubble: some View {
- VStack(alignment: .trailing, spacing: 6) {
- if self.showsSpeakerLabel {
- self.speakerLabel
- }
- Text(self.segment.text)
- .textSelection(.enabled)
- .meetingBubbleStyle(MeetingBubbleStyle.final(fill: self.bubbleFill, foreground: self.theme.palette.primaryText))
- if self.segment.isEcho {
- Text("probable echo")
- .font(self.theme.typography.caption)
- .foregroundStyle(self.theme.palette.tertiaryText)
- }
- }
- .frame(maxWidth: .infinity, alignment: .trailing)
- .padding(.leading, 96)
- }
-
- private var remoteMessage: some View {
- VStack(alignment: .leading, spacing: 6) {
- if self.showsSpeakerLabel {
- self.speakerLabel
- }
- Text(self.segment.text)
- .textSelection(.enabled)
- .meetingBubbleStyle(MeetingBubbleStyle.final(fill: self.bubbleFill, foreground: self.theme.palette.primaryText))
- if self.segment.isEcho {
- Text("probable echo")
- .font(self.theme.typography.caption)
- .foregroundStyle(self.theme.palette.tertiaryText)
- }
- }
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.trailing, 48)
- }
}
diff --git a/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift b/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift
index 0b3f79fd..9b49e0a2 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift
@@ -38,14 +38,21 @@ private final class FakeAudioProcessActivity: AudioProcessActivityProviding {
if let snapshotOverride { return snapshotOverride }
let processes = self.activeBundleIdentifiers.map { bundle in
let owner = bundle == "us.zoom.caphost" ? "us.zoom.xos" : bundle
- return AudioProcessDescriptor(processID: 55, bundleIdentifier: bundle,
- executablePath: "/Applications/\(owner).app/Contents/Helpers/\(bundle)",
- isInputRunning: bundle != "us.zoom.caphost", isOutputRunning: true)
+ return AudioProcessDescriptor(
+ processID: 55,
+ bundleIdentifier: bundle,
+ executablePath: "/Applications/\(owner).app/Contents/Helpers/\(bundle)",
+ isInputRunning: bundle != "us.zoom.caphost",
+ isOutputRunning: true
+ )
}
let owners = self.activeBundleIdentifiers.map { bundle in
let owner = bundle == "us.zoom.caphost" ? "us.zoom.xos" : bundle
- return MeetingProcessOwner(processID: 5, bundleIdentifier: owner,
- bundlePath: "/Applications/\(owner).app")
+ return MeetingProcessOwner(
+ processID: 5,
+ bundleIdentifier: owner,
+ bundlePath: "/Applications/\(owner).app"
+ )
}
return AudioProcessActivitySnapshot(processes: processes, owners: owners, queryState: .valid)
}
@@ -137,6 +144,54 @@ private final class DetectorHarness {
@MainActor
final class MeetingAutoDetectorTests: XCTestCase {
+ func testAutomaticSourcePublishesConfirmedTargetWithoutConsumingPrompt() throws {
+ let h = DetectorHarness()
+ var changes: [MeetingAutoDetector.ResolvedTarget?] = []
+ h.detector.onAutomaticTargetChanged = { changes.append($0) }
+ XCTAssertNil(h.detector.automaticTarget)
+ let episode = try XCTUnwrap(h.confirmZoom())
+ XCTAssertEqual(h.detector.automaticTarget?.bundleIdentifier, "us.zoom.xos")
+ XCTAssertEqual(h.detector.automaticTarget?.pid, 100)
+ XCTAssertEqual(h.detector.automaticTarget?.windowID, 900)
+ XCTAssertTrue(h.detector.canStart(episodeID: episode), "Selecting a source must not consume or start a recording")
+ let count = changes.count
+ h.detector.tick(at: h.clock.now())
+ XCTAssertEqual(changes.count, count, "Unchanged evidence must not trigger source refreshes")
+ h.detector.timeoutDismissed(episodeID: episode)
+ XCTAssertNotNil(h.detector.automaticTarget, "Prompt timeout must not hide a live source from the manual page")
+ h.detector.handleWindowSnapshot([], at: h.clock.now())
+ XCTAssertNil(h.detector.automaticTarget, "Do not retain a source through the episode's teardown grace period")
+ }
+
+ func testAutomaticSourceClearsWhenDetectionDisabledOrStopped() {
+ let h = DetectorHarness()
+ h.confirmZoom()
+ XCTAssertNotNil(h.detector.automaticTarget)
+ h.nativeEnabled = false
+ h.detector.tick(at: h.clock.now())
+ XCTAssertNil(h.detector.automaticTarget)
+ h.nativeEnabled = true
+ h.detector.tick(at: h.clock.now())
+ XCTAssertNotNil(h.detector.automaticTarget)
+ h.detector.stop()
+ XCTAssertNil(h.detector.automaticTarget)
+ }
+
+ func testAutomaticSourceDoesNotGuessBetweenTwoLiveMeetings() {
+ let h = DetectorHarness()
+ h.confirmZoom(pid: 100)
+ h.confirmZoom(pid: 200)
+ h.detector.handleWindowSnapshot([
+ .init(processID: 100, windowID: 900, title: "Zoom Meeting", layer: 0),
+ .init(processID: 200, windowID: 900, title: "Zoom Meeting", layer: 0),
+ ], at: h.clock.now())
+ XCTAssertNil(h.detector.automaticTarget)
+ h.detector.handleWorkspaceEvent(.init(kind: .terminated, bundleIdentifier: "us.zoom.xos", processID: 200), at: h.clock.now())
+ XCTAssertEqual(h.detector.automaticTarget?.pid, 100)
+ h.detector.disarmAndClearTransientState()
+ XCTAssertNil(h.detector.automaticTarget)
+ }
+
// MARK: Generic HAL ownership resolver
func testAudioResolverMapsHelpersInsideEachRegisteredNativeBundle() {
@@ -150,7 +205,8 @@ final class MeetingAutoDetectorTests: XCTestCase {
for (bundle, root) in apps {
let result = MeetingAudioProcessResolver.activeOwnerInputByPID(snapshot: .init(
processes: [.init(processID: 900, bundleIdentifier: "helper.unknown", executablePath: root + "/Contents/Helpers/Module.app/Contents/MacOS/Module", isInputRunning: true, isOutputRunning: false)],
- owners: [.init(processID: 42, bundleIdentifier: bundle, bundlePath: root)], queryState: .valid))
+ owners: [.init(processID: 42, bundleIdentifier: bundle, bundlePath: root)], queryState: .valid
+ ))
XCTAssertEqual(result?[42], true, "helper attribution should work for \(bundle)")
}
}
@@ -159,7 +215,8 @@ final class MeetingAutoDetectorTests: XCTestCase {
func resolve(_ processPath: String?, owners: [MeetingProcessOwner]) -> [Int32: Bool]? {
MeetingAudioProcessResolver.activeOwnerInputByPID(snapshot: .init(
processes: [.init(processID: 1, bundleIdentifier: nil, executablePath: processPath, isInputRunning: true, isOutputRunning: false)],
- owners: owners, queryState: .valid))
+ owners: owners, queryState: .valid
+ ))
}
let owner = MeetingProcessOwner(processID: 10, bundleIdentifier: "com.microsoft.teams2", bundlePath: "/Applications/Teams.app")
XCTAssertEqual(resolve("/Applications/Teams.app.evil/Contents/MacOS/x", owners: [owner]), [:])
@@ -188,7 +245,8 @@ final class MeetingAutoDetectorTests: XCTestCase {
defer { try? FileManager.default.removeItem(at: root) }
let result = MeetingAudioProcessResolver.activeOwnerInputByPID(snapshot: .init(
processes: [.init(processID: 1, bundleIdentifier: nil, executablePath: link.path + "/Module", isInputRunning: true, isOutputRunning: false)],
- owners: [.init(processID: 2, bundleIdentifier: "com.microsoft.teams2", bundlePath: app.path)], queryState: .valid))
+ owners: [.init(processID: 2, bundleIdentifier: "com.microsoft.teams2", bundlePath: app.path)], queryState: .valid
+ ))
XCTAssertEqual(result, [:])
}
@@ -198,7 +256,8 @@ final class MeetingAutoDetectorTests: XCTestCase {
h.detector.handleWindowSnapshot([.init(processID: 5, windowID: 9, title: nil, layer: 0)], at: h.clock.now())
h.audioProcessActivity.snapshotOverride = .init(
processes: [.init(processID: 55, bundleIdentifier: "teams.helper", executablePath: "/Applications/com.microsoft.teams2.app/Contents/Helpers/Module", isInputRunning: false, isOutputRunning: true)],
- owners: [.init(processID: 5, bundleIdentifier: "com.microsoft.teams2", bundlePath: "/Applications/com.microsoft.teams2.app")], queryState: .valid)
+ owners: [.init(processID: 5, bundleIdentifier: "com.microsoft.teams2", bundlePath: "/Applications/com.microsoft.teams2.app")], queryState: .valid
+ )
await h.detector.pollAudioProcessActivity(at: h.clock.now())
XCTAssertTrue(h.prompts.isEmpty)
}
@@ -217,7 +276,8 @@ final class MeetingAutoDetectorTests: XCTestCase {
h.detector.handleWorkspaceEvent(.init(kind: .launched, bundleIdentifier: "com.microsoft.teams2", processID: 5), at: h.clock.now())
h.audioProcessActivity.snapshotOverride = .init(
processes: [.init(processID: 55, bundleIdentifier: "teams.helper", executablePath: "/Applications/Teams.app/Contents/Helpers/Module", isInputRunning: true, isOutputRunning: true)],
- owners: [.init(processID: 5, bundleIdentifier: "com.microsoft.teams2", bundlePath: "/Applications/Teams.app")], queryState: .valid)
+ owners: [.init(processID: 5, bundleIdentifier: "com.microsoft.teams2", bundlePath: "/Applications/Teams.app")], queryState: .valid
+ )
h.audioProcessActivity.beforeSnapshot = {
h.detector.handleWorkspaceEvent(.init(kind: .terminated, bundleIdentifier: "com.microsoft.teams2", processID: 5), at: h.clock.now())
h.detector.handleWorkspaceEvent(.init(kind: .activated, bundleIdentifier: "com.microsoft.teams2", processID: 5), at: h.clock.now())
@@ -351,7 +411,7 @@ final class MeetingAutoDetectorTests: XCTestCase {
}
func testPromptDefaultsToTopCenterOfVisibleFrame() {
- let visibleFrame = NSRect(x: 100, y: 50, width: 1_200, height: 800)
+ let visibleFrame = NSRect(x: 100, y: 50, width: 1200, height: 800)
let frame = MeetingDetectionPromptController.defaultFrame(
panelSize: MeetingDetectionPromptController.panelSize,
visibleFrame: visibleFrame
diff --git a/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift b/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
index f111a1b6..7701546d 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingLiveTranscriptionTests.swift
@@ -3,6 +3,58 @@ import CoreMedia
import Foundation
import XCTest
+@MainActor
+final class MeetingModelPreparationQueueTests: XCTestCase {
+ private actor Counter {
+ var active = 0
+ var maximum = 0
+ var completed = 0
+ func enter() { active += 1; maximum = max(maximum, active) }
+ func leave() { active -= 1; completed += 1 }
+ }
+
+ func testConcurrentPreparationsNeverOverlap() async throws {
+ let queue = MeetingModelPreparationQueue()
+ let counter = Counter()
+ try await withThrowingTaskGroup(of: Void.self) { group in
+ for _ in 0..<20 {
+ group.addTask {
+ try await queue.run {
+ await counter.enter()
+ try await Task.sleep(nanoseconds: 1_000_000)
+ await counter.leave()
+ }
+ }
+ }
+ try await group.waitForAll()
+ }
+ let maximum = await counter.maximum
+ let completed = await counter.completed
+ XCTAssertEqual(maximum, 1)
+ XCTAssertEqual(completed, 20)
+ }
+
+ func testFailureAndCancellationDoNotPoisonNextPreparation() async throws {
+ let queue = MeetingModelPreparationQueue()
+ let counter = Counter()
+ do {
+ try await queue.run { throw CancellationError() }
+ XCTFail("Expected failure")
+ } catch is CancellationError {}
+ let cancelled = Task {
+ try await Task.sleep(nanoseconds: 10_000_000)
+ try await queue.run { await counter.enter() }
+ }
+ cancelled.cancel()
+ _ = await cancelled.result
+ try await queue.run { await counter.enter(); await counter.leave() }
+ let completed = await counter.completed
+ let active = await counter.active
+ XCTAssertEqual(completed, 1)
+ XCTAssertEqual(active, 0)
+ }
+}
+
final class MeetingLiveTimeConversionTests: XCTestCase {
func testZeroOriginPassesPTSThrough() {
let pts = CMTime(value: 5, timescale: 1)
diff --git a/Tests/FluidDictationIntegrationTests/MeetingMicrophoneCaptureTests.swift b/Tests/FluidDictationIntegrationTests/MeetingMicrophoneCaptureTests.swift
index ada46530..ebc00b5d 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingMicrophoneCaptureTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingMicrophoneCaptureTests.swift
@@ -329,10 +329,11 @@ final class MeetingMicrophoneCaptureTests: XCTestCase {
_ writer: MeetingAudioChunkWriter,
ptsSeconds: Double,
frameCount: Int = 480,
- producerEpoch: UInt64 = 0
+ producerEpoch: UInt64 = 0,
+ timescale: CMTimeScale = 48_000
) {
let buffer = self.makeMonoBuffer(frameCount: frameCount) { _ in 0.1 }
- let pts = CMTime(seconds: ptsSeconds, preferredTimescale: 48_000)
+ let pts = CMTime(seconds: ptsSeconds, preferredTimescale: timescale)
guard let sampleBuffer = meetingMicrophoneSynthesizeSampleBuffer(from: buffer, presentationTime: pts) else {
return XCTFail("failed to synthesize a sample buffer")
}
@@ -352,6 +353,20 @@ final class MeetingMicrophoneCaptureTests: XCTestCase {
XCTAssertEqual(track.chunks.first?.discontinuities ?? [], [])
}
+ func testNanosecondClockRoundingDoesNotFragmentApplicationAudio() async throws {
+ let (writer, sessionDirectory) = try self.makeWriter()
+ defer { try? FileManager.default.removeItem(at: sessionDirectory) }
+ for tick in 0..<100 {
+ self.pushBuffer(writer, ptsSeconds: 188_092.2630985 + Double(tick) * 0.01 - Double(tick) * 0.000000042,
+ timescale: 1_000_000_000)
+ if tick.isMultiple(of: 10) { _ = await writer.snapshot() }
+ }
+ let track = await writer.stop()
+ XCTAssertEqual(track.chunks.count, 1)
+ XCTAssertEqual(track.chunks.first?.discontinuities ?? [], [])
+ XCTAssertEqual(track.chunks.first?.captureAnalysisAsset?.frameCount, 48_000)
+ }
+
func testWriterPublishesPCMCAFMetadataAndReadyLedgerTerminal() async throws {
let (writer, sessionDirectory) = try self.makeWriter()
defer { try? FileManager.default.removeItem(at: sessionDirectory) }
diff --git a/Tests/FluidDictationIntegrationTests/MeetingNemotronModelLocatorTests.swift b/Tests/FluidDictationIntegrationTests/MeetingNemotronModelLocatorTests.swift
index f10a8f73..f0cc2270 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingNemotronModelLocatorTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingNemotronModelLocatorTests.swift
@@ -7,6 +7,34 @@ import XCTest
/// location, and fail-closed structure validation. No network and no bundled 190 MB weights.
@MainActor
final class MeetingNemotronModelLocatorTests: XCTestCase {
+ func testInvalidImportPreservesInstalledPackage() throws {
+ let root = try self.makeTempDirectory()
+ let source = try self.makeFakePackage(at: root.appendingPathComponent("source"))
+ let destination = try self.makeFakePackage(at: root.appendingPathComponent("installed"))
+ let manifest = destination.appendingPathComponent("Manifest.json")
+ let original = try Data(contentsOf: manifest)
+ XCTAssertThrowsError(try MeetingModelInstaller.install(from: source, to: destination))
+ XCTAssertEqual(try Data(contentsOf: manifest), original)
+ XCTAssertEqual(try FileManager.default.contentsOfDirectory(atPath: destination.deletingLastPathComponent().path), [destination.lastPathComponent])
+ }
+
+ func testBetaImportPersistsForFreshLocatorAndReplacement() throws {
+ let source = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
+ .deletingLastPathComponent().deletingLastPathComponent()
+ .appendingPathComponent("scratch/nemotron-diar/handoff/nemotron-3-diarization/models/nemotron_diar_fp16.mlpackage")
+ guard FileManager.default.fileExists(atPath: source.path) else {
+ throw XCTSkip("Beta model fixture is not available")
+ }
+ let root = try self.makeTempDirectory()
+ let destination = root.appendingPathComponent("installed/model.mlpackage")
+ _ = try MeetingModelInstaller.install(from: source, to: destination)
+ // A fresh locator has no reference to the import task or original download.
+ XCTAssertEqual(try MeetingNemotronModelLocator(injectedURL: destination).locate().totalByteCount, 199_101_327)
+ _ = try MeetingModelInstaller.install(from: source, to: destination)
+ XCTAssertEqual(try MeetingModelInstaller.validate(destination).totalByteCount, 199_101_327)
+ XCTAssertEqual(try MeetingModelInstaller.validate(source).totalByteCount, 199_101_327)
+ }
+
private func makeTempDirectory() throws -> URL {
let url = FileManager.default.temporaryDirectory
.appendingPathComponent("nemotron-locator-\(UUID().uuidString)", isDirectory: true)
diff --git a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
index f72776ef..e049d059 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
@@ -1,11 +1,103 @@
-@testable import FluidVoice_Debug
+import AppKit
import CoreMedia
+@testable import FluidVoice_Debug
import Foundation
import SwiftUI
import XCTest
@MainActor
final class MeetingRecoveryTests: XCTestCase {
+ func testNotesSetupDraftDoesNotPersistDetectionChanges() {
+ let native = SettingsStore.shared.meetingAutoDetectEnabled
+ let browser = SettingsStore.shared.meetingAutoDetectBrowserEnabled
+ let original = MeetingTranscriptionSetupDraft()
+ var draft = original
+ draft.autoDetectEnabled = !native
+ draft.browserDetectionEnabled = !browser
+ draft.title = "Unsaved meeting"
+ XCTAssertEqual(SettingsStore.shared.meetingAutoDetectEnabled, native)
+ XCTAssertEqual(SettingsStore.shared.meetingAutoDetectBrowserEnabled, browser)
+ draft = original
+ XCTAssertEqual(draft.autoDetectEnabled, native)
+ XCTAssertEqual(draft.browserDetectionEnabled, browser)
+ XCTAssertEqual(draft.title, original.title)
+ }
+
+ func testNotesCanvasStatesRenderWithoutInvokingActions() throws {
+ var session = self.makeCorrectionSession(state: .completed).session
+ session.title = "Design review"
+ session.transcriptSegments[0].text = "The meeting workspace should keep recording sources visible and make the transcript easy to read."
+ let live = MeetingLiveTranscriptSnapshot.empty.inserting(MeetingLiveUtterance(
+ id: UUID(), speaker: .you, text: "Let's keep the important controls within reach.", start: 0, end: 4
+ ))
+ let states: [(String, MeetingTranscriptionCanvasState)] = [
+ ("setup", .setup(isStarting: false, recentSession: nil)),
+ ("starting", .setup(isStarting: true, recentSession: nil)),
+ ("recording", .recording(session: session, trackHealth: [:], liveTranscript: live)),
+ ("stopping", .stopping(session: session, trackHealth: [:], liveTranscript: live)),
+ ("processing", .processing(session: session, stage: .identifyingSpeakers)),
+ ("result", .result(session)),
+ ("recovery", .failed(session: session, message: "Transcription could not finish. Try again.")),
+ ("failure", .failed(session: nil, message: "Choose an available microphone.")),
+ ]
+ var actionCount = 0
+ let action = { actionCount += 1 }
+ let output = URL(fileURLWithPath: "/tmp/fluid-notes-ui-review", isDirectory: true)
+ try FileManager.default.createDirectory(at: output, withIntermediateDirectories: true)
+ for scheme in [ColorScheme.dark, .light] {
+ for width in [CGFloat(520), 1000] {
+ for (name, state) in states {
+ let canvas = MeetingTranscriptionCanvas(
+ setupDraft: .constant(MeetingTranscriptionSetupDraft()),
+ state: state,
+ applications: [],
+ microphones: [],
+ readiness: .checking,
+ errorMessage: nil,
+ onStart: action,
+ onStop: action,
+ onRetrySession: { _ in action() },
+ onRevealAudio: { _ in action() },
+ onRecordAgain: { _ in action() },
+ onCopyTranscript: { _, _ in action() },
+ onExportTranscript: { _, _, _ in action() },
+ onReassignSegment: { _, _, _ in action() },
+ onNameUnknownSegment: { _, _, _ in action() },
+ onRenameSpeaker: { _, _, _ in action() },
+ onMergeSpeakers: { _, _, _ in action() },
+ onUndoCorrection: { _ in action() },
+ onRenameSession: { _, _ in action() },
+ onAssignSpeakers: { _, _ in action(); return nil },
+ canUndoCorrection: { _ in false },
+ isQuiescent: true,
+ onRepairSetup: action,
+ isRetrying: false,
+ onCloseSelection: action
+ )
+ .frame(width: width, height: 680)
+ .appTheme(.adaptive(accent: FluidBrandColors.blue, colorScheme: scheme))
+ .environment(\.colorScheme, scheme)
+ // AppKit-backed ScrollViews are not captured by SwiftUI ImageRenderer.
+ let host = NSHostingView(rootView: canvas)
+ let window = NSWindow(
+ contentRect: NSRect(x: 0, y: 0, width: width, height: 680),
+ styleMask: [.borderless],
+ backing: .buffered,
+ defer: false
+ )
+ window.contentView = host
+ host.layoutSubtreeIfNeeded()
+ host.displayIfNeeded()
+ let bitmap = try XCTUnwrap(host.bitmapImageRepForCachingDisplay(in: host.bounds), "\(name) must render")
+ host.cacheDisplay(in: host.bounds, to: bitmap)
+ let png = try XCTUnwrap(bitmap.representation(using: .png, properties: [:]))
+ try png.write(to: output.appendingPathComponent("\(name)-\(scheme)-\(Int(width)).png"))
+ }
+ }
+ }
+ XCTAssertEqual(actionCount, 0, "Rendering must not start capture, persist settings, export or modify a transcript")
+ }
+
func testHistoryKeyboardTraversalWalksTheRenderedOrder() {
let ids = [UUID(), UUID(), UUID()]
func move(from current: UUID?, _ direction: MoveCommandDirection) -> UUID? {
@@ -417,6 +509,33 @@ final class MeetingRecoveryTests: XCTestCase {
XCTAssertLessThan(restoreIndex, captureIndex)
}
+ func testMissingModelBlocksCaptureAndClearsStartReservation() async throws {
+ let dir = self.makeTempDirectory()
+ defer { try? FileManager.default.removeItem(at: dir) }
+ let capture = StubCaptureController()
+ let recorder = EventRecorder()
+ capture.onStart = { await recorder.record("capture.start") }
+ let coordinator = MeetingSessionCoordinator(
+ store: MeetingSessionStore(rootDirectory: dir),
+ capture: capture,
+ processing: StubProcessingController(),
+ audioArbiter: StubArbiter(),
+ validateRecordingModels: { throw MeetingModelInstaller.InstallError.wrongPackage }
+ )
+ for _ in 0..<2 {
+ do {
+ _ = try await coordinator.startRecording(configuration: self.makeConfiguration(title: "Missing model"))
+ XCTFail("Recording must not start without the required model")
+ } catch is MeetingModelInstaller.InstallError {
+ // Both attempts must reach validation, not a stale recording-already-active gate.
+ }
+ XCTAssertFalse(coordinator.hasPendingStart)
+ XCTAssertFalse(coordinator.isRecording)
+ }
+ let events = await recorder.events
+ XCTAssertFalse(events.contains("capture.start"))
+ }
+
// MARK: - Test 6: salvage current behavior pin
func testMissingChunkFileIsRetainedAsFailedNotDropped() async throws {
@@ -463,8 +582,8 @@ final class MeetingRecoveryTests: XCTestCase {
id: UUID(),
sequence: 0,
relativeFilePath: "tracks/microphone/invalid.m4a",
- presentationStart: MeetingMediaTime(value: 2_000, timescale: 1_000),
- presentationEnd: MeetingMediaTime(value: 1_000, timescale: 1_000),
+ presentationStart: MeetingMediaTime(value: 2000, timescale: 1000),
+ presentationEnd: MeetingMediaTime(value: 1000, timescale: 1000),
discontinuities: [],
sha256: "invalid",
byteCount: 1,
@@ -996,8 +1115,11 @@ final class MeetingRecoveryTests: XCTestCase {
let dir = self.makeTempDirectory()
defer { try? FileManager.default.removeItem(at: dir) }
let store = MeetingSessionStore(rootDirectory: dir)
- let old = self.makeSession(state: .interrupted, endedAt: Date(),
- audioTracks: [self.makeMicrophoneTrack(chunks: [self.makeFinalizedChunk()])])
+ let old = self.makeSession(
+ state: .interrupted,
+ endedAt: Date(),
+ audioTracks: [self.makeMicrophoneTrack(chunks: [self.makeFinalizedChunk()])]
+ )
try await store.create(old)
let capture = StubCaptureController()
capture.preflightError = MeetingCaptureError.microphonePermissionDenied
@@ -1041,7 +1163,9 @@ final class MeetingRecoveryTests: XCTestCase {
store: store, capture: capture, processing: StubProcessingController(), audioArbiter: arbiter
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 { await Task.yield() }
+ while capture.preflightCount == 0 {
+ await Task.yield()
+ }
do {
_ = try await coordinator.retryProcessing(sessionID: UUID())
@@ -1091,7 +1215,9 @@ final class MeetingRecoveryTests: XCTestCase {
processing: StubProcessingController(), audioArbiter: StubArbiter()
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 { await Task.yield() }
+ while capture.preflightCount == 0 {
+ await Task.yield()
+ }
await coordinator.shutdownForTermination()
continuation?.resume()
do {
@@ -2244,7 +2370,9 @@ final class MeetingRecoveryTests: XCTestCase {
// Simulate the crash window: the cleared manifest was saved, but file removal never ran —
// leave an actual leftover file behind (an empty recreated tracks/ is not a leftover).
var cleared = session
- for index in cleared.audioTracks.indices { cleared.audioTracks[index].chunks = [] }
+ for index in cleared.audioTracks.indices {
+ cleared.audioTracks[index].chunks = []
+ }
cleared.retention.audioDeletedAt = Date()
try await store.save(cleared)
try Data("leftover".utf8).write(to: tracksURL.appendingPathComponent("stray.caf", isDirectory: false))
@@ -2270,7 +2398,9 @@ final class MeetingRecoveryTests: XCTestCase {
let tracksURL = sessionDirectory.appendingPathComponent("tracks", isDirectory: true)
var cleared = session
- for index in cleared.audioTracks.indices { cleared.audioTracks[index].chunks = [] }
+ for index in cleared.audioTracks.indices {
+ cleared.audioTracks[index].chunks = []
+ }
cleared.retention.audioDeletedAt = Date()
try await store.save(cleared)
XCTAssertTrue(FileManager.default.fileExists(atPath: tracksURL.path))
@@ -2297,7 +2427,9 @@ final class MeetingRecoveryTests: XCTestCase {
// Simulate the crash window: the cleared manifest was saved, but tracks/ removal never ran.
var cleared = session
- for index in cleared.audioTracks.indices { cleared.audioTracks[index].chunks = [] }
+ for index in cleared.audioTracks.indices {
+ cleared.audioTracks[index].chunks = []
+ }
cleared.retention.audioDeletedAt = Date()
try await store.save(cleared)
@@ -2599,7 +2731,9 @@ final class MeetingRecoveryTests: XCTestCase {
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 { await Task.yield() }
+ while capture.preflightCount == 0 {
+ await Task.yield()
+ }
XCTAssertEqual(arbiter.acquireCount, 0, "permission prompt must not hold the meeting audio lease")
continuation?.resume()
@@ -2655,7 +2789,9 @@ final class MeetingRecoveryTests: XCTestCase {
let arbiter = AudioActivityArbiter { leasing }
let firstAcquire = Task { try await arbiter.acquireMeetingCapture() }
- while leasing.prepareStarted == false { await Task.yield() }
+ while leasing.prepareStarted == false {
+ await Task.yield()
+ }
do {
_ = try await arbiter.acquireMeetingCapture()
XCTFail("Expected the published preparing lease to reject re-entrant acquisition")
@@ -2676,7 +2812,9 @@ final class MeetingRecoveryTests: XCTestCase {
let arbiter = AudioActivityArbiter { leasing }
let acquire = Task { try await arbiter.acquireMeetingCapture() }
- while leasing.prepareStarted == false { await Task.yield() }
+ while leasing.prepareStarted == false {
+ await Task.yield()
+ }
acquire.cancel()
leasing.resumePrepare()
@@ -2710,7 +2848,9 @@ final class MeetingRecoveryTests: XCTestCase {
let lease = try await arbiter.acquireMeetingCapture()
let firstRelease = Task { await arbiter.release(lease) }
- while leasing.handbackStarted == false { await Task.yield() }
+ while leasing.handbackStarted == false {
+ await Task.yield()
+ }
let duplicateRelease = Task { await arbiter.release(lease) }
await Task.yield()
@@ -3127,9 +3267,11 @@ private final class ThrowingDirectoryStore: MeetingSessionStoring, @unchecked Se
if self.throwOnSessionDirectory { throw CocoaError(.fileWriteNoPermission) }
return try await self.wrapped.sessionDirectory(for: id)
}
+
func existingSessionDirectory(for id: MeetingSessionID) async throws -> URL? {
try await self.wrapped.existingSessionDirectory(for: id)
}
+
func delete(id: MeetingSessionID) async throws { try await self.wrapped.delete(id: id) }
func deleteAudioFiles(for id: MeetingSessionID) async throws { try await self.wrapped.deleteAudioFiles(for: id) }
}
@@ -3294,6 +3436,7 @@ private final class StubArbiter: MeetingAudioActivityArbitrating {
self.acquireCount += 1
return MeetingAudioActivityLease(id: UUID())
}
+
func release(_ lease: MeetingAudioActivityLease) async {}
}
@@ -3325,6 +3468,7 @@ private final class FakeASRActivityLeasing: ASRActivityLeasing {
func prepareMeetingAudioHandoff(_ lease: ASRActivityLease) async throws {
self.prepareCount += 1
}
+
func completeMeetingAudioHandback(_ lease: ASRActivityLease) async {
self.handbackCount += 1
self.releaseExclusiveActivity(lease)
@@ -3419,6 +3563,7 @@ private final class ThrowOnceArbiter: MeetingAudioActivityArbitrating {
}
return MeetingAudioActivityLease(id: UUID())
}
+
func release(_ lease: MeetingAudioActivityLease) async {}
}
@@ -3450,6 +3595,7 @@ private actor GatedDeleteStore: MeetingSessionStoring {
func existingSessionDirectory(for id: MeetingSessionID) async throws -> URL? {
try await self.inner.existingSessionDirectory(for: id)
}
+
func delete(id: MeetingSessionID) async throws {
await self.recorder.record("store.delete.start")
if !self.isOpen {
@@ -3457,6 +3603,7 @@ private actor GatedDeleteStore: MeetingSessionStoring {
}
try await self.inner.delete(id: id)
}
+
func deleteAudioFiles(for id: MeetingSessionID) async throws { try await self.inner.deleteAudioFiles(for: id) }
}
@@ -3487,6 +3634,7 @@ private actor GatedRecoverableStore: MeetingSessionStoring {
func existingSessionDirectory(for id: MeetingSessionID) async throws -> URL? {
try await self.inner.existingSessionDirectory(for: id)
}
+
func delete(id: MeetingSessionID) async throws { try await self.inner.delete(id: id) }
func deleteAudioFiles(for id: MeetingSessionID) async throws { try await self.inner.deleteAudioFiles(for: id) }
@@ -3543,6 +3691,7 @@ private actor GatedThrowingSaveStore: MeetingSessionStoring {
func existingSessionDirectory(for id: MeetingSessionID) async throws -> URL? {
try await self.inner.existingSessionDirectory(for: id)
}
+
func delete(id: MeetingSessionID) async throws { try await self.inner.delete(id: id) }
func deleteAudioFiles(for id: MeetingSessionID) async throws { try await self.inner.deleteAudioFiles(for: id) }
}