mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Run SwiftFormat.
This commit is contained in:
@@ -20,7 +20,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
var actions: AnyPublisher<VoiceMessageRecorderAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
|
||||
private let mp4accMimeType = "audio/m4a"
|
||||
|
||||
var isRecording: Bool {
|
||||
@@ -36,11 +36,11 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
}
|
||||
|
||||
private var recordingCancelled = false
|
||||
|
||||
|
||||
private(set) var previewAudioPlayerState: AudioPlayerState?
|
||||
private(set) var previewAudioPlayer: AudioPlayerProtocol?
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
|
||||
init(audioRecorder: AudioRecorderProtocol = AudioRecorder(),
|
||||
mediaPlayerProvider: MediaPlayerProviderProtocol,
|
||||
voiceMessageCache: VoiceMessageCacheProtocol = VoiceMessageCache()) {
|
||||
@@ -86,7 +86,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
previewAudioPlayer?.reset()
|
||||
previewAudioPlayerState = nil
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Preview
|
||||
|
||||
func startPlayback() async -> Result<Void, VoiceMessageRecorderError> {
|
||||
@@ -158,13 +158,13 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
// delete the temporary file
|
||||
try? FileManager.default.removeItem(at: oggFile)
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
try audioConverter.convertToOpusOgg(sourceURL: url, destinationURL: oggFile)
|
||||
} catch {
|
||||
return .failure(.failedSendingVoiceMessage)
|
||||
}
|
||||
|
||||
|
||||
// send it
|
||||
let size: UInt64
|
||||
do {
|
||||
@@ -189,7 +189,7 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
|
||||
return .success(())
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func addObservers() {
|
||||
@@ -237,10 +237,10 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol {
|
||||
guard audioRecorder.audioFileURL != nil, audioRecorder.currentTime > 0 else {
|
||||
return .failure(.previewNotAvailable)
|
||||
}
|
||||
|
||||
|
||||
// Build the preview audio player state
|
||||
previewAudioPlayerState = await AudioPlayerState(id: .recorderPreview, title: L10n.commonVoiceMessage, duration: recordingDuration, waveform: EstimatedWaveform(data: []))
|
||||
|
||||
|
||||
// Build the preview audio player
|
||||
let audioPlayer = await mediaPlayerProvider.player
|
||||
previewAudioPlayer = audioPlayer
|
||||
|
||||
Reference in New Issue
Block a user