Various fixes

This commit is contained in:
Ilya Laktyushin 2023-09-16 01:25:01 +04:00
parent 5716591030
commit a6785d7d94
4 changed files with 21 additions and 5 deletions

View File

@ -178,6 +178,11 @@ public class LegacyMessageInputPanelNode: ASDisplayNode, TGCaptionPanelView {
self.scheduledMessageInput = nil
}
var hasTimer = self.chatLocation.peerId?.namespace == Namespaces.Peer.CloudUser && !self.isScheduledMessages
if self.chatLocation.peerId?.isRepliesOrSavedMessages(accountPeerId: self.context.account.peerId) == true {
hasTimer = false
}
self.inputPanel.parentState = self.state
let inputPanelSize = self.inputPanel.update(
transition: Transition(transition),
@ -224,7 +229,7 @@ public class LegacyMessageInputPanelNode: ASDisplayNode, TGCaptionPanelView {
self.toggleInputMode()
}
},
timeoutAction: self.chatLocation.peerId?.namespace == Namespaces.Peer.CloudUser && !self.isScheduledMessages ? { [weak self] sourceView, gesture in
timeoutAction: hasTimer ? { [weak self] sourceView, gesture in
if let self {
self.presentTimeoutSetup(sourceView: sourceView, gesture: gesture)
}

View File

@ -527,6 +527,9 @@ public final class MediaEditorValues: Codable, Equatable {
if !self.toolValues.isEmpty {
return true
}
if self.audioTrack != nil {
return true
}
return false
}
}

View File

@ -460,7 +460,7 @@ final class VideoScrubberComponent: Component {
let updatedPosition: Double
if let (start, from, to, _) = self.positionAnimation {
var from = from
if let offset = component.audioData?.offset {
if component.audioOnly, let offset = component.audioData?.offset {
from -= offset
}
let duration = to - from
@ -471,13 +471,13 @@ final class VideoScrubberComponent: Component {
}
} else {
var position = component.position
if let offset = component.audioData?.offset {
if component.audioOnly, let offset = component.audioData?.offset {
position -= offset
}
let advance = component.isPlaying ? timestamp - component.generationTimestamp : 0.0
updatedPosition = max(component.startPosition, min(component.endPosition, position + advance))
}
let cursorHeight: CGFloat = component.audioData != nil ? 80.0 : 50.0
let cursorHeight: CGFloat = component.audioData != nil && !component.audioOnly ? 80.0 : 50.0
self.cursorView.frame = cursorFrame(size: scrubberSize, height: cursorHeight, position: updatedPosition, duration: trimDuration)
}
@ -797,7 +797,7 @@ final class VideoScrubberComponent: Component {
self.positionAnimation = nil
self.displayLink?.isPaused = true
let cursorHeight: CGFloat = component.audioData != nil ? 80.0 : 50.0
let cursorHeight: CGFloat = component.audioData != nil && !component.audioOnly ? 80.0 : 50.0
var cursorPosition = component.position
if component.audioOnly, let audioOffset = component.audioData?.offset {
cursorPosition -= audioOffset

View File

@ -409,7 +409,15 @@ public final class TextFieldComponent: Component {
}
public func textViewDidBeginEditing(_ textView: UITextView) {
guard let component = self.component else {
return
}
self.state?.updated(transition: Transition(animation: .curve(duration: 0.5, curve: .spring)).withUserData(AnimationHint(kind: .textFocusChanged)))
if component.isOneLineWhenUnfocused {
Queue.mainQueue().justDispatch {
self.textView.selectedTextRange = self.textView.textRange(from: self.textView.endOfDocument, to: self.textView.endOfDocument)
}
}
}
public func textViewDidEndEditing(_ textView: UITextView) {