Merge branch 'master' of github.com:peter-iakovlev/Display

This commit is contained in:
overtake 2018-09-04 22:38:23 +01:00
commit 1d592e9348
6 changed files with 185 additions and 6 deletions

View File

@ -48,6 +48,7 @@
D02383861DE0E3B4004018B6 /* ListViewIntermediateState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02383851DE0E3B4004018B6 /* ListViewIntermediateState.swift */; };
D02958001D6F096000360E5E /* ContextMenuContainerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02957FF1D6F096000360E5E /* ContextMenuContainerNode.swift */; };
D02BDB021B6AC703008AFAD2 /* RuntimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D02BDB011B6AC703008AFAD2 /* RuntimeUtils.swift */; };
D03310B3213F232600FC83CD /* ListViewTapGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03310B2213F232600FC83CD /* ListViewTapGestureRecognizer.swift */; };
D036574B1E71C44D00BB1EE4 /* MinimizeKeyboardGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D036574A1E71C44D00BB1EE4 /* MinimizeKeyboardGestureRecognizer.swift */; };
D03725C11D6DF594007FC290 /* ContextMenuNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03725C01D6DF594007FC290 /* ContextMenuNode.swift */; };
D03725C31D6DF7A6007FC290 /* ContextMenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03725C21D6DF7A6007FC290 /* ContextMenuAction.swift */; };
@ -220,6 +221,7 @@
D02383851DE0E3B4004018B6 /* ListViewIntermediateState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListViewIntermediateState.swift; sourceTree = "<group>"; };
D02957FF1D6F096000360E5E /* ContextMenuContainerNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextMenuContainerNode.swift; sourceTree = "<group>"; };
D02BDB011B6AC703008AFAD2 /* RuntimeUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RuntimeUtils.swift; sourceTree = "<group>"; };
D03310B2213F232600FC83CD /* ListViewTapGestureRecognizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListViewTapGestureRecognizer.swift; sourceTree = "<group>"; };
D036574A1E71C44D00BB1EE4 /* MinimizeKeyboardGestureRecognizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MinimizeKeyboardGestureRecognizer.swift; sourceTree = "<group>"; };
D03725C01D6DF594007FC290 /* ContextMenuNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextMenuNode.swift; sourceTree = "<group>"; };
D03725C21D6DF7A6007FC290 /* ContextMenuAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextMenuAction.swift; sourceTree = "<group>"; };
@ -736,6 +738,7 @@
D03AA4E8202E02070056C405 /* ListViewReorderingItemNode.swift */,
D03AA4EA202E02B10056C405 /* ListViewReorderingGestureRecognizer.swift */,
D03AA5152030C5F80056C405 /* ListViewTempItemNode.swift */,
D03310B2213F232600FC83CD /* ListViewTapGestureRecognizer.swift */,
);
name = "List Node";
sourceTree = "<group>";
@ -978,6 +981,7 @@
D0E49C881B83A3580099E553 /* ImageCache.swift in Sources */,
D0078A681C92B21400DF6D92 /* StatusBar.swift in Sources */,
D05CC2F81B6955D000E235A3 /* UIViewController+Navigation.m in Sources */,
D03310B3213F232600FC83CD /* ListViewTapGestureRecognizer.swift in Sources */,
D0F1132F1D6F3C20008C3597 /* ContextMenuActionNode.swift in Sources */,
D053DAD12018ECF900993D32 /* WindowCoveringView.swift in Sources */,
D02BDB021B6AC703008AFAD2 /* RuntimeUtils.swift in Sources */,
@ -1991,6 +1995,144 @@
};
name = "Debug AppStore LLC";
};
D0CE6EE1213DB54B00BCD44B /* Release AppStore LLC */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "-DMINIMAL_ASDK=1";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = "Release AppStore LLC";
};
D0CE6EE2213DB54B00BCD44B /* Release AppStore LLC */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Display/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Display;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_REFLECTION_METADATA_LEVEL = none;
SWIFT_VERSION = 4.0;
};
name = "Release AppStore LLC";
};
D0CE6EE3213DB54B00BCD44B /* Release AppStore LLC */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = DisplayTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.DisplayTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = "Release AppStore LLC";
};
D0CE6EE4213DB54B00BCD44B /* Release AppStore LLC */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = X834Q8SBVP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = A;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = DisplayMac/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.Telegram.DisplayMac;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = "Release AppStore LLC";
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -2003,6 +2145,7 @@
D01159BE1F40E96C0039383E /* Release Hockeyapp */,
D0924FD71FE52BE9003F693F /* Release Hockeyapp Internal */,
D01159BF1F40E96C0039383E /* Release AppStore */,
D0CE6EE4213DB54B00BCD44B /* Release AppStore LLC */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Release Hockeyapp";
@ -2016,6 +2159,7 @@
D05CC2761B69316F00E235A3 /* Release Hockeyapp */,
D0924FD41FE52BE9003F693F /* Release Hockeyapp Internal */,
D086A56E1CC0115D00F08284 /* Release AppStore */,
D0CE6EE1213DB54B00BCD44B /* Release AppStore LLC */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Release Hockeyapp";
@ -2029,6 +2173,7 @@
D05CC2791B69316F00E235A3 /* Release Hockeyapp */,
D0924FD51FE52BE9003F693F /* Release Hockeyapp Internal */,
D086A56F1CC0115D00F08284 /* Release AppStore */,
D0CE6EE2213DB54B00BCD44B /* Release AppStore LLC */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Release Hockeyapp";
@ -2042,6 +2187,7 @@
D05CC27C1B69316F00E235A3 /* Release Hockeyapp */,
D0924FD61FE52BE9003F693F /* Release Hockeyapp Internal */,
D086A5701CC0115D00F08284 /* Release AppStore */,
D0CE6EE3213DB54B00BCD44B /* Release AppStore LLC */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = "Release Hockeyapp";

