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.

This commit is contained in:
Beingpax 2025-09-16 10:30:58 +05:45
parent 848489c98b
commit e6225050cc
4 changed files with 29 additions and 13 deletions

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
</Workspace>

View File

@ -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)";

View File

@ -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 + " ")
}
}

View File

@ -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()