From 376781d691f737dcf580e0e4f992ccab6e17fe22 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Fri, 1 Aug 2025 18:55:41 +0545 Subject: [PATCH] Remove auto-copy toggle, use clipboard preservation --- VoiceInk/Services/ImportExportService.swift | 10 ++++------ VoiceInk/Views/MenuBarView.swift | 12 ------------ VoiceInk/Views/Settings/SettingsView.swift | 5 ----- VoiceInk/Whisper/WhisperState.swift | 12 ++---------- 4 files changed, 6 insertions(+), 33 deletions(-) diff --git a/VoiceInk/Services/ImportExportService.swift b/VoiceInk/Services/ImportExportService.swift index ea3c18b..e464e5d 100644 --- a/VoiceInk/Services/ImportExportService.swift +++ b/VoiceInk/Services/ImportExportService.swift @@ -15,7 +15,7 @@ struct GeneralSettings: Codable { let recorderType: String? let isAudioCleanupEnabled: Bool? let audioRetentionPeriod: Int? - let isAutoCopyEnabled: Bool? + let isSoundFeedbackEnabled: Bool? let isSystemMuteEnabled: Bool? let isPauseMediaEnabled: Bool? @@ -46,7 +46,7 @@ class ImportExportService { private let keyRecorderType = "RecorderType" private let keyIsAudioCleanupEnabled = "IsAudioCleanupEnabled" private let keyAudioRetentionPeriod = "AudioRetentionPeriod" - private let keyIsAutoCopyEnabled = "IsAutoCopyEnabled" + private let keyIsSoundFeedbackEnabled = "isSoundFeedbackEnabled" private let keyIsSystemMuteEnabled = "isSystemMuteEnabled" private let keyIsTextFormattingEnabled = "IsTextFormattingEnabled" @@ -91,7 +91,7 @@ class ImportExportService { recorderType: whisperState.recorderType, isAudioCleanupEnabled: UserDefaults.standard.bool(forKey: keyIsAudioCleanupEnabled), audioRetentionPeriod: UserDefaults.standard.integer(forKey: keyAudioRetentionPeriod), - isAutoCopyEnabled: whisperState.isAutoCopyEnabled, + isSoundFeedbackEnabled: soundManager.isEnabled, isSystemMuteEnabled: mediaController.isSystemMuteEnabled, isPauseMediaEnabled: playbackController.isPauseMediaEnabled, @@ -241,9 +241,7 @@ class ImportExportService { if let audioRetention = general.audioRetentionPeriod { UserDefaults.standard.set(audioRetention, forKey: self.keyAudioRetentionPeriod) } - if let autoCopy = general.isAutoCopyEnabled { - whisperState.isAutoCopyEnabled = autoCopy - } + if let soundFeedback = general.isSoundFeedbackEnabled { soundManager.isEnabled = soundFeedback } diff --git a/VoiceInk/Views/MenuBarView.swift b/VoiceInk/Views/MenuBarView.swift index b3856e7..acf0105 100644 --- a/VoiceInk/Views/MenuBarView.swift +++ b/VoiceInk/Views/MenuBarView.swift @@ -117,18 +117,6 @@ struct MenuBarView: View { .disabled(!enhancementService.isEnhancementEnabled) Menu("Additional") { - Button { - whisperState.isAutoCopyEnabled.toggle() - } label: { - HStack { - Text("Auto-copy to Clipboard") - Spacer() - if whisperState.isAutoCopyEnabled { - Image(systemName: "checkmark") - } - } - } - Button { SoundManager.shared.isEnabled.toggle() menuRefreshTrigger.toggle() diff --git a/VoiceInk/Views/Settings/SettingsView.swift b/VoiceInk/Views/Settings/SettingsView.swift index 4583164..99baba9 100644 --- a/VoiceInk/Views/Settings/SettingsView.swift +++ b/VoiceInk/Views/Settings/SettingsView.swift @@ -112,11 +112,6 @@ struct SettingsView: View { subtitle: "Customize app & system feedback" ) { VStack(alignment: .leading, spacing: 12) { - Toggle(isOn: $whisperState.isAutoCopyEnabled) { - Text("Auto-copy to clipboard") - } - .toggleStyle(.switch) - Toggle(isOn: .init( get: { SoundManager.shared.isEnabled }, set: { SoundManager.shared.isEnabled = $0 } diff --git a/VoiceInk/Whisper/WhisperState.swift b/VoiceInk/Whisper/WhisperState.swift index bcb4a75..db06558 100644 --- a/VoiceInk/Whisper/WhisperState.swift +++ b/VoiceInk/Whisper/WhisperState.swift @@ -27,11 +27,7 @@ class WhisperState: NSObject, ObservableObject { @Published var clipboardMessage = "" @Published var miniRecorderError: String? @Published var shouldCancelRecording = false - @Published var isAutoCopyEnabled: Bool = UserDefaults.standard.object(forKey: "IsAutoCopyEnabled") as? Bool ?? true { - didSet { - UserDefaults.standard.set(isAutoCopyEnabled, forKey: "IsAutoCopyEnabled") - } - } + @Published var recorderType: String = UserDefaults.standard.string(forKey: "RecorderType") ?? "mini" { didSet { UserDefaults.standard.set(recorderType, forKey: "RecorderType") @@ -350,11 +346,7 @@ class WhisperState: NSObject, ObservableObject { DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { - CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: !self.isAutoCopyEnabled) - - if self.isAutoCopyEnabled { - ClipboardManager.copyToClipboard(text) - } + CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: true) // Automatically press Enter if the active Power Mode configuration allows it. let powerMode = PowerModeManager.shared