Skip to content

Commit

Permalink
#4090 - bug fixing and removed work queue
Browse files Browse the repository at this point in the history
  • Loading branch information
gileluard committed Jun 29, 2021
1 parent 397f88c commit c421af0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class VoiceMessageAttachmentCacheManager {
return
}

workQueue.async {
// workQueue.async {
self.enqueueLoadAttachment(attachment, identifier: identifier, numberOfSamples: numberOfSamples, completion: completion)
}
// }
}

private func enqueueLoadAttachment(_ attachment: MXKAttachment, identifier: String, numberOfSamples: Int, completion: @escaping (Result<(URL, [Float]), Error>) -> Void) {
Expand Down
7 changes: 4 additions & 3 deletions Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
static let maximumAudioRecordingDuration: TimeInterval = 120.0
static let maximumAudioRecordingLengthReachedThreshold: TimeInterval = 10.0
static let elapsedTimeFormat = "m:ss"
static let minimumRecordingDuration = 5.0
static let minimumRecordingDuration = 2.0
}

private static let timeFormatter: DateFormatter = {
Expand Down Expand Up @@ -179,15 +179,16 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate,
// MARK: - Private

private func finishRecording() {
let recordDuration = audioRecorder?.currentTime
audioRecorder?.stopRecording()

guard let url = audioRecorder?.url else {
MXLog.error("Invalid audio recording URL")
return
}

guard isInLockedMode else {
if audioRecorder?.currentTime ?? 0 >= Constants.minimumRecordingDuration {
if recordDuration ?? 0 >= Constants.minimumRecordingDuration {
sendRecordingAtURL(url)
}
return
Expand Down

0 comments on commit c421af0

Please sign in to comment.