Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-12-23 20:17:18 +04:00
parent 8bef96fbe0
commit 380a608ee8
4 changed files with 32 additions and 16 deletions

View File

@ -99,8 +99,8 @@ class CaptionScrollWrapperNode: ASDisplayNode {
if result == self.view, let subnode = self.subnodes?.first { if result == self.view, let subnode = self.subnodes?.first {
let convertedPoint = self.view.convert(point, to: subnode.view) let convertedPoint = self.view.convert(point, to: subnode.view)
if let subnodes = subnode.subnodes { if let subnodes = subnode.subnodes {
for node in subnodes { for node in subnodes.reversed() {
if node.frame.contains(convertedPoint) { if node.frame.contains(convertedPoint) && node.isUserInteractionEnabled {
return node.view return node.view
} }
} }
@ -722,6 +722,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
if self.spoilerTextNode == nil { if self.spoilerTextNode == nil {
let spoilerTextNode = ImmediateTextNode() let spoilerTextNode = ImmediateTextNode()
spoilerTextNode.attributedText = textNode.attributedText spoilerTextNode.attributedText = textNode.attributedText
spoilerTextNode.maximumNumberOfLines = 0
spoilerTextNode.linkHighlightColor = UIColor(rgb: 0x5ac8fa, alpha: 0.2) spoilerTextNode.linkHighlightColor = UIColor(rgb: 0x5ac8fa, alpha: 0.2)
spoilerTextNode.displaySpoilers = true spoilerTextNode.displaySpoilers = true
spoilerTextNode.isHidden = false spoilerTextNode.isHidden = false

View File

@ -227,6 +227,8 @@ public class InvisibleInkDustNode: ASDisplayNode {
let timeToRead = min(45.0, ceil(max(4.0, Double(spoilersLength) * 0.04))) let timeToRead = min(45.0, ceil(max(4.0, Double(spoilersLength) * 0.04)))
Queue.mainQueue().after(timeToRead * UIView.animationDurationFactor()) { Queue.mainQueue().after(timeToRead * UIView.animationDurationFactor()) {
// self.emitterLayer?.setValue(false, forKeyPath: "emitterBehaviors.fingerAttractor.enabled")
if let (_, color, _, _) = self.currentParams { if let (_, color, _, _) = self.currentParams {
let colorSpace = CGColorSpaceCreateDeviceRGB() let colorSpace = CGColorSpaceCreateDeviceRGB()
let animation = POPBasicAnimation() let animation = POPBasicAnimation()

View File

@ -870,9 +870,10 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg
} }
let initiallySelectedEmoticon: Signal<String, NoError> let initiallySelectedEmoticon: Signal<String, NoError>
let sharedData = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings])
|> take(1)
if self.peer.id == self.context.account.peerId { if self.peer.id == self.context.account.peerId {
initiallySelectedEmoticon = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings]) initiallySelectedEmoticon = sharedData
|> take(1)
|> map { sharedData -> String in |> map { sharedData -> String in
let themeSettings: PresentationThemeSettings let themeSettings: PresentationThemeSettings
if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) { if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) {
@ -883,19 +884,27 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg
return themeSettings.theme.emoticon ?? defaultEmoticon return themeSettings.theme.emoticon ?? defaultEmoticon
} }
} else { } else {
initiallySelectedEmoticon = self.context.account.postbox.transaction { transaction in let cachedData = self.context.account.postbox.transaction { transaction in
return transaction.getPeerCachedData(peerId: peer.id) return transaction.getPeerCachedData(peerId: peer.id)
} }
|> take(1) initiallySelectedEmoticon = combineLatest(cachedData, sharedData)
|> map { cachedData -> String in |> map { cachedData, sharedData -> String in
if let cachedData = cachedData as? CachedUserData { let themeSettings: PresentationThemeSettings
return cachedData.themeEmoticon ?? defaultEmoticon if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) {
} else if let cachedData = cachedData as? CachedGroupData { themeSettings = current
return cachedData.themeEmoticon ?? defaultEmoticon
} else if let cachedData = cachedData as? CachedChannelData {
return cachedData.themeEmoticon ?? defaultEmoticon
} else { } 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
} }
} }
} }

View File

@ -101,8 +101,12 @@ private func commitEntity(_ utf16: String.UTF16View, _ type: CurrentEntityType,
var overlaps = false var overlaps = false
for entity in entities { for entity in entities {
if entity.range.overlaps(indexRange) { if entity.range.overlaps(indexRange) {
overlaps = true if case .Spoiler = entity.type {
break
} else {
overlaps = true
break
}
} }
} }
if !overlaps { if !overlaps {