diff --git a/submodules/AsyncDisplayKit/Source/ASEditableTextNode.mm b/submodules/AsyncDisplayKit/Source/ASEditableTextNode.mm index 984e293e31..4e7f6c3935 100644 --- a/submodules/AsyncDisplayKit/Source/ASEditableTextNode.mm +++ b/submodules/AsyncDisplayKit/Source/ASEditableTextNode.mm @@ -114,7 +114,28 @@ } - (void)setContentSize:(CGSize)contentSize { - [super setContentSize:contentSize]; + if (_shouldBlockPanGesture) { + return; + } + [super setContentSize:contentSize]; +} + +- (void)setContentOffset:(CGPoint)contentOffset { + if (_shouldBlockPanGesture) { + return; + } + [super setContentOffset:contentOffset]; +} + +- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated { + if (_shouldBlockPanGesture) { + return; + } + [super setContentOffset:contentOffset animated:animated]; +} + +- (void)setBounds:(CGRect)bounds { + [super setBounds:bounds]; } - (BOOL)canPerformAction:(SEL)action withSender:(id)sender diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index 6e1ab4d3f7..790288bb53 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -1867,6 +1867,9 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { transition.animatePosition(node: strongSelf.titleNode, from: CGPoint(x: titlePosition.x - contentDelta.x, y: titlePosition.y - contentDelta.y)) transition.animatePositionAdditive(node: strongSelf.textNode, offset: CGPoint(x: -contentDelta.x, y: -contentDelta.y)) + if let dustNode = strongSelf.dustNode { + transition.animatePositionAdditive(node: dustNode, offset: CGPoint(x: -contentDelta.x, y: -contentDelta.y)) + } let authorPosition = strongSelf.authorNode.position transition.animatePosition(node: strongSelf.authorNode, from: CGPoint(x: authorPosition.x - contentDelta.x, y: authorPosition.y - contentDelta.y)) diff --git a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift index df4179027e..047f9c984a 100644 --- a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift +++ b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift @@ -99,8 +99,8 @@ class CaptionScrollWrapperNode: ASDisplayNode { if result == self.view, let subnode = self.subnodes?.first { let convertedPoint = self.view.convert(point, to: subnode.view) if let subnodes = subnode.subnodes { - for node in subnodes { - if node.frame.contains(convertedPoint) { + for node in subnodes.reversed() { + if node.frame.contains(convertedPoint) && node.isUserInteractionEnabled { return node.view } } @@ -722,6 +722,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll if self.spoilerTextNode == nil { let spoilerTextNode = ImmediateTextNode() spoilerTextNode.attributedText = textNode.attributedText + spoilerTextNode.maximumNumberOfLines = 0 spoilerTextNode.linkHighlightColor = UIColor(rgb: 0x5ac8fa, alpha: 0.2) spoilerTextNode.displaySpoilers = true spoilerTextNode.isHidden = false diff --git a/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift b/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift index 10c2a34041..4b33f1ba21 100644 --- a/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift +++ b/submodules/InvisibleInkDustNode/Sources/InvisibleInkDustNode.swift @@ -227,6 +227,8 @@ public class InvisibleInkDustNode: ASDisplayNode { let timeToRead = min(45.0, ceil(max(4.0, Double(spoilersLength) * 0.04))) Queue.mainQueue().after(timeToRead * UIView.animationDurationFactor()) { +// self.emitterLayer?.setValue(false, forKeyPath: "emitterBehaviors.fingerAttractor.enabled") + if let (_, color, _, _) = self.currentParams { let colorSpace = CGColorSpaceCreateDeviceRGB() let animation = POPBasicAnimation() @@ -311,7 +313,7 @@ public class InvisibleInkDustNode: ASDisplayNode { } public override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { - if let (_, _, rects, _) = self.currentParams { + if let (_, _, rects, _) = self.currentParams, !self.isRevealed { for rect in rects { if rect.contains(point) { return true diff --git a/submodules/TelegramUI/Sources/ChatQrCodeScreen.swift b/submodules/TelegramUI/Sources/ChatQrCodeScreen.swift index ba593996a9..47521515b8 100644 --- a/submodules/TelegramUI/Sources/ChatQrCodeScreen.swift +++ b/submodules/TelegramUI/Sources/ChatQrCodeScreen.swift @@ -870,9 +870,10 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg } let initiallySelectedEmoticon: Signal + let sharedData = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]) + |> take(1) if self.peer.id == self.context.account.peerId { - initiallySelectedEmoticon = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]) - |> take(1) + initiallySelectedEmoticon = sharedData |> map { sharedData -> String in let themeSettings: PresentationThemeSettings if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) { @@ -883,19 +884,27 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg return themeSettings.theme.emoticon ?? defaultEmoticon } } else { - initiallySelectedEmoticon = self.context.account.postbox.transaction { transaction in + let cachedData = self.context.account.postbox.transaction { transaction in return transaction.getPeerCachedData(peerId: peer.id) } - |> take(1) - |> map { cachedData -> String in - if let cachedData = cachedData as? CachedUserData { - return cachedData.themeEmoticon ?? defaultEmoticon - } else if let cachedData = cachedData as? CachedGroupData { - return cachedData.themeEmoticon ?? defaultEmoticon - } else if let cachedData = cachedData as? CachedChannelData { - return cachedData.themeEmoticon ?? defaultEmoticon + initiallySelectedEmoticon = combineLatest(cachedData, sharedData) + |> map { cachedData, sharedData -> String in + let themeSettings: PresentationThemeSettings + if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) { + themeSettings = current } else { - return defaultEmoticon + themeSettings = PresentationThemeSettings.defaultSettings + } + let currentDefaultEmoticon = themeSettings.theme.emoticon ?? defaultEmoticon + + if let cachedData = cachedData as? CachedUserData { + return cachedData.themeEmoticon ?? currentDefaultEmoticon + } else if let cachedData = cachedData as? CachedGroupData { + return cachedData.themeEmoticon ?? currentDefaultEmoticon + } else if let cachedData = cachedData as? CachedChannelData { + return cachedData.themeEmoticon ?? currentDefaultEmoticon + } else { + return currentDefaultEmoticon } } } diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index 2c629d71cd..3bef46b634 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -1908,6 +1908,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { let accentTextColor = presentationInterfaceState.theme.chat.inputPanel.panelControlAccentColor let baseFontSize = max(minInputFontSize, presentationInterfaceState.fontSize.baseDisplaySize) + textInputNode.textView.isScrollEnabled = false + refreshChatTextInputAttributes(textInputNode, theme: presentationInterfaceState.theme, baseFontSize: baseFontSize, spoilersRevealed: self.spoilersRevealed) textInputNode.attributedText = textAttributedStringForStateText(self.inputTextState.inputText, fontSize: baseFontSize, textColor: textColor, accentTextColor: accentTextColor, writingDirection: nil, spoilersRevealed: self.spoilersRevealed) @@ -1916,15 +1918,23 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { let containerView = textInputNode.textView.subviews[1] if let canvasView = containerView.subviews.first { if let snapshotView = canvasView.snapshotView(afterScreenUpdates: false) { + snapshotView.frame = canvasView.frame.offsetBy(dx: 0.0, dy: -textInputNode.textView.contentOffset.y) textInputNode.view.insertSubview(snapshotView, at: 0) canvasView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3) - snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak snapshotView] _ in + snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak snapshotView, weak textInputNode] _ in + textInputNode?.textView.isScrollEnabled = false snapshotView?.removeFromSuperview() + Queue.mainQueue().after(0.1) { + textInputNode?.textView.isScrollEnabled = true + } }) } } } - + Queue.mainQueue().after(0.1) { + textInputNode.textView.isScrollEnabled = true + } + if animated { if revealed { let transition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .linear) diff --git a/submodules/TextFormat/Sources/GenerateTextEntities.swift b/submodules/TextFormat/Sources/GenerateTextEntities.swift index 8f0114185c..b65d3c72bd 100644 --- a/submodules/TextFormat/Sources/GenerateTextEntities.swift +++ b/submodules/TextFormat/Sources/GenerateTextEntities.swift @@ -101,8 +101,12 @@ private func commitEntity(_ utf16: String.UTF16View, _ type: CurrentEntityType, var overlaps = false for entity in entities { if entity.range.overlaps(indexRange) { - overlaps = true - break + if case .Spoiler = entity.type { + + } else { + overlaps = true + break + } } } if !overlaps { diff --git a/submodules/Translate/Sources/Translate.swift b/submodules/Translate/Sources/Translate.swift index 836f825fd5..57b0b2fc15 100644 --- a/submodules/Translate/Sources/Translate.swift +++ b/submodules/Translate/Sources/Translate.swift @@ -59,6 +59,8 @@ public func translateText(context: AccountContext, text: String) { return } if #available(iOS 15.0, *) { + let text = text.unicodeScalars.filter { !$0.properties.isEmojiPresentation}.reduce("") { $0 + String($1) } + let textView = UITextView() textView.text = text textView.isEditable = false