Compare commits

..
3 Commits
Author SHA1 Message Date
james 6bcdd51201 fix: retain failed and empty meetings 2026-07-17 10:37:32 +02:00
james ea44104458 fix: synchronize audio capture teardown 2026-07-17 10:30:42 +02:00
james 336fb95b07 fix: restore multiline template editors 2026-07-15 23:45:54 +02:00
5 changed files with 61 additions and 49 deletions
+4 -4
View File
@@ -276,7 +276,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 20;
DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\"";
DEVELOPMENT_TEAM = G9LVHZAJNX;
ENABLE_HARDENED_RUNTIME = YES;
@@ -290,7 +290,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.1.5;
MARKETING_VERSION = 1.1.8;
ONLY_ACTIVE_ARCH = NO;
OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI";
PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes;
@@ -312,7 +312,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 20;
DEVELOPMENT_ASSET_PATHS = "\"meetingnotes/Preview Content\"";
DEVELOPMENT_TEAM = G9LVHZAJNX;
ENABLE_HARDENED_RUNTIME = YES;
@@ -326,7 +326,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.1.5;
MARKETING_VERSION = 1.1.8;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "$(inherited) -D ENABLE_TCC_SPI";
PRODUCT_BUNDLE_IDENTIFIER = net.jamesbone.meetingnotes;
+26 -16
View File
@@ -183,9 +183,13 @@ final class AudioManager: NSObject, ObservableObject {
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported microphone format"])
}
inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputFormat) { [weak self] buffer, _ in
guard let self, buffer.frameLength > 0 else { return }
self.updateAudioLevel(buffer, source: .mic)
self.processAudioBuffer(buffer, converter: converter, targetFormat: targetFormat, source: .mic)
guard let self else { return }
self.processAudioBuffer(
{ buffer },
converter: converter,
targetFormat: targetFormat,
source: .mic
)
}
audioEngine.prepare()
try audioEngine.start()
@@ -303,11 +307,13 @@ final class AudioManager: NSObject, ObservableObject {
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported system audio format"])
}
try tap.run(on: tapQueue) { [weak self] _, inputData, _, _, _ in
guard let self,
let buffer = AVAudioPCMBuffer(pcmFormat: inputFormat, bufferListNoCopy: inputData, deallocator: nil),
buffer.frameLength > 0 else { return }
self.updateAudioLevel(buffer, source: .system)
self.processAudioBuffer(buffer, converter: converter, targetFormat: targetFormat, source: .system)
guard let self else { return }
self.processAudioBuffer(
{ AVAudioPCMBuffer(pcmFormat: inputFormat, bufferListNoCopy: inputData, deallocator: nil) },
converter: converter,
targetFormat: targetFormat,
source: .system
)
} invalidationHandler: { [weak self] _ in
guard let self, !self.isRestartingSystemTap, self.isRecording else { return }
Task { await self.restartSystemAudioTap() }
@@ -315,11 +321,20 @@ final class AudioManager: NSObject, ObservableObject {
}
private func processAudioBuffer(
_ inputBuffer: AVAudioPCMBuffer,
_ inputBufferProvider: () -> AVAudioPCMBuffer?,
converter: AVAudioConverter,
targetFormat: AVAudioFormat,
source: AudioSource
) {
// Keep callback-owned buffers alive until conversion finishes. Teardown
// takes this same lock before invalidating the Core Audio process tap.
audioFileLock.lock()
defer { audioFileLock.unlock() }
guard isAcceptingAudio,
let inputBuffer = inputBufferProvider(),
inputBuffer.frameLength > 0 else { return }
updateAudioLevel(inputBuffer, source: source)
let ratio = targetFormat.sampleRate / inputBuffer.format.sampleRate
let capacity = max(1, AVAudioFrameCount(ceil(Double(inputBuffer.frameLength) * ratio)))
guard let outputBuffer = AVAudioPCMBuffer(pcmFormat: targetFormat, frameCapacity: capacity) else { return }
@@ -336,11 +351,6 @@ final class AudioManager: NSObject, ObservableObject {
}
guard status != .error, conversionError == nil, outputBuffer.frameLength > 0 else { return }
audioFileLock.lock()
defer { audioFileLock.unlock() }
guard isAcceptingAudio else {
return
}
do {
switch source {
case .mic:
@@ -378,8 +388,8 @@ final class AudioManager: NSObject, ObservableObject {
pendingMicRestart = nil
AudioLevelManager.shared.updateRecordingState(false)
// Stop new writes and wait for any callback already writing before
// AVAudioFile is finalized and released.
// Stop new callbacks and wait for any active conversion/write before
// invalidating callback-owned buffers or finalizing AVAudioFile.
audioFileLock.lock()
isAcceptingAudio = false
audioFileLock.unlock()
@@ -54,15 +54,6 @@ class MeetingViewModel: ObservableObject {
private let recordingSessionManager = RecordingSessionManager.shared
private var cancellables = Set<AnyCancellable>()
private var isNewMeeting = false
// Computed property to check if meeting is empty
var isEmpty: Bool {
return meeting.transcriptChunks.isEmpty &&
meeting.userNotes.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty &&
meeting.generatedNotes.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty &&
meeting.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
init(meeting: Meeting = Meeting()) {
// Load the latest version of the meeting from storage if it exists
@@ -76,9 +67,6 @@ class MeetingViewModel: ObservableObject {
// Detect if this is a new meeting based on content, not storage existence
isNewMeeting = isEmpty
// Set initial tab based on notes existence
if !self.meeting.generatedNotes.isEmpty {
selectedTab = .enhancedNotes
@@ -333,12 +321,4 @@ class MeetingViewModel: ObservableObject {
}
}
func deleteIfEmpty() {
if isEmpty && !isRecording && !isProcessing {
print("🗑️ Auto-deleting empty meeting")
deleteMeeting()
} else {
saveMeeting()
}
}
}
+3 -2
View File
@@ -445,8 +445,9 @@ struct MeetingDetailContentView: View {
Text("Are you sure you want to delete this meeting? This action cannot be undone.")
}
.onDisappear {
// Auto-delete empty meetings when leaving, otherwise save
viewModel.deleteIfEmpty()
// A failed recording may still be empty. Keep it until the user
// explicitly deletes it so app updates cannot erase history.
viewModel.saveMeeting()
}
}
+28 -7
View File
@@ -33,9 +33,16 @@ struct TemplateEditView: View {
.font(.caption)
.foregroundColor(.secondary)
TextField("Meeting Context", text: $template.context, axis: .vertical)
.textFieldStyle(.roundedBorder)
.lineLimit(4...10)
TextEditor(text: $template.context)
.scrollContentBackground(.hidden)
.padding(8)
.frame(height: 140)
.background(Color.secondary.opacity(0.06))
.overlay {
RoundedRectangle(cornerRadius: 6)
.stroke(Color.secondary.opacity(0.25), lineWidth: 1)
}
.clipShape(RoundedRectangle(cornerRadius: 6))
}
// Sections
@@ -75,9 +82,16 @@ struct TemplateEditView: View {
TextField("Section Title", text: $section.title)
.textFieldStyle(.roundedBorder)
TextField("Section Description", text: $section.description, axis: .vertical)
.textFieldStyle(.roundedBorder)
.lineLimit(3...8)
TextEditor(text: $section.description)
.scrollContentBackground(.hidden)
.padding(8)
.frame(height: 90)
.background(Color.secondary.opacity(0.06))
.overlay {
RoundedRectangle(cornerRadius: 6)
.stroke(Color.secondary.opacity(0.25), lineWidth: 1)
}
.clipShape(RoundedRectangle(cornerRadius: 6))
}
Button {
@@ -113,12 +127,19 @@ struct TemplateEditView: View {
}
.buttonStyle(.plain)
.padding(.top)
.disabled(template.title.isEmpty || template.sections.isEmpty)
.disabled(!canSave)
}
.padding(24)
}
.navigationTitle("Edit Template")
}
private var canSave: Bool {
let hasTitle = !template.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
let hasInstructions = !template.context.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
|| !template.sections.isEmpty
return hasTitle && hasInstructions
}
}
#Preview {