mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various Fixes
This commit is contained in:
@@ -9,6 +9,9 @@ public final class SparseNode: ASDisplayNode {
|
|||||||
if self.alpha.isZero {
|
if self.alpha.isZero {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if !self.bounds.contains(point) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
for view in self.view.subviews {
|
for view in self.view.subviews {
|
||||||
if let result = view.hitTest(self.view.convert(point, to: view), with: event), result.isUserInteractionEnabled {
|
if let result = view.hitTest(self.view.convert(point, to: view), with: event), result.isUserInteractionEnabled {
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -23,14 +23,16 @@ public class InfoListItem: ListViewItem {
|
|||||||
let title: String
|
let title: String
|
||||||
let text: InfoListItemText
|
let text: InfoListItemText
|
||||||
let style: ItemListStyle
|
let style: ItemListStyle
|
||||||
|
let hasDecorations: Bool
|
||||||
let linkAction: ((InfoListItemLinkAction) -> Void)?
|
let linkAction: ((InfoListItemLinkAction) -> Void)?
|
||||||
let closeAction: (() -> Void)?
|
let closeAction: (() -> Void)?
|
||||||
|
|
||||||
public init(presentationData: ItemListPresentationData, title: String, text: InfoListItemText, style: ItemListStyle, linkAction: ((InfoListItemLinkAction) -> Void)? = nil, closeAction: (() -> Void)?) {
|
public init(presentationData: ItemListPresentationData, title: String, text: InfoListItemText, style: ItemListStyle, hasDecorations: Bool = true, linkAction: ((InfoListItemLinkAction) -> Void)? = nil, closeAction: (() -> Void)?) {
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
self.title = title
|
self.title = title
|
||||||
self.text = text
|
self.text = text
|
||||||
self.style = style
|
self.style = style
|
||||||
|
self.hasDecorations = hasDecorations
|
||||||
self.linkAction = linkAction
|
self.linkAction = linkAction
|
||||||
self.closeAction = closeAction
|
self.closeAction = closeAction
|
||||||
}
|
}
|
||||||
@@ -301,7 +303,7 @@ public class InfoItemNode: ListViewItemNode {
|
|||||||
strongSelf.topStripeNode.isHidden = true
|
strongSelf.topStripeNode.isHidden = true
|
||||||
default:
|
default:
|
||||||
hasTopCorners = true
|
hasTopCorners = true
|
||||||
strongSelf.topStripeNode.isHidden = hasCorners
|
strongSelf.topStripeNode.isHidden = hasCorners || !item.hasDecorations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let bottomStripeInset: CGFloat
|
let bottomStripeInset: CGFloat
|
||||||
@@ -312,10 +314,13 @@ public class InfoItemNode: ListViewItemNode {
|
|||||||
default:
|
default:
|
||||||
bottomStripeInset = 0.0
|
bottomStripeInset = 0.0
|
||||||
hasBottomCorners = true
|
hasBottomCorners = true
|
||||||
strongSelf.bottomStripeNode.isHidden = hasCorners
|
strongSelf.bottomStripeNode.isHidden = hasCorners || !item.hasDecorations
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bottomStripeInset = leftInset
|
bottomStripeInset = leftInset
|
||||||
|
if !item.hasDecorations {
|
||||||
|
strongSelf.topStripeNode.isHidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.closeButton.isHidden = item.closeAction == nil
|
strongSelf.closeButton.isHidden = item.closeAction == nil
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
|
|||||||
private let highlightedBackgroundNode: ASDisplayNode
|
private let highlightedBackgroundNode: ASDisplayNode
|
||||||
private var linkHighlightingNode: LinkHighlightingNode?
|
private var linkHighlightingNode: LinkHighlightingNode?
|
||||||
private var selectionNode: ItemListSelectableControlNode?
|
private var selectionNode: ItemListSelectableControlNode?
|
||||||
|
private let maskNode: ASImageNode
|
||||||
|
|
||||||
public var item: ItemListTextWithLabelItem?
|
public var item: ItemListTextWithLabelItem?
|
||||||
|
|
||||||
@@ -111,6 +112,9 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
|
|||||||
self.backgroundNode = ASDisplayNode()
|
self.backgroundNode = ASDisplayNode()
|
||||||
self.backgroundNode.isLayerBacked = true
|
self.backgroundNode.isLayerBacked = true
|
||||||
|
|
||||||
|
self.maskNode = ASImageNode()
|
||||||
|
self.maskNode.isUserInteractionEnabled = false
|
||||||
|
|
||||||
self.topStripeNode = ASDisplayNode()
|
self.topStripeNode = ASDisplayNode()
|
||||||
self.topStripeNode.isLayerBacked = true
|
self.topStripeNode.isLayerBacked = true
|
||||||
|
|
||||||
@@ -285,7 +289,9 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
|
|||||||
if strongSelf.bottomStripeNode.supernode == nil {
|
if strongSelf.bottomStripeNode.supernode == nil {
|
||||||
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 0)
|
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 0)
|
||||||
}
|
}
|
||||||
|
if strongSelf.maskNode.supernode != nil {
|
||||||
|
strongSelf.maskNode.removeFromSupernode()
|
||||||
|
}
|
||||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: leftInset, y: contentSize.height - separatorHeight), size: CGSize(width: params.width - leftInset, height: separatorHeight))
|
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: leftInset, y: contentSize.height - separatorHeight), size: CGSize(width: params.width - leftInset, height: separatorHeight))
|
||||||
case .blocks:
|
case .blocks:
|
||||||
leftInset = 16.0 + params.leftInset
|
leftInset = 16.0 + params.leftInset
|
||||||
@@ -299,11 +305,19 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
|
|||||||
if strongSelf.bottomStripeNode.supernode == nil {
|
if strongSelf.bottomStripeNode.supernode == nil {
|
||||||
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 2)
|
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 2)
|
||||||
}
|
}
|
||||||
|
if strongSelf.maskNode.supernode == nil {
|
||||||
|
strongSelf.insertSubnode(strongSelf.maskNode, at: 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
let hasCorners = itemListHasRoundedBlockLayout(params)
|
||||||
|
var hasTopCorners = false
|
||||||
|
var hasBottomCorners = false
|
||||||
switch neighbors.top {
|
switch neighbors.top {
|
||||||
case .sameSection(false):
|
case .sameSection(false):
|
||||||
strongSelf.topStripeNode.isHidden = true
|
strongSelf.topStripeNode.isHidden = true
|
||||||
default:
|
default:
|
||||||
strongSelf.topStripeNode.isHidden = false
|
hasTopCorners = true
|
||||||
|
strongSelf.topStripeNode.isHidden = hasCorners
|
||||||
}
|
}
|
||||||
let bottomStripeInset: CGFloat
|
let bottomStripeInset: CGFloat
|
||||||
let bottomStripeOffset: CGFloat
|
let bottomStripeOffset: CGFloat
|
||||||
@@ -314,8 +328,14 @@ public class ItemListTextWithLabelItemNode: ListViewItemNode {
|
|||||||
default:
|
default:
|
||||||
bottomStripeInset = 0.0
|
bottomStripeInset = 0.0
|
||||||
bottomStripeOffset = 0.0
|
bottomStripeOffset = 0.0
|
||||||
|
hasBottomCorners = true
|
||||||
|
strongSelf.bottomStripeNode.isHidden = hasCorners
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.presentationData.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
|
||||||
|
|
||||||
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||||
|
strongSelf.maskNode.frame = strongSelf.backgroundNode.frame.insetBy(dx: params.leftInset, dy: 0.0)
|
||||||
strongSelf.topStripeNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: separatorHeight))
|
strongSelf.topStripeNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: separatorHeight))
|
||||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: bottomStripeInset, y: contentSize.height + bottomStripeOffset), size: CGSize(width: params.width - bottomStripeInset, height: separatorHeight))
|
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: bottomStripeInset, y: contentSize.height + bottomStripeOffset), size: CGSize(width: params.width - bottomStripeInset, height: separatorHeight))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2475,17 +2475,15 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
|
|||||||
let backgroundView = UIImageView(image: backgroundImage)
|
let backgroundView = UIImageView(image: backgroundImage)
|
||||||
backgroundView.frame = self.textInputBackgroundNode.frame
|
backgroundView.frame = self.textInputBackgroundNode.frame
|
||||||
|
|
||||||
func updateIsCaretHidden(view: UIView, isHidden: Bool) {
|
let caretColor = textInputNode.textView.tintColor
|
||||||
}
|
textInputNode.textView.tintColor = .clear
|
||||||
|
|
||||||
updateIsCaretHidden(view: textInputNode.view, isHidden: true)
|
|
||||||
|
|
||||||
guard let contentView = textInputNode.view.snapshotView(afterScreenUpdates: true) else {
|
guard let contentView = textInputNode.view.snapshotView(afterScreenUpdates: true) else {
|
||||||
updateIsCaretHidden(view: textInputNode.view, isHidden: false)
|
textInputNode.textView.tintColor = caretColor
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIsCaretHidden(view: textInputNode.view, isHidden: false)
|
textInputNode.textView.tintColor = caretColor
|
||||||
|
|
||||||
contentView.frame = textInputNode.frame
|
contentView.frame = textInputNode.frame
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ private final class PeerInfoScreenInfoItemNode: PeerInfoScreenItemNode {
|
|||||||
|
|
||||||
self.bottomSeparatorNode.backgroundColor = presentationData.theme.list.itemBlocksSeparatorColor
|
self.bottomSeparatorNode.backgroundColor = presentationData.theme.list.itemBlocksSeparatorColor
|
||||||
|
|
||||||
let infoItem = InfoListItem(presentationData: ItemListPresentationData(presentationData), title: item.title, text: item.text, style: .blocks, linkAction: { link in
|
let infoItem = InfoListItem(presentationData: ItemListPresentationData(presentationData), title: item.title, text: item.text, style: .blocks, hasDecorations: false, linkAction: { link in
|
||||||
item.linkAction?(link)
|
item.linkAction?(link)
|
||||||
}, closeAction: nil)
|
}, closeAction: nil)
|
||||||
let params = ListViewItemLayoutParams(width: width, leftInset: safeInsets.left, rightInset: safeInsets.right, availableHeight: 1000.0)
|
let params = ListViewItemLayoutParams(width: width, leftInset: safeInsets.left, rightInset: safeInsets.right, availableHeight: 1000.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user