mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
ios: voice message repeat receive ui workaround (#1437)
This commit is contained in:
@@ -41,13 +41,13 @@ class AudioRecorder {
|
||||
AVNumberOfChannelsKey: 1
|
||||
]
|
||||
audioRecorder = try AVAudioRecorder(url: getAppFilePath(fileName), settings: settings)
|
||||
audioRecorder?.record(forDuration: maxVoiceMessageLength)
|
||||
audioRecorder?.record(forDuration: MAX_VOICE_MESSAGE_LENGTH)
|
||||
|
||||
await MainActor.run {
|
||||
recordingTimer = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true) { timer in
|
||||
guard let time = self.audioRecorder?.currentTime else { return }
|
||||
self.onTimer?(time)
|
||||
if time >= maxVoiceMessageLength {
|
||||
if time >= MAX_VOICE_MESSAGE_LENGTH {
|
||||
self.stop()
|
||||
self.onFinishRecording?()
|
||||
}
|
||||
|
||||
@@ -969,14 +969,15 @@ func processReceivedMsg(_ res: ChatResponse) async {
|
||||
m.addChatItem(cInfo, cItem)
|
||||
if case .image = cItem.content.msgContent,
|
||||
let file = cItem.file,
|
||||
file.fileSize <= maxImageSize,
|
||||
file.fileSize <= MAX_IMAGE_SIZE,
|
||||
UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_ACCEPT_IMAGES) {
|
||||
Task {
|
||||
await receiveFile(fileId: file.fileId)
|
||||
}
|
||||
} else if case .voice = cItem.content.msgContent, // TODO check inlineFileMode != IFMSent
|
||||
let file = cItem.file,
|
||||
file.fileSize <= maxImageSize,
|
||||
file.fileSize <= MAX_IMAGE_SIZE,
|
||||
file.fileSize > MAX_VOICE_MESSAGE_SIZE_INLINE_SEND,
|
||||
UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_ACCEPT_IMAGES) {
|
||||
Task {
|
||||
await receiveFile(fileId: file.fileId)
|
||||
|
||||
Reference in New Issue
Block a user