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 {
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

View File

@ -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()

View File

@ -870,9 +870,10 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg
}
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 {
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
}
}
}

View File

@ -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 {