Allow to record a voice message (#1926)

This commit is contained in:
Nicolas Mauri
2023-10-23 17:47:36 +02:00
committed by GitHub
parent 65b7c1df20
commit 2f57fbc77d
62 changed files with 1805 additions and 342 deletions
@@ -16,9 +16,26 @@
import Foundation
enum VoiceMessageCacheError: Error {
case invalidFileExtension
case failedStoringFileInCache
}
protocol VoiceMessageCacheProtocol {
/// Returns the URL of the cached audio file for a given media source
/// - Parameter mediaSource: the media source
/// - Returns: the URL of the cached audio file or nil if the file doesn't exist
func fileURL(for mediaSource: MediaSourceProxy) -> URL?
func cache(mediaSource: MediaSourceProxy, using fileURL: URL, move: Bool) throws -> URL
/// Adds a file in the cache
/// - Parameters:
/// - mediaSource: the media source
/// - fileURL: the source file
/// - move: wheter to move or copy the source file
/// - Returns: the cached URL
func cache(mediaSource: MediaSourceProxy, using fileURL: URL, move: Bool) -> Result<URL, VoiceMessageCacheError>
/// Clears the cache
func clearCache()
}