mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Search filters fixes
This commit is contained in:
parent
a8f4663852
commit
5203c4bb43
@ -81,6 +81,7 @@ private struct ChatListSearchContainerNodeSearchState: Equatable {
|
||||
public final class ChatListSearchContainerNode: SearchDisplayControllerContentNode {
|
||||
private let context: AccountContext
|
||||
private let peersFilter: ChatListNodePeersFilter
|
||||
private let groupId: PeerGroupId
|
||||
private var interaction: ChatListSearchInteraction?
|
||||
private let openMessage: (Peer, MessageId, Bool) -> Void
|
||||
private let navigationController: NavigationController?
|
||||
@ -125,6 +126,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
public init(context: AccountContext, filter: ChatListNodePeersFilter, groupId: PeerGroupId, openPeer originalOpenPeer: @escaping (Peer, Bool) -> Void, openDisabledPeer: @escaping (Peer) -> Void, openRecentPeerOptions: @escaping (Peer) -> Void, openMessage originalOpenMessage: @escaping (Peer, MessageId, Bool) -> Void, addContact: ((String) -> Void)?, peerContextAction: ((Peer, ChatListSearchContextActionSource, ASDisplayNode, ContextGesture?) -> Void)?, present: @escaping (ViewController, Any?) -> Void, presentInGlobalOverlay: @escaping (ViewController, Any?) -> Void, navigationController: NavigationController?) {
|
||||
self.context = context
|
||||
self.peersFilter = filter
|
||||
self.groupId = groupId
|
||||
self.navigationController = navigationController
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
@ -488,6 +490,15 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
let overflowInset: CGFloat = 20.0
|
||||
self.filterContainerNode.update(size: CGSize(width: layout.size.width - overflowInset * 2.0, height: 38.0), sideInset: layout.safeInsets.left - overflowInset, filters: filters.map { .filter($0) }, selectedFilter: self.selectedFilterKey, transitionFraction: self.transitionFraction, presentationData: self.presentationData, transition: .animated(duration: 0.4, curve: .spring))
|
||||
|
||||
var bottomIntrinsicInset = layout.intrinsicInsets.bottom
|
||||
if case .root = self.groupId {
|
||||
if layout.safeInsets.left > overflowInset {
|
||||
bottomIntrinsicInset -= 34.0
|
||||
} else {
|
||||
bottomIntrinsicInset -= 49.0
|
||||
}
|
||||
}
|
||||
|
||||
if let selectedMessageIds = self.stateValue.selectedMessageIds {
|
||||
var wasAdded = false
|
||||
let selectionPanelNode: ChatListSearchMessageSelectionPanelNode
|
||||
@ -541,7 +552,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
}
|
||||
selectionPanelNode.selectedMessages = selectedMessageIds
|
||||
|
||||
let panelHeight = selectionPanelNode.update(layout: layout, presentationData: self.presentationData, transition: wasAdded ? .immediate : transition)
|
||||
let panelHeight = selectionPanelNode.update(layout: layout.addedInsets(insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: -(layout.intrinsicInsets.bottom - bottomIntrinsicInset), right: 0.0)), presentationData: self.presentationData, transition: wasAdded ? .immediate : transition)
|
||||
let panelFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - panelHeight), size: CGSize(width: layout.size.width, height: panelHeight))
|
||||
if wasAdded {
|
||||
selectionPanelNode.frame = panelFrame
|
||||
@ -561,12 +572,8 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
var bottomInset = layout.intrinsicInsets.bottom
|
||||
if let inputHeight = layout.inputHeight {
|
||||
bottomInset = inputHeight
|
||||
} else {
|
||||
if !layout.safeInsets.left.isZero {
|
||||
bottomInset -= 34.0
|
||||
} else {
|
||||
bottomInset -= 49.0
|
||||
}
|
||||
} else if case .root = self.groupId {
|
||||
bottomInset -= bottomIntrinsicInset
|
||||
}
|
||||
|
||||
self.paneContainerNode.update(size: CGSize(width: layout.size.width, height: layout.size.height - topInset), sideInset: layout.safeInsets.left, bottomInset: bottomInset, visibleHeight: layout.size.height - topInset, presentationData: self.presentationData, transition: transition)
|
||||
|
@ -2361,9 +2361,9 @@ private final class ChatListSearchShimmerNode: ASDisplayNode {
|
||||
if let media = itemNode.currentMedia as? TelegramMediaFile {
|
||||
isVoice = media.isVoice
|
||||
if media.isMusic || media.isVoice {
|
||||
context.fillEllipse(in: CGRect(x: 12.0, y: currentY + 12.0, width: 40.0, height: 40.0))
|
||||
context.fillEllipse(in: CGRect(x: 12.0, y: currentY + 8.0, width: 40.0, height: 40.0))
|
||||
} else {
|
||||
let path = UIBezierPath(roundedRect: CGRect(x: 12.0, y: currentY + 12.0, width: 40.0, height: 40.0), cornerRadius: 6.0)
|
||||
let path = UIBezierPath(roundedRect: CGRect(x: 12.0, y: currentY + 8.0, width: 40.0, height: 40.0), cornerRadius: 6.0)
|
||||
context.addPath(path.cgPath)
|
||||
context.fillPath()
|
||||
}
|
||||
@ -2389,7 +2389,7 @@ private final class ChatListSearchShimmerNode: ASDisplayNode {
|
||||
let titleFrame = itemNode.titleNode.frame.offsetBy(dx: 0.0, dy: currentY)
|
||||
fillLabelPlaceholderRect(origin: CGPoint(x: titleFrame.minX, y: floor(titleFrame.midY - fakeLabelPlaceholderHeight / 2.0)), width: 120.0)
|
||||
|
||||
let linkFrame = itemNode.linkNode.frame.offsetBy(dx: 0.0, dy: currentY)
|
||||
let linkFrame = itemNode.linkNode.frame.offsetBy(dx: 0.0, dy: currentY - 1.0)
|
||||
fillLabelPlaceholderRect(origin: CGPoint(x: linkFrame.minX, y: floor(linkFrame.midY - fakeLabelPlaceholderHeight / 2.0)), width: 240.0)
|
||||
|
||||
let authorFrame = itemNode.authorNode.frame.offsetBy(dx: 0.0, dy: currentY)
|
||||
|
@ -164,7 +164,7 @@ final class ChatListSearchMessageSelectionPanelNode: ASDisplayNode {
|
||||
self.forwardButton.frame = CGRect(origin: CGPoint(x: width - rightInset - 57.0, y: 0.0), size: CGSize(width: 57.0, height: panelHeight))
|
||||
self.shareButton.frame = CGRect(origin: CGPoint(x: floor((width - rightInset - 57.0) / 2.0), y: 0.0), size: CGSize(width: 57.0, height: panelHeight))
|
||||
|
||||
let panelHeightWithInset = panelHeight + layout.intrinsicInsets.bottom - 49.0
|
||||
let panelHeightWithInset = panelHeight + layout.intrinsicInsets.bottom
|
||||
|
||||
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: panelHeightWithInset)))
|
||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: UIScreenPixel), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
||||
|
@ -690,7 +690,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
|
||||
strongSelf.contextSourceNode.contentNode.frame = CGRect(origin: CGPoint(), size: nodeLayout.contentSize)
|
||||
|
||||
let nonExtractedRect = CGRect(origin: CGPoint(), size: CGSize(width: nodeLayout.contentSize.width - 16.0, height: nodeLayout.contentSize.height))
|
||||
let extractedRect = CGRect(origin: CGPoint(), size: nodeLayout.contentSize).insetBy(dx: 16.0, dy: 0.0)
|
||||
let extractedRect = CGRect(origin: CGPoint(), size: nodeLayout.contentSize).insetBy(dx: 16.0 + params.leftInset, dy: 0.0)
|
||||
strongSelf.extractedRect = extractedRect
|
||||
strongSelf.nonExtractedRect = nonExtractedRect
|
||||
|
||||
|
@ -554,7 +554,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
|
||||
strongSelf.offsetContainerNode.frame = CGRect(origin: CGPoint(), size: nodeLayout.contentSize)
|
||||
|
||||
let nonExtractedRect = CGRect(origin: CGPoint(), size: CGSize(width: nodeLayout.contentSize.width - 16.0, height: nodeLayout.contentSize.height))
|
||||
let extractedRect = CGRect(origin: CGPoint(), size: nodeLayout.contentSize).insetBy(dx: 16.0, dy: 0.0)
|
||||
let extractedRect = CGRect(origin: CGPoint(), size: nodeLayout.contentSize).insetBy(dx: 16.0 + params.leftInset, dy: 0.0)
|
||||
strongSelf.extractedRect = extractedRect
|
||||
strongSelf.nonExtractedRect = nonExtractedRect
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user