()
| 1674 | } |
| 1675 | |
| 1676 | private func exportAudioZip() { |
| 1677 | do { |
| 1678 | guard TranscriptionHistoryStore.shared.entries.contains(where: { |
| 1679 | DictationAudioHistoryStore.shared.audioFileExists(for: $0) |
| 1680 | }) else { |
| 1681 | throw DictationAudioHistoryError.noAudioEntries |
| 1682 | } |
| 1683 | |
| 1684 | let panel = NSSavePanel() |
| 1685 | panel.canCreateDirectories = true |
| 1686 | panel.allowedContentTypes = [.zip] |
| 1687 | panel.nameFieldStringValue = DictationAudioHistoryStore.shared.suggestedAudioExportFilename() |
| 1688 | |
| 1689 | guard panel.runModal() == .OK, let url = panel.url else { return } |
| 1690 | try DictationAudioHistoryStore.shared.exportAudioArchive( |
| 1691 | entries: TranscriptionHistoryStore.shared.entries, |
| 1692 | to: url |
| 1693 | ) |
| 1694 | self.presentInfoAlert(title: "Audio Export Saved", message: "Saved your dictation audio export to:\n\(url.path)") |
| 1695 | } catch { |
| 1696 | self.presentErrorAlert(title: "Audio Export Failed", message: error.localizedDescription) |
| 1697 | } |
| 1698 | } |
| 1699 | |
| 1700 | private func presentInfoAlert(title: String, message: String) { |
| 1701 | let alert = NSAlert() |
no test coverage detected