Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad995b59ad | ||
|
|
a13153b8fe | ||
|
|
0008bd3081 | ||
|
|
6bcdd51201 | ||
|
|
ea44104458 |
@@ -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 = 18;
|
CURRENT_PROJECT_VERSION = 22;
|
||||||
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.6;
|
MARKETING_VERSION = 1.1.10;
|
||||||
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 = 18;
|
CURRENT_PROJECT_VERSION = 22;
|
||||||
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.6;
|
MARKETING_VERSION = 1.1.10;
|
||||||
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;
|
||||||
|
|||||||
@@ -183,9 +183,13 @@ final class AudioManager: NSObject, ObservableObject {
|
|||||||
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported microphone format"])
|
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported microphone format"])
|
||||||
}
|
}
|
||||||
inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputFormat) { [weak self] buffer, _ in
|
inputNode.installTap(onBus: 0, bufferSize: 1024, format: inputFormat) { [weak self] buffer, _ in
|
||||||
guard let self, buffer.frameLength > 0 else { return }
|
guard let self else { return }
|
||||||
self.updateAudioLevel(buffer, source: .mic)
|
self.processAudioBuffer(
|
||||||
self.processAudioBuffer(buffer, converter: converter, targetFormat: targetFormat, source: .mic)
|
{ buffer },
|
||||||
|
converter: converter,
|
||||||
|
targetFormat: targetFormat,
|
||||||
|
source: .mic
|
||||||
|
)
|
||||||
}
|
}
|
||||||
audioEngine.prepare()
|
audioEngine.prepare()
|
||||||
try audioEngine.start()
|
try audioEngine.start()
|
||||||
@@ -298,28 +302,75 @@ final class AudioManager: NSObject, ObservableObject {
|
|||||||
private func startTapIO(_ tap: ProcessTap) throws {
|
private func startTapIO(_ tap: ProcessTap) throws {
|
||||||
guard var description = tap.tapStreamDescription,
|
guard var description = tap.tapStreamDescription,
|
||||||
let inputFormat = AVAudioFormat(streamDescription: &description),
|
let inputFormat = AVAudioFormat(streamDescription: &description),
|
||||||
let targetFormat = systemAudioFile?.processingFormat,
|
let targetFormat = systemAudioFile?.processingFormat else {
|
||||||
let converter = AVAudioConverter(from: inputFormat, to: targetFormat) else {
|
|
||||||
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported system audio format"])
|
throw NSError(domain: "AudioManager", code: -1, userInfo: [NSLocalizedDescriptionKey: "Unsupported system audio format"])
|
||||||
}
|
}
|
||||||
try tap.run(on: tapQueue) { [weak self] _, inputData, _, _, _ in
|
try tap.run(on: tapQueue) { [weak self] _, inputData, _, _, _ in
|
||||||
guard let self,
|
guard let self,
|
||||||
let buffer = AVAudioPCMBuffer(pcmFormat: inputFormat, bufferListNoCopy: inputData, deallocator: nil),
|
let converter = AVAudioConverter(from: inputFormat, to: targetFormat) else { return }
|
||||||
buffer.frameLength > 0 else { return }
|
self.processAudioBuffer(
|
||||||
self.updateAudioLevel(buffer, source: .system)
|
{ self.copyAudioBuffer(from: inputData, format: inputFormat) },
|
||||||
self.processAudioBuffer(buffer, converter: converter, targetFormat: targetFormat, source: .system)
|
converter: converter,
|
||||||
|
targetFormat: targetFormat,
|
||||||
|
source: .system
|
||||||
|
)
|
||||||
} invalidationHandler: { [weak self] _ in
|
} invalidationHandler: { [weak self] _ in
|
||||||
guard let self, !self.isRestartingSystemTap, self.isRecording else { return }
|
guard let self, !self.isRestartingSystemTap, self.isRecording else { return }
|
||||||
Task { await self.restartSystemAudioTap() }
|
Task { await self.restartSystemAudioTap() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func copyAudioBuffer(
|
||||||
|
from inputData: UnsafePointer<AudioBufferList>,
|
||||||
|
format: AVAudioFormat
|
||||||
|
) -> AVAudioPCMBuffer? {
|
||||||
|
guard let borrowedBuffer = AVAudioPCMBuffer(
|
||||||
|
pcmFormat: format,
|
||||||
|
bufferListNoCopy: inputData,
|
||||||
|
deallocator: nil
|
||||||
|
), borrowedBuffer.frameLength > 0,
|
||||||
|
let ownedBuffer = AVAudioPCMBuffer(
|
||||||
|
pcmFormat: format,
|
||||||
|
frameCapacity: borrowedBuffer.frameLength
|
||||||
|
) else { return nil }
|
||||||
|
|
||||||
|
ownedBuffer.frameLength = borrowedBuffer.frameLength
|
||||||
|
let sourceBuffers = UnsafeMutableAudioBufferListPointer(
|
||||||
|
UnsafeMutablePointer(mutating: inputData)
|
||||||
|
)
|
||||||
|
let destinationBuffers = UnsafeMutableAudioBufferListPointer(
|
||||||
|
ownedBuffer.mutableAudioBufferList
|
||||||
|
)
|
||||||
|
guard sourceBuffers.count == destinationBuffers.count else { return nil }
|
||||||
|
|
||||||
|
for index in 0..<sourceBuffers.count {
|
||||||
|
let source = sourceBuffers[index]
|
||||||
|
let destination = destinationBuffers[index]
|
||||||
|
let byteCount = Int(source.mDataByteSize)
|
||||||
|
guard byteCount <= Int(destination.mDataByteSize),
|
||||||
|
let sourceData = source.mData,
|
||||||
|
let destinationData = destination.mData else { return nil }
|
||||||
|
memcpy(destinationData, sourceData, byteCount)
|
||||||
|
destinationBuffers[index].mDataByteSize = source.mDataByteSize
|
||||||
|
}
|
||||||
|
return ownedBuffer
|
||||||
|
}
|
||||||
|
|
||||||
private func processAudioBuffer(
|
private func processAudioBuffer(
|
||||||
_ inputBuffer: AVAudioPCMBuffer,
|
_ inputBufferProvider: () -> AVAudioPCMBuffer?,
|
||||||
converter: AVAudioConverter,
|
converter: AVAudioConverter,
|
||||||
targetFormat: AVAudioFormat,
|
targetFormat: AVAudioFormat,
|
||||||
source: AudioSource
|
source: AudioSource
|
||||||
) {
|
) {
|
||||||
|
// The system callback copies its borrowed Core Audio memory while this
|
||||||
|
// lock prevents teardown, then conversion operates on the owned copy.
|
||||||
|
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 ratio = targetFormat.sampleRate / inputBuffer.format.sampleRate
|
||||||
let capacity = max(1, AVAudioFrameCount(ceil(Double(inputBuffer.frameLength) * ratio)))
|
let capacity = max(1, AVAudioFrameCount(ceil(Double(inputBuffer.frameLength) * ratio)))
|
||||||
guard let outputBuffer = AVAudioPCMBuffer(pcmFormat: targetFormat, frameCapacity: capacity) else { return }
|
guard let outputBuffer = AVAudioPCMBuffer(pcmFormat: targetFormat, frameCapacity: capacity) else { return }
|
||||||
@@ -336,11 +387,6 @@ final class AudioManager: NSObject, ObservableObject {
|
|||||||
}
|
}
|
||||||
guard status != .error, conversionError == nil, outputBuffer.frameLength > 0 else { return }
|
guard status != .error, conversionError == nil, outputBuffer.frameLength > 0 else { return }
|
||||||
|
|
||||||
audioFileLock.lock()
|
|
||||||
defer { audioFileLock.unlock() }
|
|
||||||
guard isAcceptingAudio else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
do {
|
do {
|
||||||
switch source {
|
switch source {
|
||||||
case .mic:
|
case .mic:
|
||||||
@@ -378,8 +424,8 @@ final class AudioManager: NSObject, ObservableObject {
|
|||||||
pendingMicRestart = nil
|
pendingMicRestart = nil
|
||||||
AudioLevelManager.shared.updateRecordingState(false)
|
AudioLevelManager.shared.updateRecordingState(false)
|
||||||
|
|
||||||
// Stop new writes and wait for any callback already writing before
|
// Stop new callbacks and wait for any active conversion/write before
|
||||||
// AVAudioFile is finalized and released.
|
// invalidating callback-owned buffers or finalizing AVAudioFile.
|
||||||
audioFileLock.lock()
|
audioFileLock.lock()
|
||||||
isAcceptingAudio = false
|
isAcceptingAudio = false
|
||||||
audioFileLock.unlock()
|
audioFileLock.unlock()
|
||||||
|
|||||||
@@ -97,7 +97,11 @@ final class CoderAPIClient {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func streamChat(systemPrompt: String, model: String) -> AsyncThrowingStream<String, Error> {
|
func streamChat(
|
||||||
|
systemPrompt: String,
|
||||||
|
userPrompt: String = "Create the meeting notes now.",
|
||||||
|
model: String
|
||||||
|
) -> AsyncThrowingStream<String, Error> {
|
||||||
AsyncThrowingStream { continuation in
|
AsyncThrowingStream { continuation in
|
||||||
Task {
|
Task {
|
||||||
do {
|
do {
|
||||||
@@ -113,7 +117,7 @@ final class CoderAPIClient {
|
|||||||
"model": selectedModel,
|
"model": selectedModel,
|
||||||
"messages": [
|
"messages": [
|
||||||
["role": "system", "content": systemPrompt],
|
["role": "system", "content": systemPrompt],
|
||||||
["role": "user", "content": "Create the meeting notes now."]
|
["role": "user", "content": userPrompt]
|
||||||
],
|
],
|
||||||
"stream": true
|
"stream": true
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -309,8 +309,27 @@ private final class LocalRecordingController {
|
|||||||
generatedNotes = ""
|
generatedNotes = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var meetingChanged = false
|
||||||
if !generatedNotes.isEmpty {
|
if !generatedNotes.isEmpty {
|
||||||
meeting.generatedNotes = generatedNotes
|
meeting.generatedNotes = generatedNotes
|
||||||
|
meetingChanged = true
|
||||||
|
}
|
||||||
|
if meeting.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
|
do {
|
||||||
|
if let title = try await NotesGenerator.shared.generateMeetingTitle(
|
||||||
|
meeting: meeting,
|
||||||
|
generatedNotes: generatedNotes,
|
||||||
|
templateId: meeting.templateId
|
||||||
|
) {
|
||||||
|
meeting.title = title
|
||||||
|
meetingChanged = true
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// The recording and generated notes remain valid without a generated title.
|
||||||
|
print("Meeting title generation failed: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if meetingChanged {
|
||||||
_ = LocalStorageManager.shared.saveMeeting(meeting)
|
_ = LocalStorageManager.shared.saveMeeting(meeting)
|
||||||
NotificationCenter.default.post(name: .meetingSaved, object: meeting)
|
NotificationCenter.default.post(name: .meetingSaved, object: meeting)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,88 @@ class NotesGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generates a short title after meeting notes have been created.
|
||||||
|
func generateMeetingTitle(
|
||||||
|
meeting: Meeting,
|
||||||
|
generatedNotes: String,
|
||||||
|
templateId: UUID?
|
||||||
|
) async throws -> String? {
|
||||||
|
let templates = LocalStorageManager.shared.loadTemplates()
|
||||||
|
let template = templateId.flatMap { id in
|
||||||
|
templates.first(where: { $0.id == id })
|
||||||
|
}
|
||||||
|
let meetingContext: String
|
||||||
|
if let template {
|
||||||
|
meetingContext = "\(template.title): \(template.context)"
|
||||||
|
} else {
|
||||||
|
meetingContext = "General meeting"
|
||||||
|
}
|
||||||
|
|
||||||
|
let trimmedNotes = generatedNotes.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
let meetingContent = trimmedNotes.isEmpty ? meeting.formattedTranscript : trimmedNotes
|
||||||
|
guard !meetingContent.isEmpty else { return nil }
|
||||||
|
|
||||||
|
let systemPrompt = """
|
||||||
|
Create a concise, descriptive title for a recorded meeting from its context and content.
|
||||||
|
Return only the title in 3 to 8 words. Do not use quotation marks, Markdown, or a trailing period.
|
||||||
|
Avoid generic titles such as Meeting, Discussion, Meeting Notes, or Untitled Meeting.
|
||||||
|
"""
|
||||||
|
let userPrompt = """
|
||||||
|
Meeting context:
|
||||||
|
\(meetingContext)
|
||||||
|
|
||||||
|
Meeting content:
|
||||||
|
\(meetingContent)
|
||||||
|
"""
|
||||||
|
|
||||||
|
var generatedTitle = ""
|
||||||
|
let stream = CoderAPIClient.shared.streamChat(
|
||||||
|
systemPrompt: systemPrompt,
|
||||||
|
userPrompt: userPrompt,
|
||||||
|
model: UserDefaultsManager.shared.notesModel
|
||||||
|
)
|
||||||
|
for try await content in stream {
|
||||||
|
generatedTitle += content
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalizedTitle(generatedTitle)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func normalizedTitle(_ value: String) -> String? {
|
||||||
|
guard var title = value
|
||||||
|
.split(whereSeparator: \Character.isNewline)
|
||||||
|
.map(String.init)
|
||||||
|
.first(where: { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty })?
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
while title.hasPrefix("#") {
|
||||||
|
title.removeFirst()
|
||||||
|
title = title.trimmingCharacters(in: .whitespaces)
|
||||||
|
}
|
||||||
|
if title.lowercased().hasPrefix("title:") {
|
||||||
|
title = String(title.dropFirst("title:".count))
|
||||||
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
}
|
||||||
|
title = title.trimmingCharacters(in: CharacterSet(charactersIn: "\"'"))
|
||||||
|
if title.hasSuffix(".") {
|
||||||
|
title.removeLast()
|
||||||
|
}
|
||||||
|
|
||||||
|
if title.count > 80 {
|
||||||
|
let prefix = String(title.prefix(80))
|
||||||
|
if let lastSpace = prefix.lastIndex(of: " ") {
|
||||||
|
title = String(prefix[..<lastSpace])
|
||||||
|
} else {
|
||||||
|
title = prefix
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
title = title.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
|
return title.isEmpty ? nil : title
|
||||||
|
}
|
||||||
|
|
||||||
/// Validates if the Coder service token is configured
|
/// Validates if the Coder service token is configured
|
||||||
/// - Returns: True if API key exists, false otherwise
|
/// - Returns: True if API key exists, false otherwise
|
||||||
@@ -115,4 +197,4 @@ class NotesGenerator {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ extension Notification.Name {
|
|||||||
enum MeetingViewTab: String, CaseIterable {
|
enum MeetingViewTab: String, CaseIterable {
|
||||||
case myNotes = "My Notes"
|
case myNotes = "My Notes"
|
||||||
case transcript = "Transcript"
|
case transcript = "Transcript"
|
||||||
case enhancedNotes = "Enhanced Notes"
|
case enhancedNotes = "Meeting Notes"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -54,15 +54,6 @@ class MeetingViewModel: ObservableObject {
|
|||||||
|
|
||||||
private let recordingSessionManager = RecordingSessionManager.shared
|
private let recordingSessionManager = RecordingSessionManager.shared
|
||||||
private var cancellables = Set<AnyCancellable>()
|
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()) {
|
init(meeting: Meeting = Meeting()) {
|
||||||
// Load the latest version of the meeting from storage if it exists
|
// 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
|
// Set initial tab based on notes existence
|
||||||
if !self.meeting.generatedNotes.isEmpty {
|
if !self.meeting.generatedNotes.isEmpty {
|
||||||
selectedTab = .enhancedNotes
|
selectedTab = .enhancedNotes
|
||||||
@@ -272,11 +260,29 @@ class MeetingViewModel: ObservableObject {
|
|||||||
|
|
||||||
// Only save if there was no error
|
// Only save if there was no error
|
||||||
if !hasError {
|
if !hasError {
|
||||||
|
await generateTitleIfNeeded()
|
||||||
saveMeeting()
|
saveMeeting()
|
||||||
}
|
}
|
||||||
|
|
||||||
isGeneratingNotes = false
|
isGeneratingNotes = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func generateTitleIfNeeded() async {
|
||||||
|
guard meeting.title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return }
|
||||||
|
|
||||||
|
do {
|
||||||
|
if let title = try await NotesGenerator.shared.generateMeetingTitle(
|
||||||
|
meeting: meeting,
|
||||||
|
generatedNotes: meeting.generatedNotes,
|
||||||
|
templateId: selectedTemplateId
|
||||||
|
) {
|
||||||
|
meeting.title = title
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// A title is helpful but should never prevent completed notes from being saved.
|
||||||
|
print("Meeting title generation failed: \(error)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func saveMeeting() {
|
func saveMeeting() {
|
||||||
if isDeleted { return }
|
if isDeleted { return }
|
||||||
@@ -333,12 +339,4 @@ class MeetingViewModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteIfEmpty() {
|
|
||||||
if isEmpty && !isRecording && !isProcessing {
|
|
||||||
print("🗑️ Auto-deleting empty meeting")
|
|
||||||
deleteMeeting()
|
|
||||||
} else {
|
|
||||||
saveMeeting()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ struct MeetingDetailContentView: View {
|
|||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.disabled(viewModel.meeting.transcript.isEmpty || viewModel.isGeneratingNotes || viewModel.isRecording || viewModel.isProcessing || viewModel.isStartingRecording)
|
.disabled(viewModel.meeting.transcript.isEmpty || viewModel.isGeneratingNotes || viewModel.isRecording || viewModel.isProcessing || viewModel.isStartingRecording)
|
||||||
.help("Generate enhanced notes using a template")
|
.help("Generate meeting notes using a template")
|
||||||
|
|
||||||
// Recording Button
|
// Recording Button
|
||||||
Button(action: {
|
Button(action: {
|
||||||
@@ -374,7 +374,7 @@ struct MeetingDetailContentView: View {
|
|||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
// Edit/Preview button (for My Notes and Enhanced Notes)
|
// Edit/Preview button (for My Notes and Meeting Notes)
|
||||||
if viewModel.selectedTab == .myNotes || viewModel.selectedTab == .enhancedNotes {
|
if viewModel.selectedTab == .myNotes || viewModel.selectedTab == .enhancedNotes {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
isEditing.toggle()
|
isEditing.toggle()
|
||||||
@@ -445,8 +445,9 @@ struct MeetingDetailContentView: View {
|
|||||||
Text("Are you sure you want to delete this meeting? This action cannot be undone.")
|
Text("Are you sure you want to delete this meeting? This action cannot be undone.")
|
||||||
}
|
}
|
||||||
.onDisappear {
|
.onDisappear {
|
||||||
// Auto-delete empty meetings when leaving, otherwise save
|
// A failed recording may still be empty. Keep it until the user
|
||||||
viewModel.deleteIfEmpty()
|
// explicitly deletes it so app updates cannot erase history.
|
||||||
|
viewModel.saveMeeting()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user