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
fix(meetings): address review findings
altic-dev7b9bdc1c78c2
diff --git a/Sources/Fluid/Services/Meeting/MeetingAutoDetectSignals.swift b/Sources/Fluid/Services/Meeting/MeetingAutoDetectSignals.swiftindex 169f95c5..b31cb70c 100644--- a/Sources/Fluid/Services/Meeting/MeetingAutoDetectSignals.swift+++ b/Sources/Fluid/Services/Meeting/MeetingAutoDetectSignals.swift@@ -726,6 +726,8 @@ final class AXBrowserTabReader: BrowserTabReading {/// groups, scroll area); Chrome and Edge sit shallower. Chrome-side subtrees are skipped by role.private static let maxDepth = 9private static let maxChildrenPerLevel = 24+ /// Upper bound on elements visited per read; keeps a sprawling window from stalling the poll loop.+ private static let maxVisitedElements = 300nonisolated private static let skippedRoles: Set<String> = ["AXToolbar", "AXMenuBar", "AXMenu", "AXPopUpButton", "AXButton", "AXTextField", "AXStaticText", "AXImage"]private static let circuitBreakerThreshold = 2@@ -789,14 +791,16 @@ final class AXBrowserTabReader: BrowserTabReading {}var timedOut = false- if let found = self.breadthFirstFindWebAreaURL(root: windowElement, depth: 0, timedOut: &timedOut) {+ var budget = Self.maxVisitedElements+ if let found = self.findWebAreaURL(root: windowElement, depth: 0, budget: &budget, timedOut: &timedOut) {return .found(found)}return timedOut ? .timedOut : .notFound("document=\(document == nil ? "nil" : "set") webarea=miss")}- nonisolated private static func breadthFirstFindWebAreaURL(root: AXUIElement, depth: Int, timedOut: inout Bool) -> BrowserTabURL? {- guard depth < Self.maxDepth else { return nil }+ /// Depth-first over container roles only; each level checks its own children for a web area first.+ nonisolated private static func findWebAreaURL(root: AXUIElement, depth: Int, budget: inout Int, timedOut: inout Bool) -> BrowserTabURL? {+ guard depth < Self.maxDepth, budget > 0 else { return nil }var childrenValue: CFTypeRef?let status = AXUIElementCopyAttributeValue(root, kAXChildrenAttribute as CFString, &childrenValue)if status == .cannotComplete { timedOut = true; return nil }@@ -804,6 +808,8 @@ final class AXBrowserTabReader: BrowserTabReading {var containers: [AXUIElement] = []for child in children.prefix(Self.maxChildrenPerLevel) {+ budget -= 1+ guard budget > 0 else { return nil }let role = self.stringAttribute(child, attribute: kAXRoleAttribute as String) ?? ""if role == "AXWebArea" {if let urlString = self.stringAttribute(child, attribute: "AXURL"), let url = self.parse(urlString) {@@ -814,10 +820,10 @@ final class AXBrowserTabReader: BrowserTabReading {if !Self.skippedRoles.contains(role) { containers.append(child) }}for child in containers {- if let found = self.breadthFirstFindWebAreaURL(root: child, depth: depth + 1, timedOut: &timedOut) {+ if let found = self.findWebAreaURL(root: child, depth: depth + 1, budget: &budget, timedOut: &timedOut) {return found}- if timedOut { return nil }+ if timedOut || budget <= 0 { return nil }}return nil}diff --git a/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift b/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swiftindex e375e0b1..e0b9864b 100644--- a/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift+++ b/Sources/Fluid/Services/Meeting/MeetingAutoDetector.swift@@ -300,8 +300,10 @@ final class MeetingAutoDetector {for pid in self.records.keys {guard var record = self.records[pid] else { continue }// A browser the user has been sitting in for minutes (Calendar → Meet) never re-activates;- // being in front at the moment the mic opens is equally strong evidence.- if frontmostPID == pid, !self.isFrontmostNearEdge(record, edge: now) {+ // being in front at the moment the mic opens is equally strong evidence because the tab+ // URL still gates confirmation. Native apps keep the activation rule: Teams and Webex+ // windows persist all day and would otherwise confirm on any unrelated mic edge.+ if record.tier == .browserTier2, frontmostPID == pid, !self.isFrontmostNearEdge(record, edge: now) {record.lastFrontmostAt = nowself.records[pid] = record}diff --git a/Sources/Fluid/UI/MeetingDetectionPrompt.swift b/Sources/Fluid/UI/MeetingDetectionPrompt.swiftindex cd07832b..8456d298 100644--- a/Sources/Fluid/UI/MeetingDetectionPrompt.swift+++ b/Sources/Fluid/UI/MeetingDetectionPrompt.swift@@ -573,7 +573,7 @@ private struct MeetingDetectionPromptContent: View {.menuStyle(.button).fluidButton(.compact, size: .small).disabled(self.controller.isStarting)- .help("Click to dismiss. Hold for more options.")+ .help("Click to dismiss. Use the arrow for more options.")Button {self.controller.startTapped()diff --git a/Sources/Fluid/UI/MeetingRecordingSettingsSheet.swift b/Sources/Fluid/UI/MeetingRecordingSettingsSheet.swiftindex 74740978..2d5292fb 100644--- a/Sources/Fluid/UI/MeetingRecordingSettingsSheet.swift+++ b/Sources/Fluid/UI/MeetingRecordingSettingsSheet.swift@@ -78,7 +78,7 @@ struct MeetingRecordingSettingsSheet: View {}private var canSave: Bool {- guard self.draft.selectedMicrophoneID != nil else { return false }+ guard self.microphones.contains(where: { $0.id == self.draft.selectedMicrophoneID }) else { return false }return self.draft.mode == .inRoom|| self.draft.usesAutomaticApplication|| self.applications.contains { $0.id == self.draft.selectedApplicationID }@@ -86,13 +86,15 @@ struct MeetingRecordingSettingsSheet: View {private var saveHelp: String? {guard !self.canSave else { return nil }- if let blockingMessage = readiness.blockingMessage {- return blockingMessage- }- if self.draft.selectedMicrophoneID == nil {+ if !self.microphones.contains(where: { $0.id == self.draft.selectedMicrophoneID }) {return "Choose an available microphone to save this setup."}- return "Choose an available meeting application to save this setup."+ if self.draft.mode == .onlineCall, !self.draft.usesAutomaticApplication,+ !self.applications.contains(where: { $0.id == self.draft.selectedApplicationID })+ {+ return "Choose an available meeting application to save this setup."+ }+ return self.readiness.blockingMessage}var body: some View {diff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swiftindex 7b7f0b82..73caabe3 100644--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift@@ -467,7 +467,7 @@ struct MeetingTranscriptionView: View {activityStatus: conflictingActivity.map { "Wait for \($0.displayName)" } ?? "Ready",activityReady: activityReady,showMicrophoneSettingsAction: microphoneStatus == .denied,- showScreenRecordingSettingsAction: !meetingAudioReady,+ showScreenRecordingSettingsAction: self.setupDraft.mode == .onlineCall && !self.cachedScreenCaptureAccess,blockingMessage: blockingMessage)}@@ -1873,6 +1873,9 @@ private struct MeetingSetupCanvas: View {private var planDetail: String {if let app = resolvedApplication { return "\(app.identity.displayName) and your mic will be recorded." }if self.draft.mode == .inRoom { return "Your mic will record the room." }+ if self.readiness.showScreenRecordingSettingsAction {+ return "Your mic will record the room. Allow Screen & System Audio access to capture meeting apps too."+ }if self.applications.isEmpty { return "Your mic will record the room. No meeting apps are available to capture yet." }return "Your mic will record the room. If a call is running, pick its app under Change."}@@ -1978,9 +1981,9 @@ private struct MeetingSetupCanvas: View {}}}- if self.applications.isEmpty {+ if self.readiness.showScreenRecordingSettingsAction {Divider()- Button("No apps found · Allow meeting audio access…", systemImage: "arrow.up.right", action: self.onRepairSetup)+ Button("Allow meeting audio access…", systemImage: "arrow.up.right", action: self.onRepairSetup)}Divider()Button("More settings…", systemImage: "gearshape", action: self.onEditSetup)@@ -2048,9 +2051,10 @@ private struct MeetingSetupCanvas: View {}@ViewBuilder private var permissionAction: some View {- if !self.canStart, !self.readiness.isCheckingSources,- self.readiness.showMicrophoneSettingsAction || self.readiness.showScreenRecordingSettingsAction ||- !self.readiness.modelReady || !self.readiness.microphoneReady || self.draft.selectedMicrophoneID == nil+ if !self.readiness.isCheckingSources,+ self.readiness.showScreenRecordingSettingsAction ||+ (!self.canStart && (self.readiness.showMicrophoneSettingsAction ||+ !self.readiness.modelReady || !self.readiness.microphoneReady || self.draft.selectedMicrophoneID == nil)){Button(self.readiness.showMicrophoneSettingsAction ? "Allow microphone access" :diff --git a/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift b/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swiftindex 9b49e0a2..0aee1363 100644--- a/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift+++ b/Tests/FluidDictationIntegrationTests/MeetingAutoDetectorTests.swift@@ -14,6 +14,7 @@ private final class FakeClock: MeetingClockProviding {@MainActorprivate final class FakeWorkspaceEvents: WorkspaceEventsProviding {var onEvent: ((WorkspaceEvent) -> Void)?+ var frontmostProcessID: Int32?func start(isRegistryApp: @escaping (String) -> Bool, onBackfill: @escaping ([WorkspaceEvent]) -> Void) {}func stop() {}}@@ -92,6 +93,7 @@ private final class DetectorHarness {let flags = ToggleFlags()let audioProcessActivity = FakeAudioProcessActivity()let windowProvider = FakeWindowSnapshotProvider()+ let workspace = FakeWorkspaceEvents()var prompts: [MeetingAutoDetector.PromptRequest] = []var nudges = 0var invalidated: [UUID] = []@@ -110,7 +112,7 @@ private final class DetectorHarness {init() {let flags = self.flagsself.detector = MeetingAutoDetector(- workspaceEvents: FakeWorkspaceEvents(),+ workspaceEvents: self.workspace,micActivity: FakeMicActivity(),audioProcessActivity: self.audioProcessActivity,windowSnapshotProvider: self.windowProvider,@@ -705,6 +707,39 @@ final class MeetingAutoDetectorTests: XCTestCase {XCTAssertTrue(h.prompts.isEmpty, "backfill seeds no frontmost timestamp, so it can never confirm by itself")}+ func testBackfilledBrowserInFrontAtMicEdgeConfirms() {+ let h = DetectorHarness()+ h.browserEnabled = true+ h.workspace.frontmostProcessID = 8+ h.detector.handleBackfill([.init(kind: .launched, bundleIdentifier: "com.google.Chrome", processID: 8)])+ h.detector.handleBrowserTabURL(.init(host: "meet.google.com", path: "/abc-defg-hij"), pid: 8, bundleIdentifier: "com.google.Chrome", at: h.clock.now())+ h.detector.handleMicEdge(.init(isActive: true), at: h.clock.now())+ XCTAssertEqual(h.prompts.count, 1, "a browser already in front when the mic opens is frontmost evidence; the in-call URL still gates it")+ XCTAssertEqual(h.prompts.first?.serviceName, "Google Meet")+ }++ func testBackfilledBrowserInFrontWithoutInCallURLDoesNotConfirm() {+ let h = DetectorHarness()+ h.browserEnabled = true+ h.workspace.frontmostProcessID = 8+ h.detector.handleBackfill([.init(kind: .launched, bundleIdentifier: "com.google.Chrome", processID: 8)])+ h.detector.handleBrowserTabURL(.init(host: "meet.google.com", path: "/landing"), pid: 8, bundleIdentifier: "com.google.Chrome", at: h.clock.now())+ h.detector.handleMicEdge(.init(isActive: true), at: h.clock.now())+ XCTAssertTrue(h.prompts.isEmpty, "frontmost-now never substitutes for window evidence")+ }++ func testBackfilledNativeAppInFrontAtMicEdgeStillNeedsActivation() {+ let h = DetectorHarness()+ h.workspace.frontmostProcessID = 7+ h.detector.handleBackfill([.init(kind: .launched, bundleIdentifier: "us.zoom.xos", processID: 7)])+ h.detector.handleWindowSnapshot(+ [.init(processID: 7, windowID: 1, title: "Zoom Meeting", layer: 0)],+ at: h.clock.now()+ )+ h.detector.handleMicEdge(.init(isActive: true), at: h.clock.now())+ XCTAssertTrue(h.prompts.isEmpty, "native apps keep the activation rule; their windows persist all day")+ }+// MARK: Episode dedup + back-to-back re-armfunc testDuplicateConfirmDoesNotReprompt() {