From e6225050ccfad49d79388b08f34b4864e689b704 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Tue, 16 Sep 2025 10:30:58 +0545 Subject: [PATCH] Prefer enhanced text with graceful fallback: paste enhanced falls back to original; copy last transcription now mirrors same behavior; updated Settings description to reflect single-shortcut-friendly design. --- .../contents.xcworkspacedata | 4 +++ VoiceInk.xcodeproj/project.pbxproj | 8 +++--- .../Services/LastTranscriptionService.swift | 28 +++++++++++++------ VoiceInk/Views/Settings/SettingsView.swift | 2 +- 4 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 5.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/5.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/5.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..94b2795 --- /dev/null +++ b/5.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,4 @@ + + + diff --git a/VoiceInk.xcodeproj/project.pbxproj b/VoiceInk.xcodeproj/project.pbxproj index 63a704e..56baed2 100644 --- a/VoiceInk.xcodeproj/project.pbxproj +++ b/VoiceInk.xcodeproj/project.pbxproj @@ -459,7 +459,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 153; + CURRENT_PROJECT_VERSION = "155Okay, what do you think about the future of AI? "; DEVELOPMENT_ASSET_PATHS = "\"VoiceInk/Preview Content\""; DEVELOPMENT_TEAM = V6J6A3VWY2; ENABLE_HARDENED_RUNTIME = YES; @@ -474,7 +474,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 1.53; + MARKETING_VERSION = 1.55; PRODUCT_BUNDLE_IDENTIFIER = com.prakashjoshipax.VoiceInk; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; @@ -493,7 +493,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 153; + CURRENT_PROJECT_VERSION = "155Okay, what do you think about the future of AI? "; DEVELOPMENT_ASSET_PATHS = "\"VoiceInk/Preview Content\""; DEVELOPMENT_TEAM = V6J6A3VWY2; ENABLE_HARDENED_RUNTIME = YES; @@ -508,7 +508,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 14.0; - MARKETING_VERSION = 1.53; + MARKETING_VERSION = 1.55; PRODUCT_BUNDLE_IDENTIFIER = com.prakashjoshipax.VoiceInk; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "ENABLE_NATIVE_SPEECH_ANALYZER $(inherited)"; diff --git a/VoiceInk/Services/LastTranscriptionService.swift b/VoiceInk/Services/LastTranscriptionService.swift index 28899e4..e888e8c 100644 --- a/VoiceInk/Services/LastTranscriptionService.swift +++ b/VoiceInk/Services/LastTranscriptionService.swift @@ -29,7 +29,16 @@ class LastTranscriptionService: ObservableObject { return } - let success = ClipboardManager.copyToClipboard(lastTranscription.text) + // Prefer enhanced text; fallback to original text + let textToCopy: String = { + if let enhancedText = lastTranscription.enhancedText, !enhancedText.isEmpty { + return enhancedText + } else { + return lastTranscription.text + } + }() + + let success = ClipboardManager.copyToClipboard(textToCopy) Task { @MainActor in if success { @@ -76,15 +85,18 @@ class LastTranscriptionService: ObservableObject { return } - // Only paste if enhancement exists; this includes actual enhancement text or an error message saved in enhancedText. - guard let enhancedText = lastTranscription.enhancedText, !enhancedText.isEmpty else { - // Per requirements, do nothing when there is no enhancement. - return - } - + // Prefer enhanced text; if unavailable, fallback to original text (which may contain an error message) + let textToPaste: String = { + if let enhancedText = lastTranscription.enhancedText, !enhancedText.isEmpty { + return enhancedText + } else { + return lastTranscription.text + } + }() + // Delay to allow modifier keys to be released DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) { - CursorPaster.pasteAtCursor(enhancedText + " ") + CursorPaster.pasteAtCursor(textToPaste + " ") } } diff --git a/VoiceInk/Views/Settings/SettingsView.swift b/VoiceInk/Views/Settings/SettingsView.swift index d596bc2..0a7a11b 100644 --- a/VoiceInk/Views/Settings/SettingsView.swift +++ b/VoiceInk/Views/Settings/SettingsView.swift @@ -102,7 +102,7 @@ struct SettingsView: View { InfoTip( title: "Paste Last Transcript(Enhanced)", - message: "Shortcut for pasting the most recent transcript(enhanced). If no enhancement exists, nothing is pasted. If the enhancement failed, the error message is pasted." + message: "Pastes the enhanced transcript if available, otherwise falls back to the original." ) Spacer()