New voice message recording mode (#2051)

* Lock voice message recording

* Use the VoiceMessageCache to store the recording file

* Rework on some composer toolbar buttons

* Update accessibility labels for voice message recording button

* PreviewTests
This commit is contained in:
Nicolas Mauri
2023-11-10 16:32:22 +01:00
committed by GitHub
parent 5a0dab1ce8
commit da831f6725
34 changed files with 283 additions and 296 deletions
@@ -22,6 +22,12 @@ class VoiceMessageCache: VoiceMessageCacheProtocol {
FileManager.default.temporaryDirectory.appendingPathComponent("media/voice-message")
}
var urlForRecording: URL {
// Make sure the directory exist
setupTemporaryFilesFolder()
return temporaryFilesFolderURL.appendingPathComponent("voice-message-recording").appendingPathExtension(preferredFileExtension)
}
func fileURL(for mediaSource: MediaSourceProxy) -> URL? {
let url = cacheURL(for: mediaSource)
return FileManager.default.fileExists(atPath: url.path()) ? url : nil
@@ -69,6 +75,7 @@ class VoiceMessageCache: VoiceMessageCacheProtocol {
} else {
try FileManager.default.copyItem(at: source, to: destination)
}
try (destination as NSURL).setResourceValue(URLFileProtection.complete, forKey: .fileProtectionKey)
}
private func cacheURL(for mediaSource: MediaSourceProxy) -> URL {