Fix compiler warnings and update deprecated API.
This commit is contained in:
parent
78982b6b62
commit
e77ecb12c7
@ -22,7 +22,7 @@ class CursorPaster {
|
||||
|
||||
// Use the preferred paste method based on user settings
|
||||
if UserDefaults.standard.bool(forKey: "UseAppleScriptPaste") {
|
||||
pasteUsingAppleScript()
|
||||
_ = pasteUsingAppleScript()
|
||||
} else {
|
||||
pasteUsingCommandV()
|
||||
}
|
||||
@ -45,7 +45,7 @@ class CursorPaster {
|
||||
|
||||
var error: NSDictionary?
|
||||
if let scriptObject = NSAppleScript(source: script) {
|
||||
let output = scriptObject.executeAndReturnError(&error)
|
||||
_ = scriptObject.executeAndReturnError(&error)
|
||||
if error != nil {
|
||||
print("AppleScript paste failed: \(error?.description ?? "Unknown error")")
|
||||
logger.notice("AppleScript paste failed with error: \(error?.description ?? "Unknown error")")
|
||||
|
||||
@ -71,8 +71,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
|
||||
// Get audio duration
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let durationTime = try await audioAsset.load(.duration)
|
||||
let duration = CMTimeGetSeconds(durationTime)
|
||||
let duration = CMTimeGetSeconds(audioAsset.duration)
|
||||
|
||||
// Create permanent copy of the audio file
|
||||
let recordingsDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
|
||||
@ -112,7 +111,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
audioFileURL: permanentURL.absoluteString
|
||||
)
|
||||
modelContext.insert(transcription)
|
||||
modelContext.save()
|
||||
try modelContext.save()
|
||||
currentTranscription = transcription
|
||||
} catch {
|
||||
logger.error("Enhancement failed: \(error.localizedDescription)")
|
||||
@ -123,7 +122,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
audioFileURL: permanentURL.absoluteString
|
||||
)
|
||||
modelContext.insert(transcription)
|
||||
modelContext.save()
|
||||
try modelContext.save()
|
||||
currentTranscription = transcription
|
||||
}
|
||||
} else {
|
||||
@ -133,13 +132,13 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
audioFileURL: permanentURL.absoluteString
|
||||
)
|
||||
modelContext.insert(transcription)
|
||||
modelContext.save()
|
||||
try modelContext.save()
|
||||
currentTranscription = transcription
|
||||
}
|
||||
|
||||
processingPhase = .completed
|
||||
try await Task.sleep(nanoseconds: 1_500_000_000)
|
||||
finishProcessing()
|
||||
try? await Task.sleep(nanoseconds: 1_500_000_000)
|
||||
await finishProcessing()
|
||||
|
||||
} catch {
|
||||
await handleError(error)
|
||||
|
||||
@ -59,8 +59,7 @@ class AudioTranscriptionService: ObservableObject {
|
||||
|
||||
// Get audio duration
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let durationTime = try await audioAsset.load(.duration)
|
||||
let duration = CMTimeGetSeconds(durationTime)
|
||||
let duration = CMTimeGetSeconds(audioAsset.duration)
|
||||
|
||||
// Create a permanent copy of the audio file
|
||||
let recordingsDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
|
||||
@ -119,7 +118,12 @@ class AudioTranscriptionService: ObservableObject {
|
||||
audioFileURL: permanentURLString
|
||||
)
|
||||
modelContext.insert(newTranscription)
|
||||
modelContext.save()
|
||||
do {
|
||||
try modelContext.save()
|
||||
} catch {
|
||||
logger.error("❌ Failed to save transcription: \(error.localizedDescription)")
|
||||
messageLog += "Failed to save transcription: \(error.localizedDescription)\n"
|
||||
}
|
||||
|
||||
await MainActor.run {
|
||||
isTranscribing = false
|
||||
@ -135,7 +139,12 @@ class AudioTranscriptionService: ObservableObject {
|
||||
audioFileURL: permanentURLString
|
||||
)
|
||||
modelContext.insert(newTranscription)
|
||||
modelContext.save()
|
||||
do {
|
||||
try modelContext.save()
|
||||
} catch {
|
||||
logger.error("❌ Failed to save transcription: \(error.localizedDescription)")
|
||||
messageLog += "Failed to save transcription: \(error.localizedDescription)\n"
|
||||
}
|
||||
|
||||
await MainActor.run {
|
||||
isTranscribing = false
|
||||
@ -151,7 +160,12 @@ class AudioTranscriptionService: ObservableObject {
|
||||
audioFileURL: permanentURLString
|
||||
)
|
||||
modelContext.insert(newTranscription)
|
||||
modelContext.save()
|
||||
do {
|
||||
try modelContext.save()
|
||||
} catch {
|
||||
logger.error("❌ Failed to save transcription: \(error.localizedDescription)")
|
||||
messageLog += "Failed to save transcription: \(error.localizedDescription)\n"
|
||||
}
|
||||
|
||||
await MainActor.run {
|
||||
isTranscribing = false
|
||||
|
||||
@ -6,6 +6,7 @@ class PolarService {
|
||||
private let apiToken = "Token"
|
||||
private let baseURL = "https://api.polar.sh"
|
||||
|
||||
|
||||
struct LicenseValidationResponse: Codable {
|
||||
let status: String
|
||||
let limit_activations: Int?
|
||||
@ -55,7 +56,7 @@ class PolarService {
|
||||
|
||||
// Try to get the Mac serial number
|
||||
private func getMacSerialNumber() -> String? {
|
||||
let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"))
|
||||
let platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice"))
|
||||
if platformExpert == 0 { return nil }
|
||||
|
||||
defer { IOObjectRelease(platformExpert) }
|
||||
|
||||
@ -61,7 +61,7 @@ class WindowStateDelegate: NSObject, NSWindowDelegate {
|
||||
|
||||
func windowDidBecomeKey(_ notification: Notification) {
|
||||
// Ensure window is properly activated
|
||||
guard let window = notification.object as? NSWindow else { return }
|
||||
guard let _ = notification.object as? NSWindow else { return }
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user