mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-18 09:11:28 +00:00
Various fixes
This commit is contained in:
parent
34cef80179
commit
0077a070f2
@ -494,7 +494,7 @@ extension ChatControllerImpl {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let proceed = {
|
let proceed = {
|
||||||
self.withAudioRecorder({ audioRecorder in
|
self.withAudioRecorder(resuming: true, { audioRecorder in
|
||||||
audioRecorder.resume()
|
audioRecorder.resume()
|
||||||
|
|
||||||
self.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
self.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
||||||
@ -617,13 +617,43 @@ extension ChatControllerImpl {
|
|||||||
self.present(tooltipController, in: .window(.root))
|
self.present(tooltipController, in: .window(.root))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func withAudioRecorder(_ f: (ManagedAudioRecorder) -> Void) {
|
private func withAudioRecorder(resuming: Bool, _ f: (ManagedAudioRecorder) -> Void) {
|
||||||
if let audioRecorder = self.audioRecorderValue {
|
if let audioRecorder = self.audioRecorderValue {
|
||||||
f(audioRecorder)
|
f(audioRecorder)
|
||||||
} else if let recordedMediaPreview = self.presentationInterfaceState.interfaceState.mediaDraftState, case let .audio(audio) = recordedMediaPreview {
|
} else if let recordedMediaPreview = self.presentationInterfaceState.interfaceState.mediaDraftState, case let .audio(audio) = recordedMediaPreview {
|
||||||
self.requestAudioRecorder(beginWithTone: false, existingDraft: audio)
|
self.requestAudioRecorder(beginWithTone: false, existingDraft: audio)
|
||||||
if let audioRecorder = self.audioRecorderValue {
|
if let audioRecorder = self.audioRecorderValue {
|
||||||
f(audioRecorder)
|
f(audioRecorder)
|
||||||
|
|
||||||
|
if !resuming {
|
||||||
|
self.recorderDataDisposable.set(
|
||||||
|
(audioRecorder.takenRecordedData()
|
||||||
|
|> deliverOnMainQueue).startStrict(
|
||||||
|
next: { [weak self] data in
|
||||||
|
if let strongSelf = self, let data = data {
|
||||||
|
let audioWaveform = audio.waveform
|
||||||
|
|
||||||
|
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
|
||||||
|
$0.updatedInterfaceState {
|
||||||
|
$0.withUpdatedMediaDraftState(.audio(
|
||||||
|
ChatInterfaceMediaDraftState.Audio(
|
||||||
|
resource: audio.resource,
|
||||||
|
fileSize: Int32(data.compressedData.count),
|
||||||
|
duration: data.duration,
|
||||||
|
waveform: audioWaveform,
|
||||||
|
trimRange: data.trimRange,
|
||||||
|
resumeData: data.resumeData
|
||||||
|
)
|
||||||
|
))
|
||||||
|
}.updatedInputTextPanelState { panelState in
|
||||||
|
return panelState.withUpdatedMediaRecordingState(nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
strongSelf.updateDownButtonVisibility()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,7 +662,7 @@ extension ChatControllerImpl {
|
|||||||
if let videoRecorder = self.videoRecorderValue {
|
if let videoRecorder = self.videoRecorderValue {
|
||||||
videoRecorder.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply)
|
videoRecorder.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply)
|
||||||
} else {
|
} else {
|
||||||
self.withAudioRecorder({ audioRecorder in
|
self.withAudioRecorder(resuming: false, { audioRecorder in
|
||||||
audioRecorder.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply)
|
audioRecorder.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ final class PlayButtonNode: ASDisplayNode {
|
|||||||
|
|
||||||
transition.updateFrame(node: self.backgroundNode, frame: buttonSize.centered(in: CGRect(origin: .zero, size: size)))
|
transition.updateFrame(node: self.backgroundNode, frame: buttonSize.centered(in: CGRect(origin: .zero, size: size)))
|
||||||
|
|
||||||
self.playPauseIconNode.frame = CGRect(origin: CGPoint(x: 4.0, y: 1.0 - UIScreenPixel), size: CGSize(width: 21.0, height: 21.0))
|
self.playPauseIconNode.frame = CGRect(origin: CGPoint(x: 3.0, y: 1.0 - UIScreenPixel), size: CGSize(width: 21.0, height: 21.0))
|
||||||
|
|
||||||
transition.updateFrame(node: self.durationLabel, frame: CGRect(origin: CGPoint(x: 18.0, y: 3.0), size: CGSize(width: 35.0, height: 20.0)))
|
transition.updateFrame(node: self.durationLabel, frame: CGRect(origin: CGPoint(x: 18.0, y: 3.0), size: CGSize(width: 35.0, height: 20.0)))
|
||||||
transition.updateAlpha(node: self.durationLabel, alpha: buttonSize.width > 27.0 ? 1.0 : 0.0)
|
transition.updateAlpha(node: self.durationLabel, alpha: buttonSize.width > 27.0 ? 1.0 : 0.0)
|
||||||
@ -509,7 +509,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
let minDuration = max(2.0, 56.0 * audio.duration / waveformBackgroundFrame.size.width)
|
let minDuration = max(1.0, 56.0 * audio.duration / waveformBackgroundFrame.size.width)
|
||||||
let (leftHandleFrame, rightHandleFrame) = self.trimView.update(
|
let (leftHandleFrame, rightHandleFrame) = self.trimView.update(
|
||||||
style: .voiceMessage,
|
style: .voiceMessage,
|
||||||
theme: interfaceState.theme,
|
theme: interfaceState.theme,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user