mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
ca8f59565b
commit
ce5053c6ff
10 changed files with 54 additions and 39 deletions
|
|
@ -414,6 +414,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||
}
|
||||
|
||||
self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: placeholder, compactPlaceholder: compactPlaceholder, activate: { [weak self] in
|
||||
self?.chatListDisplayNode.mainContainerNode.currentItemNode.cancelTracking()
|
||||
self?.activateSearch(filter: isForum ? .topics : .chats)
|
||||
})
|
||||
self.searchContentNode?.updateExpansionProgress(0.0)
|
||||
|
|
|
|||
|
|
@ -235,30 +235,30 @@ class ChatListFilterPresetCategoryItemNode: ItemListRevealOptionsItemNode, ItemL
|
|||
switch item.icon {
|
||||
case .contacts:
|
||||
color = .blue
|
||||
imageName = "Chat/Context Menu/User"
|
||||
imageName = "Chat List/Filters/Contact"
|
||||
case .nonContacts:
|
||||
color = .yellow
|
||||
imageName = "Chat/Context Menu/UnknownUser"
|
||||
imageName = "Chat List/Filters/User"
|
||||
case .groups:
|
||||
color = .green
|
||||
imageName = "Chat/Context Menu/Groups"
|
||||
imageName = "Chat List/Filters/Group"
|
||||
case .channels:
|
||||
color = .red
|
||||
imageName = "Chat/Context Menu/Channels"
|
||||
imageName = "Chat List/Filters/Channel"
|
||||
case .bots:
|
||||
color = .violet
|
||||
imageName = "Chat/Context Menu/Bots"
|
||||
imageName = "Chat List/Filters/Bot"
|
||||
case .muted:
|
||||
color = .red
|
||||
imageName = "Chat/Context Menu/Muted"
|
||||
imageName = "Chat List/Filters/Muted"
|
||||
case .read:
|
||||
color = .blue
|
||||
imageName = "Chat/Context Menu/Message"
|
||||
imageName = "Chat List/Filters/Read"
|
||||
case .archived:
|
||||
color = .yellow
|
||||
imageName = "Chat/Context Menu/Archive"
|
||||
imageName = "Chat List/Filters/Archive"
|
||||
}
|
||||
updatedAvatarImage = generateAvatarImage(size: CGSize(width: avatarSize, height: avatarSize), icon: generateTintedImage(image: UIImage(bundleImageName: imageName), color: .white), color: color)
|
||||
updatedAvatarImage = generateAvatarImage(size: CGSize(width: avatarSize, height: avatarSize), icon: generateTintedImage(image: UIImage(bundleImageName: imageName), color: .white), cornerRadius: 12.0, color: color)
|
||||
}
|
||||
|
||||
let revealOffset = strongSelf.revealOffset
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ private final class ItemNode: ASDisplayNode {
|
|||
self.containerNode.addSubnode(self.extractedContainerNode)
|
||||
self.containerNode.targetNodeForActivationProgress = self.extractedContainerNode.contentNode
|
||||
self.addSubnode(self.containerNode)
|
||||
|
||||
|
||||
self.buttonNode.isExclusiveTouch = true
|
||||
self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside)
|
||||
|
||||
self.containerNode.activated = { [weak self] gesture, _ in
|
||||
|
|
@ -185,7 +186,7 @@ private final class ItemNode: ASDisplayNode {
|
|||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
|
||||
self.pointerInteraction = PointerInteraction(view: self.containerNode.view, customInteractionView: nil, style: .insetRectangle(-10.0, 4.0))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
let reaction: MessageReaction.Reaction?
|
||||
private let requestUpdate: (ReactionsTabNode, ContainedViewLayoutTransition) -> Void
|
||||
private let requestUpdateApparentHeight: (ReactionsTabNode, ContainedViewLayoutTransition) -> Void
|
||||
private let openPeer: (EnginePeer) -> Void
|
||||
private let openPeer: (EnginePeer, Bool) -> Void
|
||||
|
||||
private var hasMore: Bool = false
|
||||
|
||||
|
|
@ -773,7 +773,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
readStats: MessageReadStats?,
|
||||
requestUpdate: @escaping (ReactionsTabNode, ContainedViewLayoutTransition) -> Void,
|
||||
requestUpdateApparentHeight: @escaping (ReactionsTabNode, ContainedViewLayoutTransition) -> Void,
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
openPeer: @escaping (EnginePeer, Bool) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
|
|
@ -888,7 +888,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
let openPeer = self.openPeer
|
||||
let peer = item.peer
|
||||
itemNode = ItemNode(context: self.context, displayReadTimestamps: self.displayReadTimestamps, availableReactions: self.availableReactions, animationCache: self.animationCache, animationRenderer: self.animationRenderer, action: {
|
||||
openPeer(peer)
|
||||
openPeer(peer, item.reaction != nil)
|
||||
})
|
||||
self.itemNodes[index] = itemNode
|
||||
self.scrollNode.addSubnode(itemNode)
|
||||
|
|
@ -1060,7 +1060,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
}
|
||||
private var interactiveTransitionState: InteractiveTransitionState?
|
||||
|
||||
private let openPeer: (EnginePeer) -> Void
|
||||
private let openPeer: (EnginePeer, Bool) -> Void
|
||||
|
||||
private(set) var apparentHeight: CGFloat = 0.0
|
||||
|
||||
|
|
@ -1076,7 +1076,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
requestUpdate: @escaping (ContainedViewLayoutTransition) -> Void,
|
||||
requestUpdateApparentHeight: @escaping (ContainedViewLayoutTransition) -> Void,
|
||||
back: (() -> Void)?,
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
openPeer: @escaping (EnginePeer, Bool) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
|
|
@ -1426,7 +1426,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
let reaction: MessageReaction.Reaction?
|
||||
let readStats: MessageReadStats?
|
||||
let back: (() -> Void)?
|
||||
let openPeer: (EnginePeer) -> Void
|
||||
let openPeer: (EnginePeer, Bool) -> Void
|
||||
|
||||
public init(
|
||||
context: AccountContext,
|
||||
|
|
@ -1438,7 +1438,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent
|
|||
reaction: MessageReaction.Reaction?,
|
||||
readStats: MessageReadStats?,
|
||||
back: (() -> Void)?,
|
||||
openPeer: @escaping (EnginePeer) -> Void
|
||||
openPeer: @escaping (EnginePeer, Bool) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.displayReadTimestamps = displayReadTimestamps
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ public class ContactsController: ViewController {
|
|||
}
|
||||
|
||||
self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search, activate: { [weak self] in
|
||||
self?.contactsNode.contactListNode.listNode.cancelTracking()
|
||||
self?.activateSearch()
|
||||
})
|
||||
self.navigationBar?.setContentNode(self.searchContentNode, animated: false)
|
||||
|
|
|
|||
|
|
@ -1362,6 +1362,11 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
|
|||
self.ignoreScrollingEvents = wasIgnoringScrollingEvents
|
||||
}
|
||||
|
||||
public func cancelTracking() {
|
||||
self.scroller.panGestureRecognizer.isEnabled = false
|
||||
self.scroller.panGestureRecognizer.isEnabled = true
|
||||
}
|
||||
|
||||
private func updateTopItemOverscrollBackground(transition: ContainedViewLayoutTransition) {
|
||||
if let value = self.keepTopItemOverscrollBackground {
|
||||
var applyTransition = transition
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi
|
|||
}
|
||||
}
|
||||
|
||||
private weak var tooltipController: TooltipScreen?
|
||||
private let dismissedPromise = ValuePromise<Bool>(false)
|
||||
|
||||
public init(context: AccountContext, presentationData: PresentationData) {
|
||||
|
|
@ -424,6 +425,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi
|
|||
return
|
||||
}
|
||||
|
||||
self.tooltipController?.dismiss()
|
||||
self.dismissedPromise.set(true)
|
||||
|
||||
transition.updatePosition(node: self.separatorNode, position: self.separatorNode.position.offsetBy(dx: 0.0, dy: size.height))
|
||||
|
|
@ -434,7 +436,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi
|
|||
|
||||
let minHeight = MediaNavigationAccessoryHeaderNode.minimizedHeight
|
||||
|
||||
let inset: CGFloat = 40.0 + leftInset
|
||||
let inset: CGFloat = 45.0 + leftInset
|
||||
let constrainedSize = CGSize(width: size.width - inset * 2.0, height: size.height)
|
||||
let (titleString, subtitleString, rateButtonHidden) = self.currentItemNode.updateLayout(size: constrainedSize, leftInset: leftInset, rightInset: rightInset, theme: self.theme, strings: self.strings, dateTimeFormat: self.dateTimeFormat, nameDisplayOrder: self.nameDisplayOrder, playbackItem: self.playbackItems?.0, transition: transition)
|
||||
self.accessibilityAreaNode.accessibilityLabel = "\(titleString?.string ?? ""). \(subtitleString?.string ?? "")"
|
||||
|
|
@ -474,7 +476,7 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi
|
|||
let closeButtonSize = self.closeButton.measure(CGSize(width: 100.0, height: 100.0))
|
||||
transition.updateFrame(node: self.closeButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 44.0 - rightInset, y: 0.0), size: CGSize(width: 44.0, height: minHeight)))
|
||||
let rateButtonSize = CGSize(width: 30.0, height: minHeight)
|
||||
transition.updateFrame(node: self.rateButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 33.0 - closeButtonSize.width - rateButtonSize.width - rightInset, y: -4.0), size: rateButtonSize))
|
||||
transition.updateFrame(node: self.rateButton, frame: CGRect(origin: CGPoint(x: bounds.size.width - 27.0 - closeButtonSize.width - rateButtonSize.width - rightInset, y: -4.0), size: rateButtonSize))
|
||||
|
||||
transition.updateFrame(node: self.playPauseIconNode, frame: CGRect(origin: CGPoint(x: 6.0, y: 4.0 + UIScreenPixel), size: CGSize(width: 28.0, height: 28.0)))
|
||||
transition.updateFrame(node: self.actionButton, frame: CGRect(origin: CGPoint(x: leftInset, y: 0.0), size: CGSize(width: 40.0, height: 37.0)))
|
||||
|
|
@ -524,9 +526,11 @@ public final class MediaNavigationAccessoryHeaderNode: ASDisplayNode, UIScrollVi
|
|||
let _ = (ApplicationSpecificNotice.incrementAudioRateOptionsTip(accountManager: self.context.sharedContext.accountManager)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] value in
|
||||
if let strongSelf = self, let controller = strongSelf.getController?(), value == 2 {
|
||||
controller.present(TooltipScreen(account: strongSelf.context.account, text: strongSelf.strings.Conversation_AudioRateOptionsTooltip, style: .default, icon: nil, location: .point(frame.offsetBy(dx: 0.0, dy: 4.0), .bottom), displayDuration: .custom(3.0), inset: 3.0, shouldDismissOnTouch: { _ in
|
||||
let tooltipController = TooltipScreen(account: strongSelf.context.account, text: strongSelf.strings.Conversation_AudioRateOptionsTooltip, style: .default, icon: nil, location: .point(frame.offsetBy(dx: 0.0, dy: 4.0), .bottom), displayDuration: .custom(3.0), inset: 3.0, shouldDismissOnTouch: { _ in
|
||||
return .dismiss(consume: false)
|
||||
}), in: .window(.root))
|
||||
})
|
||||
controller.present(tooltipController, in: .window(.root))
|
||||
strongSelf.tooltipController = tooltipController
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||
|
||||
private var dismissingPanel: ASDisplayNode?
|
||||
|
||||
private weak var audioRateTooltipController: UndoOverlayController?
|
||||
|
||||
private var presentationData: PresentationData
|
||||
private var presentationDataDisposable: Disposable?
|
||||
private var playlistPreloadDisposable: Disposable?
|
||||
|
|
@ -648,6 +650,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||
if let (mediaAccessoryPanel, _) = self.mediaAccessoryPanel {
|
||||
self.mediaAccessoryPanel = nil
|
||||
self.dismissingPanel = mediaAccessoryPanel
|
||||
self.audioRateTooltipController?.dismissWithCommitAction()
|
||||
mediaAccessoryPanel.animateOut(transition: transition, completion: { [weak self, weak mediaAccessoryPanel] in
|
||||
mediaAccessoryPanel?.removeFromSupernode()
|
||||
if let strongSelf = self, strongSelf.dismissingPanel === mediaAccessoryPanel {
|
||||
|
|
@ -731,21 +734,20 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||
showTooltip = false
|
||||
}
|
||||
if let rate, let text, showTooltip {
|
||||
strongSelf.present(
|
||||
UndoOverlayController(
|
||||
presentationData: presentationData,
|
||||
content: .audioRate(
|
||||
rate: rate,
|
||||
text: text
|
||||
),
|
||||
elevatedLayout: false,
|
||||
animateInAsReplacement: hasTooltip,
|
||||
action: { action in
|
||||
return true
|
||||
}
|
||||
let controller = UndoOverlayController(
|
||||
presentationData: presentationData,
|
||||
content: .audioRate(
|
||||
rate: rate,
|
||||
text: text
|
||||
),
|
||||
in: .current
|
||||
elevatedLayout: false,
|
||||
animateInAsReplacement: hasTooltip,
|
||||
action: { action in
|
||||
return true
|
||||
}
|
||||
)
|
||||
strongSelf.audioRateTooltipController = controller
|
||||
strongSelf.present(controller, in: .current)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -867,6 +869,7 @@ open class TelegramBaseController: ViewController, KeyShortcutResponder {
|
|||
} else if let (mediaAccessoryPanel, _) = self.mediaAccessoryPanel {
|
||||
self.mediaAccessoryPanel = nil
|
||||
self.dismissingPanel = mediaAccessoryPanel
|
||||
self.audioRateTooltipController?.dismissWithCommitAction()
|
||||
mediaAccessoryPanel.animateOut(transition: transition, completion: { [weak self, weak mediaAccessoryPanel] in
|
||||
mediaAccessoryPanel?.removeFromSupernode()
|
||||
if let strongSelf = self, strongSelf.dismissingPanel === mediaAccessoryPanel {
|
||||
|
|
|
|||
|
|
@ -1511,13 +1511,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||
availableReactions: availableReactions,
|
||||
animationCache: strongSelf.controllerInteraction!.presentationContext.animationCache,
|
||||
animationRenderer: strongSelf.controllerInteraction!.presentationContext.animationRenderer,
|
||||
message: EngineMessage(message), reaction: value, readStats: nil, back: nil, openPeer: { peer in
|
||||
message: EngineMessage(message), reaction: value, readStats: nil, back: nil, openPeer: { peer, hasReaction in
|
||||
dismissController?({
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.openPeer(peer: peer, navigation: .default, fromMessage: MessageReference(message), fromReactionMessageId: message.id)
|
||||
strongSelf.openPeer(peer: peer, navigation: .default, fromMessage: MessageReference(message), fromReactionMessageId: hasReaction ? message.id : nil)
|
||||
})
|
||||
})))
|
||||
|
||||
|
|
|
|||
|
|
@ -1800,9 +1800,9 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
|||
back: { [weak c] in
|
||||
c?.popItems()
|
||||
},
|
||||
openPeer: { [weak c] peer in
|
||||
openPeer: { [weak c] peer, hasReaction in
|
||||
c?.dismiss(completion: {
|
||||
controllerInteraction.openPeer(peer, .default, MessageReference(message), .reaction)
|
||||
controllerInteraction.openPeer(peer, .default, MessageReference(message), hasReaction ? .reaction : .default)
|
||||
})
|
||||
}
|
||||
)), tip: tip)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue