Various fixes

This commit is contained in:
Ilya Laktyushin 2021-02-23 23:35:18 +04:00
parent 1b3512c698
commit 45977d6bb9
4 changed files with 22 additions and 5 deletions

View File

@ -100,8 +100,9 @@ final class PeekControllerMenuItemNode: HighlightTrackingButtonNode {
}
@objc func buttonPressed() {
self.activatedAction()
if self.item.action(self, self.bounds) {
self.activatedAction()
}
}
}

View File

@ -307,7 +307,14 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
private var automaticMediaDownloadSettingsDisposable: Disposable?
private var disableStickerAnimationsPromise = ValuePromise<Bool>(false)
private var disableStickerAnimations = false
private var disableStickerAnimationsValue = false
var disableStickerAnimations: Bool {
get {
return self.disableStickerAnimationsValue
} set {
self.disableStickerAnimationsPromise.set(newValue)
}
}
private var stickerSettings: ChatInterfaceStickerSettings
private var stickerSettingsDisposable: Disposable?
@ -3449,9 +3456,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
let chatStickerSettings = ChatInterfaceStickerSettings(stickerSettings: stickerSettings)
if let strongSelf = self, strongSelf.stickerSettings != chatStickerSettings || strongSelf.disableStickerAnimations != disableStickerAnimations {
if let strongSelf = self, strongSelf.stickerSettings != chatStickerSettings || strongSelf.disableStickerAnimationsValue != disableStickerAnimations {
strongSelf.stickerSettings = chatStickerSettings
strongSelf.disableStickerAnimations = disableStickerAnimations
strongSelf.disableStickerAnimationsValue = disableStickerAnimations
strongSelf.controllerInteraction?.stickerSettings = chatStickerSettings
if strongSelf.isNodeLoaded {
strongSelf.chatDisplayNode.updateStickerSettings(chatStickerSettings, forceStopAnimations: disableStickerAnimations)

View File

@ -964,6 +964,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
}
if let inputMediaNode = inputNode as? ChatMediaInputNode, self.inputMediaNode == nil {
self.inputMediaNode = inputMediaNode
inputMediaNode.requestDisableStickerAnimations = { [weak self] disabled in
self?.controller?.disableStickerAnimations = disabled
}
}
if self.inputNode != inputNode {
dismissedInputNode = self.inputNode
@ -2170,6 +2173,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
}
})
inputNode.interfaceInteraction = interfaceInteraction
inputNode.requestDisableStickerAnimations = { [weak self] disabled in
self?.controller?.disableStickerAnimations = disabled
}
self.inputMediaNode = inputNode
if let (validLayout, _) = self.validLayout {
let _ = inputNode.updateLayout(width: validLayout.size.width, leftInset: validLayout.safeInsets.left, rightInset: validLayout.safeInsets.right, bottomInset: validLayout.intrinsicInsets.bottom, standardInputHeight: validLayout.standardInputHeight, inputHeight: validLayout.inputHeight ?? 0.0, maximumHeight: validLayout.standardInputHeight, inputPanelHeight: 44.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState, deviceMetrics: validLayout.deviceMetrics, isVisible: false)

View File

@ -448,6 +448,8 @@ final class ChatMediaInputNode: ChatInputNode {
private var currentView: ItemCollectionsView?
private let dismissedPeerSpecificStickerPack = Promise<Bool>()
var requestDisableStickerAnimations: ((Bool) -> Void)?
private var validLayout: (CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, CGFloat, ChatPresentationInterfaceState, DeviceMetrics, Bool)?
private var paneArrangement: ChatMediaInputPaneArrangement
private var initializedArrangement = false
@ -1243,7 +1245,8 @@ final class ChatMediaInputNode: ChatInputNode {
return sourceNode
})
controller.visibilityUpdated = { [weak self] visible in
self?.requestDisableStickerAnimations?(visible)
self?.simulateUpdateLayout(isVisible: !visible)
}
strongSelf.controllerInteraction.presentGlobalOverlayController(controller, nil)
return controller