diff --git a/submodules/ManagedAnimationNode/Sources/ManagedAnimationNode.swift b/submodules/ManagedAnimationNode/Sources/ManagedAnimationNode.swift index fbc2070db4..d0131d6460 100644 --- a/submodules/ManagedAnimationNode/Sources/ManagedAnimationNode.swift +++ b/submodules/ManagedAnimationNode/Sources/ManagedAnimationNode.swift @@ -156,6 +156,9 @@ open class ManagedAnimationNode: ASDisplayNode { public var trackStack: [ManagedAnimationItem] = [] public var didTryAdvancingState = false + private var previousTimestamp: Double? + private var delta: Double? + public var customColor: UIColor? { didSet { if let customColor = self.customColor, oldValue?.rgb != customColor.rgb { @@ -188,7 +191,22 @@ open class ManagedAnimationNode: ASDisplayNode { self.addSubnode(self.imageNode) displayLinkUpdate = { [weak self] in - self?.updateAnimation() + if let strongSelf = self { + let timestamp = CACurrentMediaTime() + var delta: Double + if let previousTimestamp = strongSelf.previousTimestamp { + delta = min(timestamp - previousTimestamp, 1.0 / 60.0) + if let currentDelta = strongSelf.delta, currentDelta < delta { + delta = currentDelta + } + } else { + delta = 1.0 / 60.0 + } + strongSelf.previousTimestamp = timestamp + strongSelf.delta = delta + + strongSelf.updateAnimation() + } } } @@ -278,9 +296,8 @@ open class ManagedAnimationNode: ASDisplayNode { } } - var animationAdvancement: Double = 1.0 / 60.0 + var animationAdvancement: Double = self.delta ?? 1.0 / 60.0 animationAdvancement *= Double(min(2, self.trackStack.count + 1)) - state.relativeTime += animationAdvancement if state.relativeTime >= duration && !self.didTryAdvancingState { diff --git a/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift index 20a3d8d3dc..5dfa4a8272 100644 --- a/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift +++ b/submodules/TelegramBaseController/Sources/MediaNavigationAccessoryHeaderNode.swift @@ -506,7 +506,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi let _ = (ApplicationSpecificNotice.incrementAudioRateOptionsTip(accountManager: self.context.sharedContext.accountManager) |> deliverOnMainQueue).start(next: { [weak self] value in - if let strongSelf = self, let controller = strongSelf.getController?(), value == 4 { + if let strongSelf = self, let controller = strongSelf.getController?(), value == 2 { controller.present(TooltipScreen(account: strongSelf.context.account, text: strongSelf.strings.Conversation_AudioRateOptionsTooltip, style: .default, icon: nil, location: .point(frame.offsetBy(dx: 0.0, dy: 4.0), .bottom), displayDuration: .custom(3.0), inset: 3.0, shouldDismissOnTouch: { _ in return .dismiss(consume: false) }), in: .window(.root)) diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index 4fe5a44bf7..074ef6ff12 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -2487,9 +2487,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { textView.inputView = updatedInputView if textView.isFirstResponder { if self.chatPresentationInterfaceStateRequiresInputFocus(chatPresentationInterfaceState) { - if let validLayout = self.validLayout, validLayout.0.inputHeight != nil { - waitForKeyboardLayout = true - } else { + if let validLayout = self.validLayout, let inputHeight = validLayout.0.inputHeight, inputHeight > 44.0 { waitForKeyboardLayout = true } }