Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions speaktype.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_TEAM = PCV4UMSRZX;
DEVELOPMENT_TEAM = STBJ5W6TPK;
ENABLE_APP_SANDBOX = NO;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -467,7 +467,7 @@
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_TEAM = PCV4UMSRZX;
DEVELOPMENT_TEAM = STBJ5W6TPK;
ENABLE_APP_SANDBOX = NO;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
Expand Down
2 changes: 1 addition & 1 deletion speaktype/Controllers/MiniRecorderWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class MiniRecorderWindowController: NSObject {

// 6. Paste using CGEvent (Accessibility permission only)
await MainActor.run {
ClipboardService.shared.paste()
//ClipboardService.shared.paste()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions speaktype/Services/AudioRecordingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ class AudioRecordingService: NSObject, ObservableObject {
self.captureSession?.stopRunning()
self.isStopping = false
self.shouldDiscardCurrentRecordingOutput = false
self.captureSession?.stopRunning() // ← ADD THIS LINE
continuation.resume(returning: finalizedRecordingURL)
}
}
Expand Down
38 changes: 20 additions & 18 deletions speaktype/Services/ClipboardService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ class ClipboardService {
}

private init() {}

// Copy text to system clipboard with optional promotional wrapper

private func wrapTextIfNeeded(_ text: String) -> String {
return text
}

func copy(text: String) {
let finalText = wrapTextIfNeeded(text)

let pasteboard = NSPasteboard.general
pasteboard.clearContents()
pasteboard.setString(finalText, forType: .string)

// Verify write
if let check = pasteboard.string(forType: .string), check == finalText {
print("✅ Clipboard Write Verified: '\(check.prefix(20))...'")
} else {
print("❌ Clipboard Write FAILED!")

// Type each character directly without touching the clipboard
DispatchQueue.main.async {
let source = CGEventSource(stateID: .hidSystemState)
for scalar in finalText.unicodeScalars {
let char = UniChar(scalar.value)
var charArray = [char]
let keyDown = CGEvent(keyboardEventSource: source, virtualKey: 0, keyDown: true)
keyDown?.keyboardSetUnicodeString(stringLength: 1, unicodeString: &charArray)
let keyUp = CGEvent(keyboardEventSource: source, virtualKey: 0, keyDown: false)
keyUp?.keyboardSetUnicodeString(stringLength: 1, unicodeString: &charArray)
keyDown?.post(tap: .cghidEventTap)
keyUp?.post(tap: .cghidEventTap)
}
print("✅ Typed directly: '\(finalText.prefix(20))...'")
}
}

// Wrap text with promotional message for free users
private func wrapTextIfNeeded(_ text: String) -> String {
// License check disabled - always allow unwrapped text
return text
}

// Paste content (Simulate Cmd+V)
func paste() {
// Create a concurrent task to avoid blocking main thread if needed,
Expand Down
2 changes: 1 addition & 1 deletion speaktype/Views/TranscribeAudioView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ struct TranscribeAudioView: View {
.buttonStyle(.stSecondary)

Button(action: {
ClipboardService.shared.paste()
//ClipboardService.shared.paste()
}) {
HStack(spacing: 6) {
Image(systemName: "doc.on.clipboard")
Expand Down