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
refactor(settings): group dictation formatting and filler controls
altic-dev24aeeba414e9
diff --git a/Sources/Fluid/UI/AISettings/VoiceEngineSettingsViewModel.swift b/Sources/Fluid/UI/AISettings/VoiceEngineSettingsViewModel.swiftindex 8ca7b4f1..7fc740c3 100644--- a/Sources/Fluid/UI/AISettings/VoiceEngineSettingsViewModel.swift+++ b/Sources/Fluid/UI/AISettings/VoiceEngineSettingsViewModel.swift@@ -44,14 +44,11 @@ final class VoiceEngineSettingsViewModel: ObservableObject {self.asr.isCancellingModelDownload}- @Published var removeFillerWordsEnabled: Bool-init(settings: SettingsStore, appServices: AppServices) {self.settings = settingsself.appServices = appServicesself.previewSpeechModel = settings.selectedSpeechModelself.selectedSpeechProvider = settings.selectedSpeechModel.provider- self.removeFillerWordsEnabled = settings.removeFillerWordsEnabledappServices.objectWillChange.sink { [weak self] _ inTask { @MainActor in@@ -64,7 +61,6 @@ final class VoiceEngineSettingsViewModel: ObservableObject {func onAppear() {self.previewSpeechModel = self.settings.selectedSpeechModelself.selectedSpeechProvider = self.settings.selectedSpeechModel.provider- self.removeFillerWordsEnabled = self.settings.removeFillerWordsEnabledTask {await self.asr.checkIfModelsExistAsync()diff --git a/Sources/Fluid/UI/AISettingsView+SpeechRecognition.swift b/Sources/Fluid/UI/AISettingsView+SpeechRecognition.swiftindex f290291e..b004099c 100644--- a/Sources/Fluid/UI/AISettingsView+SpeechRecognition.swift+++ b/Sources/Fluid/UI/AISettingsView+SpeechRecognition.swift@@ -120,11 +120,6 @@ extension VoiceEngineSettingsView {).shadow(color: self.theme.metrics.cardShadow.color.opacity(self.theme.metrics.cardShadow.opacity), radius: self.theme.metrics.cardShadow.radius, x: self.theme.metrics.cardShadow.x, y: self.theme.metrics.cardShadow.y))-- Divider().padding(.vertical, 4)-- // Filler Words Section- self.fillerWordsSection}}}@@ -755,32 +750,6 @@ extension VoiceEngineSettingsView {.overlay(RoundedRectangle(cornerRadius: 8).stroke(self.theme.palette.cardBorder.opacity(0.5), lineWidth: 1)))}- var fillerWordsSection: some View {- VStack(alignment: .leading, spacing: 8) {- HStack(alignment: .center) {- VStack(alignment: .leading, spacing: 2) {- Text("Remove Filler Words")- .font(self.theme.typography.bodyStrong)- .foregroundStyle(self.voiceEngineTitleText)- Text("Automatically remove filler sounds like 'um', 'uh', 'er' from transcriptions")- .font(self.theme.typography.bodySmall)- .foregroundStyle(self.voiceEngineSecondaryText)- }- Spacer()- Toggle("", isOn: self.$viewModel.removeFillerWordsEnabled)- .toggleStyle(.switch)- .labelsHidden()- .onChange(of: self.viewModel.removeFillerWordsEnabled) { _, newValue in- self.settings.removeFillerWordsEnabled = newValue- }- }-- if self.viewModel.removeFillerWordsEnabled {- FillerWordsEditor()- }- }- }-// MARK: - Speech Model Logo Viewprivate func speechModelLogoView(for model: SettingsStore.SpeechModel) -> some View {diff --git a/Sources/Fluid/UI/AppNavigationState.swift b/Sources/Fluid/UI/AppNavigationState.swiftindex 05e1a5ed..b250e76c 100644--- a/Sources/Fluid/UI/AppNavigationState.swift+++ b/Sources/Fluid/UI/AppNavigationState.swift@@ -26,6 +26,7 @@ enum SidebarItem: Hashable {enum SettingsSection: String, CaseIterable, Identifiable, Hashable {case generalcase dictation+ case dictationFormattingcase shortcutscase notificationscase audio@@ -41,6 +42,7 @@ enum SettingsSection: String, CaseIterable, Identifiable, Hashable {switch self {case .general: return "General"case .dictation: return "Dictation"+ case .dictationFormatting: return "Dictation Formatting"case .shortcuts: return "Shortcuts"case .notifications: return "Notifications"case .audio: return "Audio"@@ -54,6 +56,7 @@ enum SettingsSection: String, CaseIterable, Identifiable, Hashable {switch self {case .general: return "gearshape"case .dictation: return "mic"+ case .dictationFormatting: return "textformat"case .shortcuts: return "keyboard"case .notifications: return "bell"case .audio: return "speaker.wave.2"diff --git a/Sources/Fluid/UI/SettingsSearch.swift b/Sources/Fluid/UI/SettingsSearch.swiftindex 2dbe7334..94663199 100644--- a/Sources/Fluid/UI/SettingsSearch.swift+++ b/Sources/Fluid/UI/SettingsSearch.swift@@ -41,6 +41,8 @@ enum SettingsSearchTarget: Hashable {case dictionarySuggestionscase accessibilityPermissioncase textFormatting+ case spokenFormatting+ case fillerWordscase notificationscase aiEnhancementFailures@@ -93,10 +95,12 @@ enum SettingsSearchTarget: Hashable {.skipSilentRecordings,.pauseMedia,.dictionarySuggestions,- .accessibilityPermission,- .textFormatting:+ .accessibilityPermission:return .dictation+ case .textFormatting, .spokenFormatting, .fillerWords:+ return .dictationFormatting+case .shortcuts, .globalHotkey, .primaryDictationShortcuts,.commandModeShortcut, .editModeShortcut, .cancelRecordingShortcut,.pasteLastTranscriptionShortcut:@@ -131,6 +135,7 @@ extension SettingsSection {switch self {case .general: return .generalcase .dictation: return .dictation+ case .dictationFormatting: return .textFormattingcase .shortcuts: return .shortcutscase .notifications: return .notificationscase .audio: return .audio@@ -335,11 +340,13 @@ enum SettingsSearchIndex {target: .textFormatting,title: "Text Formatting",terms: [- "Lowercase First Letter Remove Trailing Period Slash Commands @ Formatting",+ "Dictation Formatting Lowercase First Letter Remove Trailing Period Slash Commands @ Formatting","Space Between Dictations Smart Capitalization punctuation uppercase symbols mentions",]),+ .init(target: .spokenFormatting, title: "Spoken Formatting", terms: ["punctuation start word symbols new line paragraph"]),+ .init(target: .fillerWords, title: "Remove Filler Words", terms: ["um uh er filler sounds cleanup"]),.init(target: .notifications, title: "Notifications", terms: ["alerts warnings"]),.init(target: .aiEnhancementFailures,diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swiftindex b610ae63..71f64832 100644--- a/Sources/Fluid/UI/SettingsView.swift+++ b/Sources/Fluid/UI/SettingsView.swift@@ -1101,7 +1101,29 @@ struct SettingsView: View {.padding(16)}.settingsSearchTarget(.textFormatting)- .shownInSettingsSection(.dictation, selectedSection: self.selectedSection)+ .shownInSettingsSection(.dictationFormatting, selectedSection: self.selectedSection)++ if self.selectedSection == .dictationFormatting {+ CustomDictionaryView(formattingOnly: true)+ .settingsSearchTarget(.spokenFormatting)+ ThemedCard(style: .standard) {+ VStack(alignment: .leading, spacing: 14) {+ self.settingsToggleRow(+ title: "Remove Filler Words",+ description: "Remove filler sounds like ‘um’, ‘uh’, and ‘er’ from transcriptions.",+ isOn: Binding(+ get: { self.settings.removeFillerWordsEnabled },+ set: { self.settings.removeFillerWordsEnabled = $0 }+ )+ )+ if self.settings.removeFillerWordsEnabled {+ FillerWordsEditor()+ }+ }+ .padding(16)+ }+ .settingsSearchTarget(.fillerWords)+ }// Notification Settings CardThemedCard(style: .standard) {@@ -2140,7 +2162,7 @@ struct SettingsView: View {} label: {Label("Add shortcut", systemImage: "plus")}- .buttonStyle(ShortcutHoverButtonStyle())+ .buttonStyle(FluidHoverIconButtonStyle()).disabled(self.isRecordingAnyShortcut)}if isAdding, let message = self.shortcutRecordingMessage {@@ -2212,13 +2234,13 @@ private extension SettingsView {if isRecording {Image(systemName: "xmark").font(.fluidSystem(size: 14, weight: .medium))} else {- ShortcutPencilShape().stroke(style: StrokeStyle(lineWidth: 1.7, lineCap: .round, lineJoin: .round))+ FluidPencilShape().stroke(style: StrokeStyle(lineWidth: 1.7, lineCap: .round, lineJoin: .round)).frame(width: 20, height: 20)}}.frame(width: 28, height: 28)}- .buttonStyle(ShortcutHoverButtonStyle())+ .buttonStyle(FluidHoverIconButtonStyle()).help(isRecording ? "Cancel recording" : "Set shortcut").accessibilityLabel(isRecording ? "Cancel recording \(title)" : "Edit \(title)").disabled(!isRecording && self.isRecordingAnyShortcut)@@ -2228,7 +2250,7 @@ private extension SettingsView {} label: {Image(systemName: "trash").frame(width: 28, height: 28)}- .buttonStyle(ShortcutHoverButtonStyle())+ .buttonStyle(FluidHoverIconButtonStyle()).help("Remove shortcut").accessibilityLabel("Remove \(title)").disabled(onRemove == nil || shortcut == nil || self.isRecordingAnyShortcut)@@ -2674,7 +2696,7 @@ private extension SettingsView {await self.prepareAudioSettings()case .dictation:await self.refreshAudioHistoryUsageInBackground()- case .shortcuts, .notifications, .overlay, .dataAndDiagnostics, .experimental:+ case .dictationFormatting, .shortcuts, .notifications, .overlay, .dataAndDiagnostics, .experimental:break}}@@ -3158,46 +3180,3 @@ private extension SettingsView {.settingsSearchTarget(.returnToStartingField)}}--private struct ShortcutPencilShape: Shape {- func path(in rect: CGRect) -> Path {- var path = Path()- func point(_ x: CGFloat, _ y: CGFloat) -> CGPoint { CGPoint(x: rect.minX + x * rect.width, y: rect.minY + y * rect.height) }- path.move(to: point(0.12, 0.88))- path.addLine(to: point(0.19, 0.62))- path.addLine(to: point(0.69, 0.12))- path.addQuadCurve(to: point(0.82, 0.12), control: point(0.755, 0.055))- path.addLine(to: point(0.88, 0.18))- path.addQuadCurve(to: point(0.88, 0.31), control: point(0.945, 0.245))- path.addLine(to: point(0.38, 0.81))- path.closeSubpath()- path.move(to: point(0.62, 0.19))- path.addLine(to: point(0.81, 0.38))- path.move(to: point(0.19, 0.62))- path.addLine(to: point(0.38, 0.81))- return path- }-}--private struct ShortcutHoverButtonStyle: ButtonStyle {- func makeBody(configuration: Configuration) -> some View {- HoverContent(configuration: configuration)- }-- private struct HoverContent: View {- let configuration: ButtonStyle.Configuration- @Environment(\.isEnabled) private var isEnabled- @Environment(\.theme) private var theme- @State private var isHovered = false-- var body: some View {- self.configuration.label- .foregroundStyle(self.isHovered && self.isEnabled ? self.theme.palette.accent : self.theme.palette.secondaryText)- .padding(4)- .background(RoundedRectangle(cornerRadius: 7).fill(self.theme.palette.accent.opacity(self.isEnabled && (self.isHovered || self.configuration.isPressed) ? 0.14 : 0)))- .contentShape(Rectangle())- .opacity(self.isEnabled ? 1 : 0.4)- .onHover { self.isHovered = $0 }- }- }-}diff --git a/Tests/FluidDictationIntegrationTests/SettingsNavigationStateTests.swift b/Tests/FluidDictationIntegrationTests/SettingsNavigationStateTests.swiftindex 6e604755..75ccf66d 100644--- a/Tests/FluidDictationIntegrationTests/SettingsNavigationStateTests.swift+++ b/Tests/FluidDictationIntegrationTests/SettingsNavigationStateTests.swift@@ -114,7 +114,7 @@ final class SettingsNavigationStateTests: XCTestCase {func testSettingsSectionsHaveStableTitlesAndIcons() {XCTAssertEqual(SettingsSection.allCases.map(\.title),- ["General", "Dictation", "Shortcuts", "Notifications", "Audio", "Overlay", "Data & Diagnostics", "Experimental"]+ ["General", "Dictation", "Dictation Formatting", "Shortcuts", "Notifications", "Audio", "Overlay", "Data & Diagnostics", "Experimental"])XCTAssertTrue(SettingsSection.allCases.allSatisfy { !$0.systemImage.isEmpty })XCTAssertEqual(SettingsSection.overlay.systemImage, "rectangle.on.rectangle")@@ -130,6 +130,15 @@ final class SettingsNavigationStateTests: XCTestCase {XCTAssertEqual(state.dismiss(), .cleanupStyles)}+ func testFormattingSearchRoutesToDedicatedSection() {+ XCTAssertEqual(SettingsSearchIndex.results(for: "Dictation Formatting").first?.section, .dictationFormatting)+ XCTAssertEqual(SettingsSearchIndex.results(for: "Text Formatting").first?.section, .dictationFormatting)+ XCTAssertEqual(SettingsSearchIndex.results(for: "Spoken Formatting").first?.section, .dictationFormatting)+ XCTAssertEqual(SettingsSearchIndex.results(for: "Remove Filler Words").first?.section, .dictationFormatting)+ XCTAssertEqual(SettingsSearchTarget.copyToClipboard.section, .dictation)+ XCTAssertEqual(SettingsSearchTarget.inputDevicePriority.section, .audio)+ }+func testSettingsSearchRanksExactTitleAheadOfRelatedTerms() {let results = SettingsSearchIndex.results(for: "Copy to Clipboard")