diff --git a/submodules/Display/Source/ActionSheetControllerNode.swift b/submodules/Display/Source/ActionSheetControllerNode.swift index 403290a334..b53bb2ba1f 100644 --- a/submodules/Display/Source/ActionSheetControllerNode.swift +++ b/submodules/Display/Source/ActionSheetControllerNode.swift @@ -1,5 +1,6 @@ import UIKit import AsyncDisplayKit +import SwiftSignalKit private let containerInsets = UIEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0) @@ -59,6 +60,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate { self.bottomDimView.isUserInteractionEnabled = false self.itemGroupsContainerNode = ActionSheetItemGroupsContainerNode(theme: self.theme) + self.itemGroupsContainerNode.isUserInteractionEnabled = false super.init() @@ -128,6 +130,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate { self.updateScrollDimViews(size: layout.size, insets: insets, transition: transition) } + func animateIn(completion: @escaping () -> Void) { let tempDimView = UIView() tempDimView.backgroundColor = self.theme.dimColor @@ -144,6 +147,10 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate { tempDimView?.removeFromSuperview() completion() }) + + Queue.mainQueue().after(0.3, { + self.itemGroupsContainerNode.isUserInteractionEnabled = true + }) } func animateOut(cancelled: Bool) { @@ -170,7 +177,7 @@ final class ActionSheetControllerNode: ASDisplayNode, UIScrollViewDelegate { } @objc func dimNodeTap(_ recognizer: UITapGestureRecognizer) { - if case .ended = recognizer.state { + if case .ended = recognizer.state, self.itemGroupsContainerNode.isUserInteractionEnabled { self.view.window?.endEditing(true) self.animateOut(cancelled: true) } diff --git a/submodules/Display/Source/ActionSheetItemGroupsContainerNode.swift b/submodules/Display/Source/ActionSheetItemGroupsContainerNode.swift index 35746efc72..966abcc311 100644 --- a/submodules/Display/Source/ActionSheetItemGroupsContainerNode.swift +++ b/submodules/Display/Source/ActionSheetItemGroupsContainerNode.swift @@ -84,6 +84,9 @@ final class ActionSheetItemGroupsContainerNode: ASDisplayNode { } override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + guard self.isUserInteractionEnabled else { + return nil + } for groupNode in self.groupNodes { if groupNode.frame.contains(point) { return groupNode.hitTest(self.convert(point, to: groupNode), with: event)