mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
no message
This commit is contained in:
parent
d36e7e3a6e
commit
e54bb8c34a
@ -315,12 +315,12 @@ public final class ChatController: TelegramController, UIViewControllerPreviewin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !contextActions.isEmpty {
|
if !contextActions.isEmpty {
|
||||||
contextMenuController = ContextMenuController(actions: contextActions)
|
contextMenuController = ContextMenuController(actions: contextActions, catchTapsOutside: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenuController?.dismissed = {
|
contextMenuController?.dismissed = {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
//strongSelf.chatDisplayNode.displayMessageActionSheet(stableId: nil, displayContextMenuController: nil)
|
strongSelf.chatDisplayNode.displayMessageActionSheet(stableId: nil, sheetActions: nil, displayContextMenuController: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,7 +1339,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.25, curve: .spring)
|
let transition: ContainedViewLayoutTransition = .animated(duration: 0.35, curve: .spring)
|
||||||
var animateIn = false
|
var animateIn = false
|
||||||
|
|
||||||
self.historyNode.updateNodeHighlightsAnimated(animated)
|
self.historyNode.updateNodeHighlightsAnimated(animated)
|
||||||
@ -1352,8 +1352,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
self.messageActionSheetControllerAdditionalInset = nil
|
self.messageActionSheetControllerAdditionalInset = nil
|
||||||
}
|
}
|
||||||
if let stableId = self.controllerInteraction.contextHighlightedState?.messageStableId {
|
if let stableId = self.controllerInteraction.contextHighlightedState?.messageStableId {
|
||||||
let controller = ChatMessageActionSheetController(theme: self.chatPresentationInterfaceState.theme, actions: sheetActions ?? [], dismissed: { [weak self] in
|
let contextMenuController = displayContextMenuController?.0
|
||||||
|
let controller = ChatMessageActionSheetController(theme: self.chatPresentationInterfaceState.theme, actions: sheetActions ?? [], dismissed: { [weak self, weak contextMenuController] in
|
||||||
self?.displayMessageActionSheet(stableId: nil, sheetActions: nil, displayContextMenuController: nil)
|
self?.displayMessageActionSheet(stableId: nil, sheetActions: nil, displayContextMenuController: nil)
|
||||||
|
contextMenuController?.dismiss()
|
||||||
})
|
})
|
||||||
self.messageActionSheetController = (controller, stableId)
|
self.messageActionSheetController = (controller, stableId)
|
||||||
self.controllerInteraction.presentGlobalOverlayController(controller, nil)
|
self.controllerInteraction.presentGlobalOverlayController(controller, nil)
|
||||||
|
@ -27,4 +27,8 @@ final class ChatMessageActionSheetController: ViewController {
|
|||||||
self.displayNode = ChatMessageActionSheetControllerNode(theme: self.theme, actions: self.actions, dismissed: self.dismissed)
|
self.displayNode = ChatMessageActionSheetControllerNode(theme: self.theme, actions: self.actions, dismissed: self.dismissed)
|
||||||
self.displayNodeDidLoad()
|
self.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func dismiss(completion: (() -> Void)? = nil) {
|
||||||
|
self.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
private let actionNodes: [MessageActionButtonNode]
|
private let actionNodes: [MessageActionButtonNode]
|
||||||
|
|
||||||
private let feedback = HapticFeedback()
|
private let feedback = HapticFeedback()
|
||||||
|
private var validLayout: ContainerViewLayout?
|
||||||
|
|
||||||
init(theme: PresentationTheme, actions: [ChatMessageContextMenuSheetAction], dismissed: @escaping () -> Void) {
|
init(theme: PresentationTheme, actions: [ChatMessageContextMenuSheetAction], dismissed: @escaping () -> Void) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
@ -68,7 +69,6 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
|
|
||||||
self.inputDimNode = ASDisplayNode()
|
self.inputDimNode = ASDisplayNode()
|
||||||
self.inputDimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
|
self.inputDimNode.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
|
||||||
self.inputDimNode.isLayerBacked = true
|
|
||||||
|
|
||||||
self.itemsContainerNode = ASDisplayNode()
|
self.itemsContainerNode = ASDisplayNode()
|
||||||
self.itemsContainerNode.backgroundColor = theme.actionSheet.opaqueItemBackgroundColor
|
self.itemsContainerNode.backgroundColor = theme.actionSheet.opaqueItemBackgroundColor
|
||||||
@ -94,6 +94,12 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
self.feedback.prepareImpact()
|
self.feedback.prepareImpact()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func didLoad() {
|
||||||
|
super.didLoad()
|
||||||
|
|
||||||
|
self.inputDimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTap(_:))))
|
||||||
|
}
|
||||||
|
|
||||||
func animateIn(transition: ContainedViewLayoutTransition) {
|
func animateIn(transition: ContainedViewLayoutTransition) {
|
||||||
self.inputDimNode.alpha = 0.0
|
self.inputDimNode.alpha = 0.0
|
||||||
transition.updateAlpha(node: self.inputDimNode, alpha: 1.0)
|
transition.updateAlpha(node: self.inputDimNode, alpha: 1.0)
|
||||||
@ -110,7 +116,9 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateLayout(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) -> CGFloat {
|
func updateLayout(layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) -> CGFloat {
|
||||||
var height: CGFloat = 14.0
|
self.validLayout = layout
|
||||||
|
|
||||||
|
var height: CGFloat = max(14.0, layout.intrinsicInsets.bottom)
|
||||||
|
|
||||||
let inputHeight = layout.inputHeight ?? 0.0
|
let inputHeight = layout.inputHeight ?? 0.0
|
||||||
transition.updateFrame(node: self.inputDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - inputHeight), size: CGSize(width: layout.size.width, height: inputHeight)))
|
transition.updateFrame(node: self.inputDimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - inputHeight), size: CGSize(width: layout.size.width, height: inputHeight)))
|
||||||
@ -138,6 +146,11 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
let subpoint = self.view.convert(point, to: self.itemsContainerNode.view)
|
let subpoint = self.view.convert(point, to: self.itemsContainerNode.view)
|
||||||
return itemsContainerNode.hitTest(subpoint, with: event)
|
return itemsContainerNode.hitTest(subpoint, with: event)
|
||||||
}
|
}
|
||||||
|
if let validLayout = self.validLayout, let inputHeight = validLayout.inputHeight {
|
||||||
|
if point.y >= validLayout.size.height - inputHeight {
|
||||||
|
return self.inputDimNode.view
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,4 +163,10 @@ final class ChatMessageActionSheetControllerNode: ViewControllerTracingNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func dimTap(_ recognizer: UITapGestureRecognizer) {
|
||||||
|
if case .ended = recognizer.state {
|
||||||
|
self.dismissed()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user