fix: preserve diagnostics when merging meetings

This commit is contained in:
2026-08-26 17:04:15 +02:00
parent 299986ab00
commit 3a9ad8fe0c
2 changed files with 28 additions and 8 deletions
+4 -4
View File
@@ -276,7 +276,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 41; CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\"";
DEVELOPMENT_TEAM = G9LVHZAJNX; DEVELOPMENT_TEAM = G9LVHZAJNX;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -290,7 +290,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.1.29; MARKETING_VERSION = 1.1.30;
ONLY_ACTIVE_ARCH = NO; ONLY_ACTIVE_ARCH = NO;
OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI"; OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI";
PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes; PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes;
@@ -312,7 +312,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 41; CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\"";
DEVELOPMENT_TEAM = G9LVHZAJNX; DEVELOPMENT_TEAM = G9LVHZAJNX;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
@@ -326,7 +326,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 15.0; MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.1.29; MARKETING_VERSION = 1.1.30;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI"; OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI";
PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes; PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes;
@@ -170,11 +170,13 @@ class LocalStorageManager {
} }
} }
for audioFile in recoveryAudioFiles(in: continuationFolder) { let recoveryFiles = recoveryAudioFiles(in: continuationFolder).map(\.url)
let destination = previousFolder.appendingPathComponent(audioFile.url.lastPathComponent) + recoveryDiagnosticFiles(in: continuationFolder)
for recoveryFile in recoveryFiles {
let destination = previousFolder.appendingPathComponent(recoveryFile.lastPathComponent)
if FileManager.default.fileExists(atPath: destination.path) { if FileManager.default.fileExists(atPath: destination.path) {
guard FileManager.default.contentsEqual( guard FileManager.default.contentsEqual(
atPath: audioFile.url.path, atPath: recoveryFile.path,
andPath: destination.path andPath: destination.path
) else { ) else {
rollbackMergedAudio(copiedAudioURLs, removeFolder: createdPreviousFolder ? previousFolder : nil) rollbackMergedAudio(copiedAudioURLs, removeFolder: createdPreviousFolder ? previousFolder : nil)
@@ -184,7 +186,7 @@ class LocalStorageManager {
} }
do { do {
try FileManager.default.copyItem(at: audioFile.url, to: destination) try FileManager.default.copyItem(at: recoveryFile, to: destination)
copiedAudioURLs.append(destination) copiedAudioURLs.append(destination)
} catch { } catch {
rollbackMergedAudio(copiedAudioURLs, removeFolder: createdPreviousFolder ? previousFolder : nil) rollbackMergedAudio(copiedAudioURLs, removeFolder: createdPreviousFolder ? previousFolder : nil)
@@ -206,6 +208,7 @@ class LocalStorageManager {
merged.userNotes = mergedText(previous.userNotes, continuation.userNotes) merged.userNotes = mergedText(previous.userNotes, continuation.userNotes)
merged.generatedNotes = mergedText(previous.generatedNotes, continuation.generatedNotes) merged.generatedNotes = mergedText(previous.generatedNotes, continuation.generatedNotes)
merged.templateId = previous.templateId ?? continuation.templateId merged.templateId = previous.templateId ?? continuation.templateId
merged.transcriptionError = previous.transcriptionError ?? continuation.transcriptionError
if !recoveryAudioFiles(in: previousFolder).isEmpty { if !recoveryAudioFiles(in: previousFolder).isEmpty {
merged.recoveryAudioFolderName = previous.id.uuidString merged.recoveryAudioFolderName = previous.id.uuidString
} }
@@ -347,6 +350,23 @@ class LocalStorageManager {
} }
} }
private func recoveryDiagnosticFiles(in folder: URL) -> [URL] {
guard let files = try? FileManager.default.contentsOfDirectory(
at: folder,
includingPropertiesForKeys: [.isRegularFileKey],
options: [.skipsHiddenFiles]
) else {
return []
}
return files.filter { url in
let values = try? url.resourceValues(forKeys: [.isRegularFileKey])
return values?.isRegularFile == true
&& url.pathExtension.caseInsensitiveCompare("txt") == .orderedSame
&& url.lastPathComponent.lowercased().hasPrefix("audio-diagnostics-")
}
}
func findRecoveryAudioFolder(for meeting: Meeting) -> URL? { func findRecoveryAudioFolder(for meeting: Meeting) -> URL? {
let canonicalName = meeting.id.uuidString let canonicalName = meeting.id.uuidString
guard meeting.recoveryAudioFolderName == nil guard meeting.recoveryAudioFolderName == nil