View File

@ -61,10 +61,13 @@ final class ListViewBackingView: UIView {
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if let target = self.target, target.limitHitTestToNodes {
if !target.internalHitTest(point, with: event) {
if let target = self.target {
if target.limitHitTestToNodes, !target.internalHitTest(point, with: event) {
return nil
}
if let result = target.headerHitTest(point, with: event) {
return result
}
}
return super.hitTest(point, with: event)
}
@ -3380,6 +3383,16 @@ open class ListView: ASDisplayNode, UIScrollViewDelegate, UIGestureRecognizerDel
return true
}
fileprivate func headerHitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
for (_, headerNode) in self.itemHeaderNodes {
let headerNodeFrame = headerNode.frame
if headerNodeFrame.contains(point) {
return headerNode.hitTest(point.offsetBy(dx: -headerNodeFrame.minX, dy: -headerNodeFrame.minY), with: event)
}
}
return nil
}
private func reorderItemNodeToFront(_ itemNode: ListViewItemNode) {
itemNode.view.superview?.bringSubview(toFront: itemNode.view)
if let itemHighlightOverlayBackground = self.itemHighlightOverlayBackground {

View File

@ -20,6 +20,9 @@ class ListViewScroller: UIScrollView, UIGestureRecognizerDelegate {
}
@objc func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if otherGestureRecognizer is ListViewTapGestureRecognizer {
return true
}
return false
}

View File

@ -0,0 +1,6 @@
import Foundation
import UIKit
public final class ListViewTapGestureRecognizer: UITapGestureRecognizer {
}

View File

@ -45,12 +45,22 @@ final class PresentationContext {
public func present(_ controller: ViewController, on: PresentationSurfaceLevel) {
let controllerReady = controller.ready.get()
|> filter({ $0 })
|> take(1)
|> deliverOnMainQueue
|> timeout(2.0, queue: Queue.mainQueue(), alternate: .single(true))
|> filter({ $0 })
|> take(1)
|> deliverOnMainQueue
|> timeout(2.0, queue: Queue.mainQueue(), alternate: .single(true))
if let _ = self.view, let initialLayout = self.layout {
if controller.lockOrientation {
let orientations: UIInterfaceOrientationMask
if initialLayout.size.width < initialLayout.size.height {
orientations = .portrait
} else {
orientations = .landscape
}
controller.supportedOrientations = ViewControllerSupportedOrientations(regularSize: orientations, compactSize: orientations)
}
controller.view.frame = CGRect(origin: CGPoint(), size: initialLayout.size)
controller.containerLayoutUpdated(initialLayout, transition: .immediate)

View File

@ -52,6 +52,7 @@ open class ViewControllerPresentationArguments {
private let presentationContext: PresentationContext
public final var supportedOrientations: ViewControllerSupportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .allButUpsideDown)
public final var lockOrientation: Bool = false
public func combinedSupportedOrientations() -> ViewControllerSupportedOrientations {
return self.supportedOrientations