From 796869c857a0a184fcb5c6d4dc2d36214be45373 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sun, 6 Nov 2022 17:51:30 -0500 Subject: [PATCH 1/2] Remove unused parts of PTFakeTouch --- PlayTools.xcodeproj/project.pbxproj | 88 +---- PlayTools/Controls/ControlMode.swift | 2 - .../Controls/PTFakeTouch/NSBundle+Swizzle.h | 16 - .../Controls/PTFakeTouch/NSBundle+Swizzle.m | 28 -- .../Controls/PTFakeTouch/PTFakeMetaTouch.h | 5 - .../addition/CALayer-KIFAdditions.h | 31 -- .../addition/CALayer-KIFAdditions.m | 52 --- .../addition/CGGeometry-KIFAdditions.h | 4 - .../addition/NSBundle-KIFAdditions.h | 15 - .../addition/NSException-KIFAdditions.h | 15 - .../addition/NSException-KIFAdditions.m | 28 -- .../addition/NSFileManager-KIFAdditions.h | 18 - .../addition/NSFileManager-KIFAdditions.m | 67 ---- .../UIAccessibilityElement-KIFAdditions.h | 75 ---- .../UIAccessibilityElement-KIFAdditions.m | 263 -------------- .../addition/UIApplication-KIFAdditions.h | 16 - .../addition/UIApplication-KIFAdditions.m | 28 -- .../addition/UIScrollView-KIFAdditions.h | 17 - .../addition/UIScrollView-KIFAdditions.m | 44 --- .../addition/UITableView-KIFAdditions.h | 16 - .../addition/UITableView-KIFAdditions.m | 83 ----- .../PTFakeTouch/addition/UIView-Debugging.h | 22 -- .../PTFakeTouch/addition/UIView-Debugging.m | 207 ----------- .../addition/UIView-KIFAdditions.h | 39 -- .../addition/UIView-KIFAdditions.m | 337 +----------------- PlayTools/PlayLoader.m | 47 --- 26 files changed, 11 insertions(+), 1552 deletions(-) delete mode 100644 PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.h delete mode 100644 PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSBundle-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.m diff --git a/PlayTools.xcodeproj/project.pbxproj b/PlayTools.xcodeproj/project.pbxproj index f5a5f5dc..bd7ecaf2 100644 --- a/PlayTools.xcodeproj/project.pbxproj +++ b/PlayTools.xcodeproj/project.pbxproj @@ -32,49 +32,32 @@ AA7197AD287A481500623C15 /* EditorController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979C287A481500623C15 /* EditorController.swift */; }; AA7197AE287A481500623C15 /* DragElementsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979D287A481500623C15 /* DragElementsView.swift */; }; AA7197AF287A481500623C15 /* KeyCodeNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979E287A481500623C15 /* KeyCodeNames.swift */; }; - AA719845287A81A000623C15 /* NSBundle+Swizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719816287A819F00623C15 /* NSBundle+Swizzle.m */; }; AA719846287A81A000623C15 /* IOHIDEvent+KIF.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */; }; - AA719847287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */; }; AA719848287A81A000623C15 /* UIScreen+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */; }; - AA719849287A81A000623C15 /* NSException-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */; }; AA71984A287A81A000623C15 /* NSString+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */; }; AA71984B287A81A000623C15 /* UIApplication-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */; }; AA71984C287A81A000623C15 /* CGGeometry-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */; }; AA71984D287A81A000623C15 /* UIWindow-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */; }; - AA71984E287A81A000623C15 /* UIScrollView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */; }; - AA71984F287A81A000623C15 /* UIView-Debugging.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719821287A819F00623C15 /* UIView-Debugging.m */; }; AA719850287A81A000623C15 /* UITouch-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */; }; - AA719851287A81A000623C15 /* UITableView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */; }; - AA719852287A81A000623C15 /* NSFileManager-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */; }; AA719853287A81A000623C15 /* UIView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719825287A819F00623C15 /* UIView-KIFAdditions.h */; }; AA719854287A81A000623C15 /* UIEvent+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */; }; - AA719855287A81A000623C15 /* CALayer-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */; }; AA719856287A81A000623C15 /* NSPredicate+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */; }; - AA719857287A81A000623C15 /* UIScrollView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */; }; AA719858287A81A000623C15 /* UIWindow-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */; }; AA719859287A81A000623C15 /* CGGeometry-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */; }; AA71985A287A81A000623C15 /* UIApplication-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */; }; AA71985B287A81A000623C15 /* NSString+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */; }; - AA71985C287A81A000623C15 /* NSException-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */; }; AA71985D287A81A000623C15 /* UIScreen+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */; }; - AA71985E287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */; }; AA71985F287A81A000623C15 /* IOHIDEvent+KIF.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */; }; AA719860287A81A000623C15 /* UIView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719832287A819F00623C15 /* UIView-KIFAdditions.m */; }; - AA719861287A81A000623C15 /* NSFileManager-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */; }; AA719862287A81A000623C15 /* UITouch-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */; }; - AA719863287A81A000623C15 /* UITableView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */; }; - AA719864287A81A000623C15 /* UIView-Debugging.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719836287A819F00623C15 /* UIView-Debugging.h */; }; AA719865287A81A000623C15 /* UIEvent+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */; }; AA719866287A81A000623C15 /* LoadableCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719838287A819F00623C15 /* LoadableCategory.h */; }; AA719867287A81A000623C15 /* NSPredicate+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */; }; - AA719868287A81A000623C15 /* NSBundle-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */; }; - AA719869287A81A000623C15 /* CALayer-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */; }; AA71986A287A81A000623C15 /* PTFakeMetaTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983C287A81A000623C15 /* PTFakeMetaTouch.m */; }; AA71986B287A81A000623C15 /* UIApplication+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983D287A81A000623C15 /* UIApplication+Private.h */; }; AA71986C287A81A000623C15 /* NSObject+Swizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983E287A81A000623C15 /* NSObject+Swizzle.m */; }; AA71986D287A81A000623C15 /* PTFakeMetaTouch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */; }; AA71986E287A81A000623C15 /* NSObject+Swizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719840287A81A000623C15 /* NSObject+Swizzle.h */; }; - AA71986F287A81A000623C15 /* NSBundle+Swizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719841287A81A000623C15 /* NSBundle+Swizzle.h */; }; AA719870287A81A000623C15 /* UIEvent+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719842287A81A000623C15 /* UIEvent+Private.h */; }; AA719871287A81A000623C15 /* FixCategoryBug.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719843287A81A000623C15 /* FixCategoryBug.h */; }; AA719872287A81A000623C15 /* UITouch+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719844287A81A000623C15 /* UITouch+Private.h */; }; @@ -112,49 +95,32 @@ AA71979C287A481500623C15 /* EditorController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorController.swift; sourceTree = ""; }; AA71979D287A481500623C15 /* DragElementsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragElementsView.swift; sourceTree = ""; }; AA71979E287A481500623C15 /* KeyCodeNames.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyCodeNames.swift; sourceTree = ""; }; - AA719816287A819F00623C15 /* NSBundle+Swizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+Swizzle.m"; sourceTree = ""; }; AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IOHIDEvent+KIF.h"; sourceTree = ""; }; - AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAccessibilityElement-KIFAdditions.m"; sourceTree = ""; }; AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScreen+KIFAdditions.m"; sourceTree = ""; }; - AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSException-KIFAdditions.m"; sourceTree = ""; }; AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+KIFAdditions.m"; sourceTree = ""; }; AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication-KIFAdditions.h"; sourceTree = ""; }; AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CGGeometry-KIFAdditions.m"; sourceTree = ""; }; AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWindow-KIFAdditions.m"; sourceTree = ""; }; - AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView-KIFAdditions.m"; sourceTree = ""; }; - AA719821287A819F00623C15 /* UIView-Debugging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView-Debugging.m"; sourceTree = ""; }; AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITouch-KIFAdditions.m"; sourceTree = ""; }; - AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView-KIFAdditions.h"; sourceTree = ""; }; - AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFileManager-KIFAdditions.h"; sourceTree = ""; }; AA719825287A819F00623C15 /* UIView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView-KIFAdditions.h"; sourceTree = ""; }; AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEvent+KIFAdditions.h"; sourceTree = ""; }; - AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer-KIFAdditions.h"; sourceTree = ""; }; AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+KIFAdditions.h"; sourceTree = ""; }; - AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView-KIFAdditions.h"; sourceTree = ""; }; AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow-KIFAdditions.h"; sourceTree = ""; }; AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CGGeometry-KIFAdditions.h"; sourceTree = ""; }; AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication-KIFAdditions.m"; sourceTree = ""; }; AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+KIFAdditions.h"; sourceTree = ""; }; - AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSException-KIFAdditions.h"; sourceTree = ""; }; AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreen+KIFAdditions.h"; sourceTree = ""; }; - AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAccessibilityElement-KIFAdditions.h"; sourceTree = ""; }; AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "IOHIDEvent+KIF.m"; sourceTree = ""; }; AA719832287A819F00623C15 /* UIView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView-KIFAdditions.m"; sourceTree = ""; }; - AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileManager-KIFAdditions.m"; sourceTree = ""; }; AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch-KIFAdditions.h"; sourceTree = ""; }; - AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView-KIFAdditions.m"; sourceTree = ""; }; - AA719836287A819F00623C15 /* UIView-Debugging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView-Debugging.h"; sourceTree = ""; }; AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIEvent+KIFAdditions.m"; sourceTree = ""; }; AA719838287A819F00623C15 /* LoadableCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableCategory.h; sourceTree = ""; }; AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPredicate+KIFAdditions.m"; sourceTree = ""; }; - AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle-KIFAdditions.h"; sourceTree = ""; }; - AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer-KIFAdditions.m"; sourceTree = ""; }; AA71983C287A81A000623C15 /* PTFakeMetaTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTFakeMetaTouch.m; sourceTree = ""; }; AA71983D287A81A000623C15 /* UIApplication+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+Private.h"; sourceTree = ""; }; AA71983E287A81A000623C15 /* NSObject+Swizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Swizzle.m"; sourceTree = ""; }; AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTFakeMetaTouch.h; sourceTree = ""; }; AA719840287A81A000623C15 /* NSObject+Swizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Swizzle.h"; sourceTree = ""; }; - AA719841287A81A000623C15 /* NSBundle+Swizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+Swizzle.h"; sourceTree = ""; }; AA719842287A81A000623C15 /* UIEvent+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEvent+Private.h"; sourceTree = ""; }; AA719843287A81A000623C15 /* FixCategoryBug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixCategoryBug.h; sourceTree = ""; }; AA719844287A81A000623C15 /* UITouch+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch+Private.h"; sourceTree = ""; }; @@ -273,8 +239,6 @@ children = ( AA719817287A819F00623C15 /* addition */, AA719843287A81A000623C15 /* FixCategoryBug.h */, - AA719841287A81A000623C15 /* NSBundle+Swizzle.h */, - AA719816287A819F00623C15 /* NSBundle+Swizzle.m */, AA719840287A81A000623C15 /* NSObject+Swizzle.h */, AA71983E287A81A000623C15 /* NSObject+Swizzle.m */, AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */, @@ -290,41 +254,26 @@ isa = PBXGroup; children = ( AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */, - AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */, + AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */, + AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */, AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */, - AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */, + AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */, AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */, AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */, + AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */, + AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */, AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */, + AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */, AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */, - AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */, - AA719821287A819F00623C15 /* UIView-Debugging.m */, + AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */, AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */, - AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */, - AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */, AA719825287A819F00623C15 /* UIView-KIFAdditions.h */, - AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */, - AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */, - AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */, - AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */, - AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */, - AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */, - AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */, - AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */, - AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */, - AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */, - AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */, - AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */, AA719832287A819F00623C15 /* UIView-KIFAdditions.m */, - AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */, - AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */, - AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */, - AA719836287A819F00623C15 /* UIView-Debugging.h */, + AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */, AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */, - AA719838287A819F00623C15 /* LoadableCategory.h */, + AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */, AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */, - AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */, - AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */, + AA719838287A819F00623C15 /* LoadableCategory.h */, ); path = addition; sourceTree = ""; @@ -356,11 +305,7 @@ AA71986E287A81A000623C15 /* NSObject+Swizzle.h in Headers */, AA719871287A81A000623C15 /* FixCategoryBug.h in Headers */, AA719853287A81A000623C15 /* UIView-KIFAdditions.h in Headers */, - AA71985E287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.h in Headers */, AA719846287A81A000623C15 /* IOHIDEvent+KIF.h in Headers */, - AA71985C287A81A000623C15 /* NSException-KIFAdditions.h in Headers */, - AA719852287A81A000623C15 /* NSFileManager-KIFAdditions.h in Headers */, - AA719855287A81A000623C15 /* CALayer-KIFAdditions.h in Headers */, AA719862287A81A000623C15 /* UITouch-KIFAdditions.h in Headers */, AA71986B287A81A000623C15 /* UIApplication+Private.h in Headers */, AA71986D287A81A000623C15 /* PTFakeMetaTouch.h in Headers */, @@ -369,16 +314,11 @@ AA719854287A81A000623C15 /* UIEvent+KIFAdditions.h in Headers */, AA71970E287A44D200623C15 /* PlayLoader.h in Headers */, AA719856287A81A000623C15 /* NSPredicate+KIFAdditions.h in Headers */, - AA71986F287A81A000623C15 /* NSBundle+Swizzle.h in Headers */, - AA719851287A81A000623C15 /* UITableView-KIFAdditions.h in Headers */, AA719872287A81A000623C15 /* UITouch+Private.h in Headers */, AA719866287A81A000623C15 /* LoadableCategory.h in Headers */, AA719858287A81A000623C15 /* UIWindow-KIFAdditions.h in Headers */, - AA719857287A81A000623C15 /* UIScrollView-KIFAdditions.h in Headers */, AA71985B287A81A000623C15 /* NSString+KIFAdditions.h in Headers */, AA71985D287A81A000623C15 /* UIScreen+KIFAdditions.h in Headers */, - AA719864287A81A000623C15 /* UIView-Debugging.h in Headers */, - AA719868287A81A000623C15 /* NSBundle-KIFAdditions.h in Headers */, AA719859287A81A000623C15 /* CGGeometry-KIFAdditions.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -476,26 +416,19 @@ files = ( AA719848287A81A000623C15 /* UIScreen+KIFAdditions.m in Sources */, AA71984C287A81A000623C15 /* CGGeometry-KIFAdditions.m in Sources */, - AA719869287A81A000623C15 /* CALayer-KIFAdditions.m in Sources */, AA71975A287A480D00623C15 /* Toucher.swift in Sources */, AA71984A287A81A000623C15 /* NSString+KIFAdditions.m in Sources */, AA7197A1287A481500623C15 /* CircleMenuLoader.swift in Sources */, - AA71984E287A81A000623C15 /* UIScrollView-KIFAdditions.m in Sources */, - AA719849287A81A000623C15 /* NSException-KIFAdditions.m in Sources */, AA7197AB287A481500623C15 /* ControlModel.swift in Sources */, AA7197A8287A481500623C15 /* TypeMapping.swift in Sources */, AA7197AE287A481500623C15 /* DragElementsView.swift in Sources */, AA7197A7287A481500623C15 /* Invocation.swift in Sources */, AA71970D287A44D200623C15 /* PlaySettings.swift in Sources */, - AA71984F287A81A000623C15 /* UIView-Debugging.m in Sources */, AA719759287A480D00623C15 /* PlayAction.swift in Sources */, - AA719847287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.m in Sources */, AA71984D287A81A000623C15 /* UIWindow-KIFAdditions.m in Sources */, AA719867287A81A000623C15 /* NSPredicate+KIFAdditions.m in Sources */, - AA719845287A81A000623C15 /* NSBundle+Swizzle.m in Sources */, AA7197A2287A481500623C15 /* CircleMenu.swift in Sources */, AA71978B287A480D00623C15 /* MenuController.swift in Sources */, - AA719863287A81A000623C15 /* UITableView-KIFAdditions.m in Sources */, AA7197AA287A481500623C15 /* Toast.swift in Sources */, AA719789287A480D00623C15 /* PlayInput.swift in Sources */, AA719865287A81A000623C15 /* UIEvent+KIFAdditions.m in Sources */, @@ -516,7 +449,6 @@ AA71970F287A44D200623C15 /* PlayCover.swift in Sources */, AA719850287A81A000623C15 /* UITouch-KIFAdditions.m in Sources */, AA71985F287A81A000623C15 /* IOHIDEvent+KIF.m in Sources */, - AA719861287A81A000623C15 /* NSFileManager-KIFAdditions.m in Sources */, AA71985A287A81A000623C15 /* UIApplication-KIFAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/PlayTools/Controls/ControlMode.swift b/PlayTools/Controls/ControlMode.swift index 1ffb9ee4..26c1880a 100644 --- a/PlayTools/Controls/ControlMode.swift +++ b/PlayTools/Controls/ControlMode.swift @@ -25,7 +25,6 @@ let mode = ControlMode.mode } if PlaySettings.shared.gamingMode { Dynamic.NSCursor.unhide() - disableCursor(1) } PlayInput.shared.invalidate() } @@ -33,7 +32,6 @@ let mode = ControlMode.mode if visible { if PlaySettings.shared.gamingMode { Dynamic.NSCursor.hide() - disableCursor(0) } if screen.fullscreen { screen.switchDock(false) diff --git a/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.h b/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.h deleted file mode 100644 index c1fcadba..00000000 --- a/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// NSBundle+Swizzle.h -// PlayTools -// -// Created by siri on 26.09.2021. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSBundle (Swizzle) - -@end - -NS_ASSUME_NONNULL_END diff --git a/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.m b/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.m deleted file mode 100644 index 474fc34b..00000000 --- a/PlayTools/Controls/PTFakeTouch/NSBundle+Swizzle.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// NSBundle+Swizzle.m -// PlayTools -// -// Created by siri on 26.09.2021. -// - -#import "NSBundle+Swizzle.h" -#import -#import "NSObject+Swizzle.h" - -@implementation NSBundle (Swizzle) - -+ (void)load { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [NSBundle swizzleClassMethod:@selector(bundleWithPath:) withMethod:@selector(xxx_bundleWithPath:)]; - }); -} - -+ (instancetype)xxx_bundleWithPath:(NSString *)path { - if ([path isEqualToString:@"/System/Library/Frameworks/GameController.framework"]){ - return [self xxx_bundleWithPath:@"/System/iOSSupport/System/Library/Frameworks/GameController.framework"]; - } - return [self xxx_bundleWithPath:path]; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h index 46f047b8..5975de64 100644 --- a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h +++ b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h @@ -9,9 +9,6 @@ #import #import -void disableCursor(boolean_t disable); -void moveCursorTo(CGPoint point); - typedef struct { unsigned char r, g, b; } RGB; @@ -40,6 +37,4 @@ double ColourDistance(RGB e1, RGB e2); * * @return pointId 返回序列号 returns sequence number */ -+ (NSInteger)getAvailablePointId; - @end diff --git a/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.h deleted file mode 100644 index 711daa13..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// CALayer-KIFAdditions.h -// Pods -// -// Created by Radu Ciobanu on 28/01/2016. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. -// - -#import - -@interface CALayer (KIFAdditions) - -/** - * @method hasAnimations - * @abstract Traverses self's hierarchy of layers and checks whether any - * visible sublayers or self have ongoing anymations. - * @return YES if an animated layer has been found, NO otherwise. - */ -- (BOOL)hasAnimations; - -/*! - @method performBlockOnDescendentLayers: - @abstract Calls a block on the layer itself and on all its descendent layers. - @param block The block that will be called on the layers. Stop the traversation - of the layers by assigning YES to the stop-parameter of the block. - */ -- (void)performBlockOnDescendentLayers:(void (^)(CALayer *layer, BOOL *stop))block; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.m deleted file mode 100644 index ff42f286..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/CALayer-KIFAdditions.m +++ /dev/null @@ -1,52 +0,0 @@ -// -// CALayer-KIFAdditions.m -// Pods -// -// Created by Radu Ciobanu on 28/01/2016. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. -// - -#import "CALayer-KIFAdditions.h" - -@implementation CALayer (KIFAdditions) - -- (BOOL)hasAnimations -{ - __block BOOL result = NO; - [self performBlockOnDescendentLayers:^(CALayer *layer, BOOL *stop) { - // explicitly exclude _UIParallaxMotionEffect as it is used in alertviews, and we don't want every alertview to be paused) - BOOL hasAnimation = layer.animationKeys.count != 0 && ![layer.animationKeys isEqualToArray:@[@"_UIParallaxMotionEffect"]]; - if (hasAnimation && !layer.hidden) { - result = YES; - if (stop != NULL) { - *stop = YES; - } - } - }]; - return result; -} - -- (void)performBlockOnDescendentLayers:(void (^)(CALayer *layer, BOOL *stop))block -{ - BOOL stop = NO; - [self performBlockOnDescendentLayers:block stop:&stop]; -} - -- (void)performBlockOnDescendentLayers:(void (^)(CALayer *, BOOL *))block stop:(BOOL *)stop -{ - block(self, stop); - if (*stop) { - return; - } - - for (CALayer *layer in self.sublayers) { - [layer performBlockOnDescendentLayers:block stop:stop]; - if (*stop) { - return; - } - } -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.h index a1e94fb0..644fdf46 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.h +++ b/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.h @@ -12,7 +12,3 @@ CG_INLINE CGPoint CGPointCenteredInRect(CGRect bounds) { return CGPointMake(bounds.origin.x + bounds.size.width * 0.5f, bounds.origin.y + bounds.size.height * 0.5f); } - -CG_INLINE CGPoint CGPointMidPoint(CGPoint point1, CGPoint point2) { - return CGPointMake((point1.x + point2.x) / 2.0f, (point1.y + point2.y) / 2.0f); -} diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSBundle-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/NSBundle-KIFAdditions.h deleted file mode 100644 index 60cbe68b..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSBundle-KIFAdditions.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// NSBundle+KIFAdditions.h -// KIF -// -// Created by Brian Nickel on 7/27/13. -// -// - -#import - -@interface NSBundle (KIFAdditions) - -+ (NSBundle *)KIFTestBundle; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.h deleted file mode 100644 index 487fc0b5..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// NSException-KIFAdditions.h -// KIF -// -// Created by Tony DiPasquale on 12/20/13. -// -// - -#import - -@interface NSException (KIFAdditions) - -+ (NSException *)failureInFile:(NSString *)file atLine:(NSInteger)line withDescription:(NSString *)formatString, ...; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.m deleted file mode 100644 index 55bcc216..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSException-KIFAdditions.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// NSException-KIFAdditions.m -// KIF -// -// Created by Tony DiPasquale on 12/20/13. -// -// - -#import "NSException-KIFAdditions.h" - -@implementation NSException (KIFAdditions) - -+ (NSException *)failureInFile:(NSString *)file atLine:(NSInteger)line withDescription:(NSString *)formatString, ... -{ - va_list argumentList; - va_start(argumentList, formatString); - - NSString *reason = [[NSString alloc] initWithFormat:formatString arguments:argumentList]; - - va_end(argumentList); - - return [NSException exceptionWithName:@"KIFFailureException" - reason: reason - userInfo:@{@"FilenameKey": file, - @"LineNumberKey": @(line)}]; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.h deleted file mode 100644 index 5875d54a..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// NSFileManager-KIFAdditions.h -// KIF -// -// Created by Michael Thole on 6/1/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - - -@interface NSFileManager (KIFAdditions) - -- (NSString *)createUserDirectory:(NSSearchPathDirectory)searchPath; -- (BOOL)recursivelyCreateDirectory:(NSString *)path; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.m deleted file mode 100644 index b41f4a54..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSFileManager-KIFAdditions.m +++ /dev/null @@ -1,67 +0,0 @@ -// -// NSFileManager-KIFAdditions.m -// KIF -// -// Created by Michael Thole on 6/1/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "NSFileManager-KIFAdditions.h" -#import "LoadableCategory.h" - - -MAKE_CATEGORIES_LOADABLE(NSFileManager_KIFAdditions) - - -@implementation NSFileManager (KIFAdditions) - -#pragma mark Public Methods - -- (NSString *)createUserDirectory:(NSSearchPathDirectory)searchPath; -{ - NSArray *paths = NSSearchPathForDirectoriesInDomains(searchPath, NSUserDomainMask, YES); - if (!paths.count) { - return nil; - } - - NSString *rootDirectory = paths[0]; - - BOOL isDir; - BOOL created = NO; - if ([self fileExistsAtPath:rootDirectory isDirectory:&isDir] && isDir) { - created = YES; - } else { - created = [self recursivelyCreateDirectory:rootDirectory]; - } - - return created ? rootDirectory : nil; -} - -- (BOOL)recursivelyCreateDirectory:(NSString *)path; -{ - BOOL isDir = NO; - BOOL isParentADir = NO; - NSString *parentDir = nil; - - if (![self fileExistsAtPath:path isDirectory:&isDir]) { - // if file doesn't exist, first create parent - parentDir = [path stringByDeletingLastPathComponent]; - - if (!parentDir.length || [parentDir isEqualToString:@"/"]) { - isParentADir = YES; - } else { - isParentADir = [self recursivelyCreateDirectory:parentDir]; - } - - if (isParentADir) { - isDir = [self createDirectoryAtPath:path withIntermediateDirectories:NO attributes:nil error:nil]; - } else { - return NO; - } - } - - return isDir; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.h deleted file mode 100644 index 552996a2..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// UIAccessibilityElement-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/23/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - - -@interface UIAccessibilityElement (KIFAdditions) - -/*! - @abstract Finds the first view that the accessibility element is part of. - @discussion There is not always a one-to-one mapping between views and accessibility elements. Accessibility elements may not even map to the view you will expect. For instance, table view cell accessibility elements return the @c UITableView and keyboard keys map to the keyboard as a whole. - - @param element The accessibility element. - @return The first matching @c UIView as determined by the accessibility API. - */ -+ (UIView *)viewContainingAccessibilityElement:(UIAccessibilityElement *)element; - -/*! - @abstract Finds an accessibility element and view with a matching label, value, and traits, optionally passing a tappability test. - @discussion This method combines @c +accessibilityElementWithLabel:value:traits:error: and @c +viewContainingAccessibilityElement:tappable:error: for convenience. - @param foundElement The found accessibility element or @c nil if the method returns @c NO. Can be @c NULL. - @param foundView The first matching view for @c foundElement as determined by the accessibility API or @c nil if the view is hidden or fails the tappability test. Can be @c NULL. - @param label The accessibility label of the element to wait for. - @param value The accessibility value of the element to tap. - @param traits The accessibility traits of the element to wait for. Elements that do not include at least these traits are ignored. - @param error A reference to an error object to be populated when no matching element or view is found. Can be @c NULL. - @result @c YES if the element and view were found. Otherwise @c NO. - */ -+ (BOOL)accessibilityElement:(out UIAccessibilityElement **)foundElement view:(out UIView **)foundView withLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits tappable:(BOOL)mustBeTappable error:(out NSError **)error; - -/*! - @abstract Finds an accessibility element with a matching label, value, and traits. - @discussion This functionality is identical to -[UIApplication accessibilityElementWithLabel:accessibilityValue:traits:] except that it detailed error messaging in the case where the element cannot be found. - @param label The accessibility label of the element to wait for. - @param value The accessibility value of the element to tap. - @param traits The accessibility traits of the element to wait for. Elements that do not include at least these traits are ignored. - @param error A reference to an error object to be populated when no element is found. Can be @c NULL. - @return The found accessibility element. If @c nil see the @c error for a detailed reason. - */ -+ (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits error:(out NSError **)error; - -/*! - @abstract Finds an accessibility element and view where the element passes the predicate, optionally passing a tappability test. - @param foundElement The found accessibility element or @c nil if the method returns @c NO. Can be @c NULL. - @param foundView The first matching view for @c foundElement as determined by the accessibility API or @c nil if the view is hidden or fails the tappability test. Can be @c NULL. - @param predicate The predicate to test the accessibility element on. - @param error A reference to an error object to be populated when no matching element or view is found. Can be @c NULL. - @result @c YES if the element and view were found. Otherwise @c NO. - */ -+ (BOOL)accessibilityElement:(out UIAccessibilityElement **)foundElement view:(out UIView **)foundView withElementMatchingPredicate:(NSPredicate *)predicate tappable:(BOOL)mustBeTappable error:(out NSError **)error; - -/*! - @abstract Finds and attempts to make visible a view for a given accessibility element. - @discussion If the element is found, off screen, and is inside a scroll view, this method will attempt to programmatically scroll the view onto the screen before performing any logic as to if the view is tappable. - - @param element The accessibility element. - @param mustBeTappable If @c YES, a tappability test will be performed. - @param error A reference to an error object to be populated when no element is found. Can be @c NULL. - @return The first matching view as determined by the accessibility API or nil if the view is hidden or fails the tappability test. - */ -+ (UIView *)viewContainingAccessibilityElement:(UIAccessibilityElement *)element tappable:(BOOL)mustBeTappable error:(NSError **)error; - -/*! - @abstract Returns a human readable string of UIAccessiblityTrait names, derived from UIAccessibilityConstants.h. - @param traits The accessibility traits to list. -*/ -+ (NSString *)stringFromAccessibilityTraits:(UIAccessibilityTraits)traits; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.m deleted file mode 100644 index 252fce26..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIAccessibilityElement-KIFAdditions.m +++ /dev/null @@ -1,263 +0,0 @@ -// -// UIAccessibilityElement-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/23/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "NSPredicate+KIFAdditions.h" -#import "UIAccessibilityElement-KIFAdditions.h" -#import "UIApplication-KIFAdditions.h" -#import "UIScrollView-KIFAdditions.h" -#import "UIView-KIFAdditions.h" -#import "LoadableCategory.h" - -MAKE_CATEGORIES_LOADABLE(UIAccessibilityElement_KIFAdditions) - - -@implementation UIAccessibilityElement (KIFAdditions) - -+ (UIView *)viewContainingAccessibilityElement:(UIAccessibilityElement *)element; -{ - while (element && ![element isKindOfClass:[UIView class]]) { - // Sometimes accessibilityContainer will return a view that's too far up the view hierarchy - // UIAccessibilityElement instances will sometimes respond to view, so try to use that and then fall back to accessibilityContainer - id view = [element respondsToSelector:@selector(view)] ? [(id)element view] : nil; - - if (view) { - element = view; - } else { - element = [element accessibilityContainer]; - } - } - - return (UIView *)element; -} - -+ (BOOL)accessibilityElement:(out UIAccessibilityElement **)foundElement view:(out UIView **)foundView withLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits tappable:(BOOL)mustBeTappable error:(out NSError **)error; -{ - UIAccessibilityElement *element = [self accessibilityElementWithLabel:label value:value traits:traits error:error]; - if (!element) { - return NO; - } - - UIView *view = [self viewContainingAccessibilityElement:element tappable:mustBeTappable error:error]; - if (!view) { - return NO; - } - - if (foundElement) { *foundElement = element; } - if (foundView) { *foundView = view; } - return YES; -} - -+ (BOOL)accessibilityElement:(out UIAccessibilityElement **)foundElement view:(out UIView **)foundView withElementMatchingPredicate:(NSPredicate *)predicate tappable:(BOOL)mustBeTappable error:(out NSError **)error; -{ - UIAccessibilityElement *element = [[UIApplication sharedApplication] accessibilityElementMatchingBlock:^BOOL(UIAccessibilityElement *element) { - return [predicate evaluateWithObject:element]; - }]; - - if (!element) { - return NO; - } - - UIView *view = [UIAccessibilityElement viewContainingAccessibilityElement:element tappable:mustBeTappable error:error]; - if (!view) { - return NO; - } - - if (foundElement) { *foundElement = element; } - if (foundView) { *foundView = view; } - return YES; -} - -+ (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits error:(out NSError **)error; -{ - UIAccessibilityElement *element = [[UIApplication sharedApplication] accessibilityElementWithLabel:label accessibilityValue:value traits:traits]; - if (element || !error) { - return element; - } - - element = [[UIApplication sharedApplication] accessibilityElementWithLabel:label accessibilityValue:nil traits:traits]; - // For purposes of a better error message, see if we can find the view, just not a view with the specified value. - if (value && element) { - return nil; - } - - // Check the traits, too. - element = [[UIApplication sharedApplication] accessibilityElementWithLabel:label accessibilityValue:nil traits:UIAccessibilityTraitNone]; - if (traits != UIAccessibilityTraitNone && element) { - return nil; - } - - return nil; -} - -+ (UIView *)viewContainingAccessibilityElement:(UIAccessibilityElement *)element tappable:(BOOL)mustBeTappable error:(NSError **)error; -{ - // Small safety mechanism. If someone calls this method after a failing call to accessibilityElementWithLabel:..., we don't want to wipe out the error message. - if (!element && error && *error) { - return nil; - } - - // Make sure the element is visible - UIView *view = [UIAccessibilityElement viewContainingAccessibilityElement:element]; - if (!view) { - if (error) { - } - return nil; - } - - // Scroll the view (and superviews) to be visible if necessary - UIView *superview = (UIScrollView *)view; - while (superview) { - // Fix for iOS7 table view cells containing scroll views - if ([superview.superview isKindOfClass:[UITableViewCell class]]) { - break; - } - - if ([superview isKindOfClass:[UIScrollView class]]) { - UIScrollView *scrollView = (UIScrollView *)superview; - - if (((UIAccessibilityElement *)view == element) && ![view isKindOfClass:[UITableViewCell class]]) { - [scrollView scrollViewToVisible:view animated:YES]; - } else { - CGRect elementFrame = [view.window convertRect:element.accessibilityFrame toView:scrollView]; - CGRect visibleRect = CGRectMake(scrollView.contentOffset.x, scrollView.contentOffset.y, CGRectGetWidth(scrollView.bounds), CGRectGetHeight(scrollView.bounds)); - - // Only call scrollRectToVisible if the element isn't already visible - // iOS 8 will sometimes incorrectly scroll table views so the element scrolls out of view - if (!CGRectContainsRect(visibleRect, elementFrame)) { - [scrollView scrollRectToVisible:elementFrame animated:YES]; - } - } - - // Give the scroll view a small amount of time to perform the scroll. - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.3, false); - } - - superview = superview.superview; - } - -// if ([[UIApplication sharedApplication] isIgnoringInteractionEvents]) { -// return nil; -// } - - // If we don't require tappability, at least make sure it's not hidden - if ([view isHidden]) { - return nil; - } - - if (mustBeTappable && !view.isProbablyTappable) { - return nil; - } - - return view; -} - -+ (NSPredicate *)findClosestMatchingPredicate:(NSPredicate *)aPredicate; -{ - if (!aPredicate) { - return nil; - } - - UIAccessibilityElement *match = [[UIApplication sharedApplication] accessibilityElementMatchingBlock:^BOOL (UIAccessibilityElement *element) { - return [aPredicate evaluateWithObject:element]; - }]; - if (match) { - return aPredicate; - } - - // Breadth-First algorithm to match as many subpredicates as possible - NSMutableArray *queue = [NSMutableArray arrayWithObject:aPredicate]; - while (queue.count > 0) { - // Dequeuing - NSPredicate *predicate = [queue firstObject]; - [queue removeObject:predicate]; - - // Remove one subpredicate at a time an then check if an element would match this resulting predicate - for (NSPredicate *subpredicate in [predicate flatten]) { - NSPredicate *predicateMinusOneCondition = [predicate minusSubpredicatesFrom:subpredicate]; - if (predicateMinusOneCondition) { - UIAccessibilityElement *match = [[UIApplication sharedApplication] accessibilityElementMatchingBlock:^BOOL (UIAccessibilityElement *element) { - return [predicateMinusOneCondition evaluateWithObject:element]; - }]; - if (match) { - return predicateMinusOneCondition; - } - [queue addObject:predicateMinusOneCondition]; - } - } - } - return nil; -} - -+ (NSString *)stringFromAccessibilityTraits:(UIAccessibilityTraits)traits; -{ - if (traits == UIAccessibilityTraitNone) { - return @"UIAccessibilityTraitNone"; - } - - NSString *string = @""; - - NSArray *allTraits = @[ - @(UIAccessibilityTraitButton), - @(UIAccessibilityTraitLink), - @(UIAccessibilityTraitHeader), - @(UIAccessibilityTraitSearchField), - @(UIAccessibilityTraitImage), - @(UIAccessibilityTraitSelected), - @(UIAccessibilityTraitPlaysSound), - @(UIAccessibilityTraitKeyboardKey), - @(UIAccessibilityTraitStaticText), - @(UIAccessibilityTraitSummaryElement), - @(UIAccessibilityTraitNotEnabled), - @(UIAccessibilityTraitUpdatesFrequently), - @(UIAccessibilityTraitStartsMediaSession), - @(UIAccessibilityTraitAdjustable), - @(UIAccessibilityTraitAllowsDirectInteraction), - @(UIAccessibilityTraitCausesPageTurn) - ]; - - NSArray *traitNames = @[ - @"UIAccessibilityTraitButton", - @"UIAccessibilityTraitLink", - @"UIAccessibilityTraitHeader", - @"UIAccessibilityTraitSearchField", - @"UIAccessibilityTraitImage", - @"UIAccessibilityTraitSelected", - @"UIAccessibilityTraitPlaysSound", - @"UIAccessibilityTraitKeyboardKey", - @"UIAccessibilityTraitStaticText", - @"UIAccessibilityTraitSummaryElement", - @"UIAccessibilityTraitNotEnabled", - @"UIAccessibilityTraitUpdatesFrequently", - @"UIAccessibilityTraitStartsMediaSession", - @"UIAccessibilityTraitAdjustable", - @"UIAccessibilityTraitAllowsDirectInteraction", - @"UIAccessibilityTraitCausesPageTurn" - ]; - - - for (NSNumber *trait in allTraits) { - if ((traits & trait.longLongValue) == trait.longLongValue) { - NSString *name = [traitNames objectAtIndex:[allTraits indexOfObject:trait]]; - if (string.length > 0) { - string = [string stringByAppendingString:@", "]; - } - string = [string stringByAppendingString:name]; - traits &= ~trait.longLongValue; - } - } - if (traits != UIAccessibilityTraitNone) { - if (string.length > 0) { - string = [string stringByAppendingString:@", "]; - } - string = [string stringByAppendingFormat:@"UNKNOWN ACCESSIBILITY TRAIT: %llu", traits]; - } - return string; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h index 5c9525e1..4b1439c4 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h +++ b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h @@ -28,22 +28,6 @@ UIKIT_EXTERN NSString *const UIApplicationOpenedURLKey; @interface UIApplication (KIFAdditions) -/*! - @abstract Finds an accessibility element with a matching label, value, and traits across all windows in the application starting at the frontmost window. - @param label The accessibility label of the element to search for. - @param value The accessibility value of the element to search for. If @c nil, all values will be accepted. - @param traits The accessibility traits of the element to search for. Elements that do not include at least these traits are ignored. - @return The found accessibility element or @c nil if the element could not be found. - */ -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label accessibilityValue:(NSString *)value traits:(UIAccessibilityTraits)traits; - -/*! - @abstract Finds an accessibility element where @c matchBlock returns @c YES, across all windows in the application starting at the fronmost window. - @discussion This method should be used if @c accessibilityElementWithLabel:accessibilityValue:traits: does not meet your requirements. For example, if you are searching for an element that begins with a pattern or if of a certain view type. - @param matchBlock A block to be performed on each element to see if it passes. - */ -- (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessibilityElement *))matchBlock; - /*! @returns The window containing the keyboard or @c nil if the keyboard is not visible. */ diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m index f352ce63..8ff89855 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m +++ b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m @@ -33,34 +33,6 @@ - (void)popRunLoopMode:(id)arg1 requester:(id)requester; @implementation UIApplication (KIFAdditions) -#pragma mark - Finding elements - -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label accessibilityValue:(NSString *)value traits:(UIAccessibilityTraits)traits; -{ - // Go through the array of windows in reverse order to process the frontmost window first. - // When several elements with the same accessibilitylabel are present the one in front will be picked. - for (UIWindow *window in [self.windowsWithKeyWindow reverseObjectEnumerator]) { - UIAccessibilityElement *element = [window accessibilityElementWithLabel:label accessibilityValue:value traits:traits]; - if (element) { - return element; - } - } - - return nil; -} - -- (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessibilityElement *))matchBlock; -{ - for (UIWindow *window in [self.windowsWithKeyWindow reverseObjectEnumerator]) { - UIAccessibilityElement *element = [window accessibilityElementMatchingBlock:matchBlock]; - if (element) { - return element; - } - } - - return nil; -} - #pragma mark - Interesting windows - (UIWindow *)keyboardWindow; diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.h deleted file mode 100644 index a97480e0..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIScrollView-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/22/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - - -@interface UIScrollView (KIFAdditions) - -- (void)scrollViewToVisible:(UIView *)view animated:(BOOL)animated; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.m deleted file mode 100644 index a1e22451..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIScrollView-KIFAdditions.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// UIScrollView-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/22/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UIScrollView-KIFAdditions.h" -#import "LoadableCategory.h" -#import "UIApplication-KIFAdditions.h" -#import "UIView-KIFAdditions.h" - - -MAKE_CATEGORIES_LOADABLE(UIScrollView_KIFAdditions) - - -@implementation UIScrollView (KIFAdditions) - -- (void)scrollViewToVisible:(UIView *)view animated:(BOOL)animated; -{ - CGRect viewFrame = [self convertRect:view.bounds fromView:view]; - CGPoint contentOffset = self.contentOffset; - - if (CGRectGetMaxX(viewFrame) > self.contentOffset.x + CGRectGetWidth(self.bounds)) { - contentOffset.x = MIN(CGRectGetMaxX(viewFrame) - CGRectGetWidth(self.bounds), CGRectGetMinX(viewFrame)); - } else if (CGRectGetMinX(viewFrame) < self.contentOffset.x) { - contentOffset.x = MAX(CGRectGetMaxX(viewFrame) - CGRectGetWidth(self.bounds), CGRectGetMinX(viewFrame)); - } - - if (CGRectGetMaxY(viewFrame) > self.contentOffset.y + CGRectGetHeight(self.bounds)) { - contentOffset.y = MIN(CGRectGetMaxY(viewFrame) - CGRectGetHeight(self.bounds), CGRectGetMinY(viewFrame)); - } else if (CGRectGetMinY(viewFrame) < self.contentOffset.y) { - contentOffset.y = MAX(CGRectGetMaxY(viewFrame) - CGRectGetHeight(self.bounds), CGRectGetMinY(viewFrame)); - } - - if (!CGPointEqualToPoint(contentOffset, self.contentOffset)) { - [self setContentOffset:contentOffset animated:animated]; - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.2, false); - } -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.h deleted file mode 100644 index 5dfc9879..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// UITableView-KIFAdditions.h -// KIF -// -// Created by Hilton Campbell on 4/12/14. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - -@interface UITableView (KIFAdditions) - -- (BOOL)dragCell:(UITableViewCell *)cell toIndexPath:(NSIndexPath *)indexPath error:(NSError **)error; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.m deleted file mode 100644 index c6df5602..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UITableView-KIFAdditions.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// UITableView-KIFAdditions.m -// KIF -// -// Created by Hilton Campbell on 4/12/14. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UITableView-KIFAdditions.h" -#import "UIView-KIFAdditions.h" -#import "UIApplication-KIFAdditions.h" -#import "UITouch-KIFAdditions.h" -#import "CGGeometry-KIFAdditions.h" - -@implementation UITableView (KIFAdditions) - -#define DRAG_STEP_DISTANCE 5 - -- (BOOL)dragCell:(UITableViewCell *)cell toIndexPath:(NSIndexPath *)indexPath error:(NSError **)error; -{ - UIView *sourceReorderControl = [[cell subviewsWithClassNameOrSuperClassNamePrefix:@"UITableViewCellReorderControl"] lastObject]; - if (!sourceReorderControl) { - return NO; - } - - CGPoint sourcePoint = [self convertPoint:CGPointCenteredInRect(sourceReorderControl.bounds) fromView:sourceReorderControl]; - - // If section < 0, search from the end of the table. - if (indexPath.section < 0) { - indexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:self.numberOfSections + indexPath.section]; - } - - // If row < 0, search from the end of the section. - if (indexPath.row < 0) { - indexPath = [NSIndexPath indexPathForRow:[self numberOfRowsInSection:indexPath.section] + indexPath.row inSection:indexPath.section]; - } - - CGPoint destinationPoint = CGPointMake(sourcePoint.x, CGPointCenteredInRect([self rectForRowAtIndexPath:indexPath]).y); - - // Create the touch (there should only be one touch object for the whole drag) - UITouch *touch = [[UITouch alloc] initAtPoint:sourcePoint inView:self]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - - UIEvent *eventDown = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventDown]; - - // Hold long enough to enter reordering mode - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.2, false); - - CGPoint currentLocation = sourcePoint; - while (currentLocation.y < destinationPoint.y - DRAG_STEP_DISTANCE || currentLocation.y > destinationPoint.y + DRAG_STEP_DISTANCE) { - if (currentLocation.y < destinationPoint.y) { - currentLocation.y += DRAG_STEP_DISTANCE; - } else { - currentLocation.y -= DRAG_STEP_DISTANCE; - } - - [touch setLocationInWindow:[self.window convertPoint:currentLocation fromView:self]]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseMoved]; - - UIEvent *eventDrag = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventDrag]; - - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.01, false); - } - - // Hold long enough for the animations to catch up - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.2, false); - - [touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - - UIEvent *eventUp = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventUp]; - - // Dispatching the event doesn't actually update the first responder, so fake it - if (touch.view == self && [self canBecomeFirstResponder]) { - [self becomeFirstResponder]; - } - return YES; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.h b/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.h deleted file mode 100644 index cb7cfdf0..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// UIView+Debugging.h -// KIF -// -// Created by Graeme Arthur on 02/05/15. -// - -#import -#import - -@interface UIView (Debugging) -/*! - @abstract Prints the view hiererchy, starting from the top window(s), along with accessibility information, which is more related to KIF than the usual information given by the 'description' method. - */ -+(void)printViewHierarchy; - -/*! - @abstract Prints the view hiererchy, starting from this view, along with accessibility information, which is more related to KIF than the usual information given by the 'description' method. - */ --(void)printViewHierarchy; - -@end \ No newline at end of file diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.m b/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.m deleted file mode 100644 index 96d86002..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-Debugging.m +++ /dev/null @@ -1,207 +0,0 @@ -// -// UIView+Debugging.m -// KIF -// -// Created by Graeme Arthur on 02/05/15. -// - -#import "UIView-Debugging.h" - -@implementation UIView (Debugging) - -+(void)printViewHierarchy { - NSArray* windows = [UIApplication sharedApplication].windows; - if(windows.count == 1) { - [windows[0] printViewHierarchy]; - } else { - //more than one window, also print some information about each window - for (UIWindow* window in windows) { - printf("Window level %f", window.windowLevel); - if(window.isKeyWindow) printf(" (key window)"); - printf("\n"); - [window printViewHierarchy]; - printf("\n"); - } - } -} - -- (void)printViewHierarchy { - [self printViewHierarchyWithIndentation:0]; -} - -- (void)printViewHierarchyWithIndentation:(int)indent { - [self printIndentation:indent]; - [self printClassName]; - - [self printAccessibilityInfo]; - - if(self.hidden) { - printf(" (invisible)"); - } - - if([self isKindOfClass:[UIImageView class]]) { - [self printImageHighlightedState]; - } - - if([self isKindOfClass:[UIControl class]]) { - [self printControlState]; - } - printf("\n"); - - [self printAccessibilityElementsWithIndentation:indent]; - - for (UIView *subview in self.subviews) { - [subview printViewHierarchyWithIndentation:indent+1]; - } -} - -- (void)printIndentation:(int)indent { - for(int i = 0; i < indent; ++i) { - printf("|\t"); - } -} - -- (void)printClassName { - NSString* name = NSStringFromClass([self class]); - printf("%s", name.UTF8String); -} - -- (void)printAccessibilityInfo { - NSString* label = self.accessibilityLabel; - NSString* identifier = self.accessibilityIdentifier; - if(label != nil) { - printf(", label: %s", label.UTF8String); - } else if(identifier != nil) { - printf(", identifier: %s", identifier.UTF8String); - } -} - -- (void)printImageHighlightedState { - if(((UIImageView*)self).highlighted) { - printf(" (highlighted)"); - } else { - printf(" (not highlighted)"); - } -} - -- (void)printControlState { - UIControl* ctrl = (UIControl*)self; - ctrl.enabled ? printf(" (enabled)") : printf(" (not enabled)"); - ctrl.selected ? printf(" (selected)") : printf(" (not selected)"); - ctrl.highlighted ? printf(" (highlighted)") : printf(" (not highlighted)"); -} - -- (void)printAccessibilityElementsWithIndentation:(int)indent { - NSInteger numOfAccElements = self.accessibilityElementCount; - if(numOfAccElements != NSNotFound) { - for (NSInteger i = 0; i < numOfAccElements; ++i) { - [self printIndentation:indent]; - UIAccessibilityElement *e = [(UIAccessibilityElement*)self accessibilityElementAtIndex:i]; - printf("%s, label: %s", NSStringFromClass([e class]).UTF8String, e.accessibilityLabel.UTF8String); - if(e.accessibilityValue && e.accessibilityValue.length > 0) { - printf(", value: %s", e.accessibilityValue.UTF8String); - } - if(e.accessibilityHint && e.accessibilityHint.length > 0) { - printf(", hint: %s", e.accessibilityHint.UTF8String); - } - printf(", "); - [self printAccessibilityTraits:e.accessibilityTraits]; - printf("\n"); - } - } -} - -- (void)printAccessibilityTraits:(UIAccessibilityTraits)traits { - - printf("traits: "); - bool didPrintOne = false; - if(traits == UIAccessibilityTraitNone) { - printf("none"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitButton) { - if(didPrintOne) printf(", "); - printf("button"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitLink) { - if(didPrintOne) printf(", "); - printf("link"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitHeader) { - if(didPrintOne) printf(", "); - printf("header"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitSearchField) { - if(didPrintOne) printf(", "); - printf("search field"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitImage) { - if(didPrintOne) printf(", "); - printf("image"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitSelected) { - if(didPrintOne) printf(", "); - printf("selected"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitPlaysSound) { - if(didPrintOne) printf(", "); - printf("plays sound"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitKeyboardKey) { - if(didPrintOne) printf(", "); - printf("keyboard key"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitStaticText) { - if(didPrintOne) printf(", "); - printf("static text"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitSummaryElement) { - if(didPrintOne) printf(", "); - printf("summary element"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitNotEnabled) { - if(didPrintOne) printf(", "); - printf("not enabled"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitUpdatesFrequently) { - if(didPrintOne) printf(", "); - printf("updates frequently"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitStartsMediaSession) { - if(didPrintOne) printf(", "); - printf("starts media session"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitAdjustable) { - if(didPrintOne) printf(", "); - printf("adjustable"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitAllowsDirectInteraction) { - if(didPrintOne) printf(", "); - printf("allows direct interaction"); - didPrintOne = true; - } - if(traits & UIAccessibilityTraitCausesPageTurn) { - if(didPrintOne) printf(", "); - printf("causes page turn"); - didPrintOne = true; - } - if(!didPrintOne) { - printf("unknown flags (0x%llx)", traits); - } -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h index 746fde0b..17a0d539 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h +++ b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h @@ -16,20 +16,7 @@ typedef CGPoint KIFDisplacement; @interface UIView (KIFAdditions) -@property (nonatomic, readonly, getter=isProbablyTappable) BOOL probablyTappable; - - (BOOL)isDescendantOfFirstResponder; -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label; -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label traits:(UIAccessibilityTraits)traits; -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label accessibilityValue:(NSString *)value traits:(UIAccessibilityTraits)traits; - -/*! - @method accessibilityElementMatchingBlock: - @abstract Finds the descendent accessibility element that matches the conditions defined by the match block. - @param matchBlock A block which returns YES for matching elements. - @result The matching accessibility element. - */ -- (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessibilityElement *))matchBlock; - (UIView *)subviewWithClassNamePrefix:(NSString *)prefix __deprecated; - (NSArray *)subviewsWithClassNamePrefix:(NSString *)prefix; @@ -57,32 +44,6 @@ typedef CGPoint KIFDisplacement; - (void)pinchAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount; - (void)zoomAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount; - (void)twoFingerRotateAtPoint:(CGPoint)centerPoint angle:(CGFloat)angleInDegrees; -/*! - @method isTappableWithHitTestResultView: - @abstract Easy hook to override whether a hit test result makes a view tappable. - @discussion Some times, your view hierarchies involve putting overlays over views that would otherwise be tappable. Since KIF doesn't know about these exceptions, you can override this method as a convenient way of hooking in to the check for something being tappable. Your implementation will probably want to call up to super. - @param hitView The view -hitTest: returned when trying to tap on a point inside your view's bounds - @result Whether or not the view is tappable. - */ -- (BOOL)isTappableWithHitTestResultView:(UIView *)hitView; - -/*! - @method isTappableInRect: - @abstract Whether or not the receiver can be tapped inside the given rectangular area. - @discussion Determines whether or not tapping within the given rectangle would actually hit the receiver or one of its children. This is useful for determining if the view is actually on screen and enabled. - @param rect A rectangle specifying an area in the receiver in the receiver's frame coordinates. - @result Whether or not the view is tappable. - */ -- (BOOL)isTappableInRect:(CGRect)rect; - -/*! - @method tappablePointInRect:(CGRect)rect; - @abstract Finds a point in the receiver that is tappable. - @discussion Finds a tappable point in the receiver, where tappable is defined as a point that, when tapped, will hit the receiver. - @param rect A rectangle specifying an area in the receiver in the receiver's frame coordinates. - @result A tappable point in the receivers frame coordinates. - */ -- (CGPoint)tappablePointInRect:(CGRect)rect; - (UIEvent *)eventWithTouch:(UITouch *)touch; diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m index 6afe04e8..042d0cc8 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m +++ b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m @@ -9,7 +9,6 @@ #import "UIView-KIFAdditions.h" #import "CGGeometry-KIFAdditions.h" -#import "UIAccessibilityElement-KIFAdditions.h" #import "UIApplication-KIFAdditions.h" #import "UITouch-KIFAdditions.h" #import @@ -84,218 +83,6 @@ + (NSSet *)classesToSkipAccessibilitySearchRecursion return classesToSkip; } -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label -{ - return [self accessibilityElementWithLabel:label traits:UIAccessibilityTraitNone]; -} - -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label traits:(UIAccessibilityTraits)traits; -{ - return [self accessibilityElementWithLabel:label accessibilityValue:nil traits:traits]; -} - -- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label accessibilityValue:(NSString *)value traits:(UIAccessibilityTraits)traits; -{ - return [self accessibilityElementMatchingBlock:^(UIAccessibilityElement *element) { - - // TODO: This is a temporary fix for an SDK defect. - NSString *accessibilityValue = nil; - @try { - accessibilityValue = element.accessibilityValue; - } - @catch (NSException *exception) { - - } - - if ([accessibilityValue isKindOfClass:[NSAttributedString class]]) { - accessibilityValue = [(NSAttributedString *)accessibilityValue string]; - } - - BOOL labelsMatch = StringsMatchExceptLineBreaks(label, element.accessibilityLabel); - BOOL traitsMatch = ((element.accessibilityTraits) & traits) == traits; - BOOL valuesMatch = !value || [value isEqual:accessibilityValue]; - - return (BOOL)(labelsMatch && traitsMatch && valuesMatch); - }]; -} - -- (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessibilityElement *))matchBlock; -{ - return [self accessibilityElementMatchingBlock:matchBlock notHidden:YES]; -} - -- (UIAccessibilityElement *)accessibilityElementMatchingBlock:(BOOL(^)(UIAccessibilityElement *))matchBlock notHidden:(BOOL)notHidden; -{ - if (notHidden && self.hidden) { - return nil; - } - - // In case multiple elements with the same label exist, prefer ones that are currently visible - UIAccessibilityElement *matchingButOccludedElement = nil; - - BOOL elementMatches = matchBlock((UIAccessibilityElement *)self); - - if (elementMatches) { - if (self.isTappable) { - return (UIAccessibilityElement *)self; - } else { - matchingButOccludedElement = (UIAccessibilityElement *)self; - } - } - - if ([[[self class] classesToSkipAccessibilitySearchRecursion] containsObject:[self class]]) { - return matchingButOccludedElement; - } - - // Check the subviews first. Even if the receiver says it's an accessibility container, - // the returned objects are UIAccessibilityElementMockViews (which aren't actually views) - // rather than the real subviews it contains. We want the real views if possible. - // UITableViewCell is such an offender. - for (UIView *view in [self.subviews reverseObjectEnumerator]) { - UIAccessibilityElement *element = [view accessibilityElementMatchingBlock:matchBlock]; - if (!element) { - continue; - } - - UIView *viewForElement = [UIAccessibilityElement viewContainingAccessibilityElement:element]; - CGRect accessibilityFrame = [viewForElement.window convertRect:element.accessibilityFrame toView:viewForElement]; - - if ([viewForElement isTappableInRect:accessibilityFrame]) { - return element; - } else { - matchingButOccludedElement = element; - } - } - - NSMutableArray *elementStack = [NSMutableArray arrayWithObject:self]; - - while (elementStack.count) { - UIAccessibilityElement *element = [elementStack lastObject]; - [elementStack removeLastObject]; - - BOOL elementMatches = matchBlock(element); - - if (elementMatches) { - UIView *viewForElement = [UIAccessibilityElement viewContainingAccessibilityElement:element]; - CGRect accessibilityFrame = [viewForElement.window convertRect:element.accessibilityFrame toView:viewForElement]; - - if ([viewForElement isTappableInRect:accessibilityFrame]) { - return element; - } else { - matchingButOccludedElement = element; - continue; - } - } - - // If the view is an accessibility container, and we didn't find a matching subview, - // then check the actual accessibility elements - NSInteger accessibilityElementCount = element.accessibilityElementCount; - if (accessibilityElementCount == 0 || accessibilityElementCount == NSNotFound) { - continue; - } - - for (NSInteger accessibilityElementIndex = 0; accessibilityElementIndex < accessibilityElementCount; accessibilityElementIndex++) { - UIAccessibilityElement *subelement = [element accessibilityElementAtIndex:accessibilityElementIndex]; - - if (subelement) { - // Skip table view cell accessibility elements, they're handled below - if ([subelement isKindOfClass:NSClassFromString(@"UITableViewCellAccessibilityElement")]) { - continue; - } - - [elementStack addObject:subelement]; - } - } - } - - if (!matchingButOccludedElement) { - if ([self isKindOfClass:[UITableView class]]) { - UITableView *tableView = (UITableView *)self; - - // Because of a bug in [UITableView indexPathsForVisibleRows] http://openradar.appspot.com/radar?id=5191284490764288 - // We use [UITableView visibleCells] to determine the index path of the visible cells - NSMutableArray *indexPathsForVisibleRows = [[NSMutableArray alloc] init]; - [[tableView visibleCells] enumerateObjectsUsingBlock:^(UITableViewCell *cell, NSUInteger idx, BOOL *stop) { - NSIndexPath *indexPath = [tableView indexPathForCell:cell]; - if (indexPath) { - [indexPathsForVisibleRows addObject:indexPath]; - } - }]; - - for (NSUInteger section = 0, numberOfSections = [tableView numberOfSections]; section < numberOfSections; section++) { - for (NSUInteger row = 0, numberOfRows = [tableView numberOfRowsInSection:section]; row < numberOfRows; row++) { - // Skip visible rows because they are already handled - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section]; - if ([indexPathsForVisibleRows containsObject:indexPath]) { - continue; - } - - @autoreleasepool { - // Get the cell directly from the dataSource because UITableView will only vend visible cells - UITableViewCell *cell = [tableView.dataSource tableView:tableView cellForRowAtIndexPath:indexPath]; - - UIAccessibilityElement *element = [cell accessibilityElementMatchingBlock:matchBlock notHidden:NO]; - - // Remove the cell from the table view so that it doesn't stick around - [cell removeFromSuperview]; - - // Skip this cell if it isn't the one we're looking for - if (!element) { - continue; - } - } - - // Scroll to the cell and wait for the animation to complete - [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:YES]; - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.5, false); - - // Now try finding the element again - return [self accessibilityElementMatchingBlock:matchBlock]; - } - } - } else if ([self isKindOfClass:[UICollectionView class]]) { - UICollectionView *collectionView = (UICollectionView *)self; - - NSArray *indexPathsForVisibleItems = [collectionView indexPathsForVisibleItems]; - - for (NSUInteger section = 0, numberOfSections = [collectionView numberOfSections]; section < numberOfSections; section++) { - for (NSUInteger item = 0, numberOfItems = [collectionView numberOfItemsInSection:section]; item < numberOfItems; item++) { - // Skip visible items because they are already handled - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section]; - if ([indexPathsForVisibleItems containsObject:indexPath]) { - continue; - } - - @autoreleasepool { - // Get the cell directly from the dataSource because UICollectionView will only vend visible cells - UICollectionViewCell *cell = [collectionView.dataSource collectionView:collectionView cellForItemAtIndexPath:indexPath]; - - UIAccessibilityElement *element = [cell accessibilityElementMatchingBlock:matchBlock notHidden:NO]; - - // Remove the cell from the collection view so that it doesn't stick around - [cell removeFromSuperview]; - - // Skip this cell if it isn't the one we're looking for - // Sometimes we get cells with no size here which can cause an endless loop, so we ignore those - if (!element || CGSizeEqualToSize(cell.frame.size, CGSizeZero)) { - continue; - } - } - - // Scroll to the cell and wait for the animation to complete - [collectionView scrollToItemAtIndexPath:indexPath atScrollPosition:UICollectionViewScrollPositionNone animated:YES]; - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.5, false); - - // Now try finding the element again - return [self accessibilityElementMatchingBlock:matchBlock]; - } - } - } - } - - return matchingButOccludedElement; -} - - (UIView *)subviewWithClassNamePrefix:(NSString *)prefix; { NSArray *subviews = [self subviewsWithClassNamePrefix:prefix]; @@ -394,24 +181,7 @@ - (void)tap; - (void)tapAtPoint:(CGPoint)point; { - // Web views don't handle touches in a normal fashion, but they do have a method we can call to tap them - // This may not be necessary anymore. We didn't properly support controls that used gesture recognizers - // when this was added, but we now do. It needs to be tested before we can get rid of it. - // Xyct: indeed unnecessary. UIWebView already depracated. -// id /*UIWebBrowserView*/ webBrowserView = nil; -// -// if ([NSStringFromClass([self class]) isEqual:@"UIWebBrowserView"]) { -// webBrowserView = self; -// } else if ([self isKindOfClass:[UIWebView class]]) { -// id webViewInternal = [self valueForKey:@"_internal"]; -// webBrowserView = [webViewInternal valueForKey:@"browserView"]; -// } -// -// if (webBrowserView) { -// [webBrowserView tapInteractionWithLocation:point]; -// return; -// } - + // Handle touches in the normal way for other views UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self]; [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; @@ -673,111 +443,6 @@ - (NSArray *)pointsFromStartPoint:(CGPoint)startPoint toPoint:(CGPoint)toPoint s return [NSArray arrayWithArray:points]; } -- (BOOL)isProbablyTappable -{ - // There are some issues with the tappability check in UIWebViews, so if the view is a UIWebView we will just skip the check. - return [NSStringFromClass([self class]) isEqualToString:@"UIWebBrowserView"] || self.isTappable; -} - -// Is this view currently on screen? -- (BOOL)isTappable; -{ - return ([self hasTapGestureRecognizer] || - [self isTappableInRect:self.bounds]); -} - -- (BOOL)hasTapGestureRecognizer -{ - __block BOOL hasTapGestureRecognizer = NO; - - [self.gestureRecognizers enumerateObjectsUsingBlock:^(id obj, - NSUInteger idx, - BOOL *stop) { - if ([obj isKindOfClass:[UITapGestureRecognizer class]]) { - hasTapGestureRecognizer = YES; - - if (stop != NULL) { - *stop = YES; - } - } - }]; - - return hasTapGestureRecognizer; -} - -- (BOOL)isTappableInRect:(CGRect)rect; -{ - CGPoint tappablePoint = [self tappablePointInRect:rect]; - - return !isnan(tappablePoint.x); -} - -- (BOOL)isTappableWithHitTestResultView:(UIView *)hitView; -{ - // Special case for UIControls, which may have subviews which don't respond to -hitTest:, - // but which are tappable. In this case the hit view will be the containing - // UIControl, and it will forward the tap to the appropriate subview. - // This applies with UISegmentedControl which contains UISegment views (a private UIView - // representing a single segment). - if ([hitView isKindOfClass:[UIControl class]] && [self isDescendantOfView:hitView]) { - return YES; - } - - // Button views in the nav bar (a private class derived from UINavigationItemView), do not return - // themselves in a -hitTest:. Instead they return the nav bar. - if ([hitView isKindOfClass:[UINavigationBar class]] && [self isNavigationItemView] && [self isDescendantOfView:hitView]) { - return YES; - } - - return [hitView isDescendantOfView:self]; -} - -- (CGPoint)tappablePointInRect:(CGRect)rect; -{ - // Start at the top and recurse down - CGRect frame = [self.window convertRect:rect fromView:self]; - - UIView *hitView = nil; - CGPoint tapPoint = CGPointZero; - - // Mid point - tapPoint = CGPointCenteredInRect(frame); - hitView = [self.window hitTest:tapPoint withEvent:nil]; - if ([self isTappableWithHitTestResultView:hitView]) { - return [self.window convertPoint:tapPoint toView:self]; - } - - // Top left - tapPoint = CGPointMake(frame.origin.x + 1.0f, frame.origin.y + 1.0f); - hitView = [self.window hitTest:tapPoint withEvent:nil]; - if ([self isTappableWithHitTestResultView:hitView]) { - return [self.window convertPoint:tapPoint toView:self]; - } - - // Top right - tapPoint = CGPointMake(frame.origin.x + frame.size.width - 1.0f, frame.origin.y + 1.0f); - hitView = [self.window hitTest:tapPoint withEvent:nil]; - if ([self isTappableWithHitTestResultView:hitView]) { - return [self.window convertPoint:tapPoint toView:self]; - } - - // Bottom left - tapPoint = CGPointMake(frame.origin.x + 1.0f, frame.origin.y + frame.size.height - 1.0f); - hitView = [self.window hitTest:tapPoint withEvent:nil]; - if ([self isTappableWithHitTestResultView:hitView]) { - return [self.window convertPoint:tapPoint toView:self]; - } - - // Bottom right - tapPoint = CGPointMake(frame.origin.x + frame.size.width - 1.0f, frame.origin.y + frame.size.height - 1.0f); - hitView = [self.window hitTest:tapPoint withEvent:nil]; - if ([self isTappableWithHitTestResultView:hitView]) { - return [self.window convertPoint:tapPoint toView:self]; - } - - return CGPointMake(NAN, NAN); -} - - (UIEvent *)eventWithTouches:(NSArray *)touches { // _touchesEvent is a private selector, interface is exposed in UIApplication(KIFAdditionsPrivate) diff --git a/PlayTools/PlayLoader.m b/PlayTools/PlayLoader.m index ef2a15ba..64fb6940 100644 --- a/PlayTools/PlayLoader.m +++ b/PlayTools/PlayLoader.m @@ -31,13 +31,6 @@ void *my_dyld_get_base_platform(void *platform) { return 2; } -// #define DEVICE_MODEL ("iPad13,8") -//#define DEVICE_MODEL ("iPad8,6") - -// find Mac by using sysctl of HW_TARGET -// #define OEM_ID ("J522AP") -// #define OEM_ID ("J320xAP") - // get device model from playcover .plist #define DEVICE_MODEL ([[[PlaySettings shared] GET_IPAD_MODEL] UTF8String]) #define OEM_ID ([[[PlaySettings shared] GET_OEM_ID] UTF8String]) @@ -112,41 +105,6 @@ static int my_sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void * } } -// Useful for debugging: -// static int my_open(const char *path, int flags, mode_t mode) { -// mode = 0644; -// int value = open(path, flags, mode); -// if (value == -1) { -// printf("[Lucas] open (%s): %s\n", strerror(errno), path); -// } - -// return value; -// } - -// static int my_create(const char *path, mode_t mode) { -// int value = creat(path, mode); -// if (value == -1) { -// printf("[Lucas] create (%s): %s\n", strerror(errno), path); -// } -// return value; -// } - -// static int my_mkdir(const char *path, mode_t mode) { -// int value = mkdir(path, mode); -// if (value == -1) { -// printf("[Lucas] mkdir (%s): %s\n", strerror(errno), path); -// } -// return value; -// } - -// static int my_lstat(const char *restrict path, void *restrict buf) { -// int value = lstat(path, buf); -// if (value == -1) { -// printf("[Lucas] lstat (%s): %s\n", strerror(errno), path); -// } -// return value; -// } - static bool isGenshin = false; extern int csops(pid_t pid, unsigned int ops, void *useraddr, size_t usersize); @@ -164,16 +122,11 @@ int my_csops(pid_t pid, uint32_t ops, user_addr_t useraddr, user_size_t usersize } DYLD_INTERPOSE(my_csops, csops) - DYLD_INTERPOSE(my_dyld_get_active_platform, dyld_get_active_platform) DYLD_INTERPOSE(my_dyld_get_base_platform, dyld_get_base_platform) DYLD_INTERPOSE(my_uname, uname) DYLD_INTERPOSE(my_sysctlbyname, sysctlbyname) DYLD_INTERPOSE(my_sysctl, sysctl) -// DYLD_INTERPOSE(my_open, open) -// DYLD_INTERPOSE(my_mkdir, mkdir) -// DYLD_INTERPOSE(my_create, creat) -// DYLD_INTERPOSE(my_lstat, lstat) @implementation PlayLoader From e3e422b1df55dc1e91cdd6ca1ba500fe31a7e6fb Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sun, 6 Nov 2022 17:55:05 -0500 Subject: [PATCH 2/2] Fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove more PTFakeTouch Remove CGGeometry Reference Fix cursor More cleanup Axe more unused functions Fix warning More unused functions More unused functions Remove OS Version Checks Mac Catalyst on Monterey and Ventura will alwyas be iOS 15+ therefore these platform checks are unnecessary. Remove unnecessary swizzle Remove unused struct Remove more unused structs Remove more functions Remove whitespace Remove UIApplication unused methods Remove more Remove private interfaces from KIF headers Rename folder Whitespace fixes Remove unused swizzle method Whitespace Move script Fix comment Remove unused selectors Comments Change to init swizzle Try again Bump deployment target + remove folder - Removed ‘Recovered References’ Folder - Bump deployment targets to match PlayCover (introduces a couple deprecation warnings) Fix deprecation warnings More cursor disable to AKInterface Remove PTFakeTouch disable cursor Whitespace Remove unnecssary Obj-C Hacks (Needs testing) Seems to work but I don’t entirely understand their original function, so needs to be tested. Remove check (handled by dispatch_once) Remove view specification Whitespace Remove more Remove more Remove more Add back toucher/view cacher Remove unused available checks Simplify PlayLoader - `dyld_get_base_platform` returns PLATFORM_IOS even when passed PLATFORM_IOSMAC - `sysctlbyname` calls `sysctl` under the hood - `csops` Nothing is changed Add comments to PlayLoader Add source Fix compilation error Add back sysctlbyname interpose Fix indentation Remove unused PlayUI Remove unused FileManager extension Remove some unused variables + cleanup --- AKPlugin.swift | 3 + PlayTools.xcodeproj/project.pbxproj | 172 +----- PlayTools/Controls/ControlMode.swift | 2 - PlayTools/Controls/MenuController.swift | 5 +- .../{addition => Additions}/IOHIDEvent+KIF.h | 3 +- .../{addition => Additions}/IOHIDEvent+KIF.m | 60 +- .../Additions/UITouch-KIFAdditions.h | 22 + .../Additions/UITouch-KIFAdditions.m | 106 ++++ .../Controls/PTFakeTouch/FixCategoryBug.h | 33 - .../Controls/PTFakeTouch/NSObject+Swizzle.h | 2 - .../Controls/PTFakeTouch/NSObject+Swizzle.m | 89 +-- .../Controls/PTFakeTouch/PTFakeMetaTouch.h | 13 +- .../Controls/PTFakeTouch/PTFakeMetaTouch.m | 90 +-- .../Controls/PTFakeTouch/UIEvent+Private.h | 1 - .../Controls/PTFakeTouch/UITouch+Private.h | 18 +- .../addition/CGGeometry-KIFAdditions.h | 14 - .../addition/CGGeometry-KIFAdditions.m | 11 - .../PTFakeTouch/addition/LoadableCategory.h | 18 - .../addition/NSPredicate+KIFAdditions.h | 18 - .../addition/NSPredicate+KIFAdditions.m | 72 --- .../addition/NSString+KIFAdditions.h | 16 - .../addition/NSString+KIFAdditions.m | 24 - .../addition/UIApplication-KIFAdditions.h | 99 --- .../addition/UIApplication-KIFAdditions.m | 259 -------- .../addition/UIEvent+KIFAdditions.h | 21 - .../addition/UIEvent+KIFAdditions.m | 94 --- .../addition/UIScreen+KIFAdditions.h | 15 - .../addition/UIScreen+KIFAdditions.m | 17 - .../addition/UITouch-KIFAdditions.h | 47 -- .../addition/UITouch-KIFAdditions.m | 181 ------ .../addition/UIView-KIFAdditions.h | 79 --- .../addition/UIView-KIFAdditions.m | 578 ------------------ .../addition/UIWindow-KIFAdditions.h | 17 - .../addition/UIWindow-KIFAdditions.m | 15 - PlayTools/Controls/PlayInput.swift | 8 +- PlayTools/Controls/PlayMice.swift | 4 +- PlayTools/Controls/Toucher.swift | 1 - PlayTools/Keymap/ControlModel.swift | 2 +- PlayTools/PlayCover.swift | 78 +-- PlayTools/PlayLoader.m | 180 +++--- PlayTools/PlayScreen.swift | 6 +- PlayTools/PlayUI.swift | 26 - 42 files changed, 292 insertions(+), 2227 deletions(-) rename PlayTools/Controls/PTFakeTouch/{addition => Additions}/IOHIDEvent+KIF.h (94%) rename PlayTools/Controls/PTFakeTouch/{addition => Additions}/IOHIDEvent+KIF.m (85%) create mode 100644 PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.h create mode 100644 PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/FixCategoryBug.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/LoadableCategory.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.h delete mode 100644 PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.m delete mode 100644 PlayTools/PlayUI.swift diff --git a/AKPlugin.swift b/AKPlugin.swift index 2f1ce05b..0aa74c3b 100644 --- a/AKPlugin.swift +++ b/AKPlugin.swift @@ -6,6 +6,7 @@ // import AppKit +import CoreGraphics import Foundation class AKPlugin: NSObject, Plugin { @@ -38,10 +39,12 @@ class AKPlugin: NSObject, Plugin { func hideCursor() { NSCursor.hide() + CGAssociateMouseAndMouseCursorPosition(0) } func unhideCursor() { NSCursor.unhide() + CGAssociateMouseAndMouseCursorPosition(1) } func terminateApplication() { diff --git a/PlayTools.xcodeproj/project.pbxproj b/PlayTools.xcodeproj/project.pbxproj index d3b169e3..86e76384 100644 --- a/PlayTools.xcodeproj/project.pbxproj +++ b/PlayTools.xcodeproj/project.pbxproj @@ -18,7 +18,6 @@ AA71970D287A44D200623C15 /* PlaySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719704287A44D200623C15 /* PlaySettings.swift */; }; AA71970E287A44D200623C15 /* PlayLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719705287A44D200623C15 /* PlayLoader.h */; }; AA71970F287A44D200623C15 /* PlayCover.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719706287A44D200623C15 /* PlayCover.swift */; }; - AA719712287A44D200623C15 /* PlayUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719709287A44D200623C15 /* PlayUI.swift */; }; AA719758287A480D00623C15 /* PlayMice.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719722287A480C00623C15 /* PlayMice.swift */; }; AA719759287A480D00623C15 /* PlayAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719723287A480C00623C15 /* PlayAction.swift */; }; AA71975A287A480D00623C15 /* Toucher.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA719724287A480C00623C15 /* Toucher.swift */; }; @@ -34,51 +33,16 @@ AA7197AD287A481500623C15 /* EditorController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979C287A481500623C15 /* EditorController.swift */; }; AA7197AE287A481500623C15 /* DragElementsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979D287A481500623C15 /* DragElementsView.swift */; }; AA7197AF287A481500623C15 /* KeyCodeNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA71979E287A481500623C15 /* KeyCodeNames.swift */; }; - AA719845287A81A000623C15 /* NSBundle+Swizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719816287A819F00623C15 /* NSBundle+Swizzle.m */; }; AA719846287A81A000623C15 /* IOHIDEvent+KIF.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */; }; - AA719847287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */; }; - AA719848287A81A000623C15 /* UIScreen+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */; }; - AA719849287A81A000623C15 /* NSException-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */; }; - AA71984A287A81A000623C15 /* NSString+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */; }; - AA71984B287A81A000623C15 /* UIApplication-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */; }; - AA71984C287A81A000623C15 /* CGGeometry-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */; }; - AA71984D287A81A000623C15 /* UIWindow-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */; }; - AA71984E287A81A000623C15 /* UIScrollView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */; }; - AA71984F287A81A000623C15 /* UIView-Debugging.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719821287A819F00623C15 /* UIView-Debugging.m */; }; AA719850287A81A000623C15 /* UITouch-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */; }; - AA719851287A81A000623C15 /* UITableView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */; }; - AA719852287A81A000623C15 /* NSFileManager-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */; }; - AA719853287A81A000623C15 /* UIView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719825287A819F00623C15 /* UIView-KIFAdditions.h */; }; - AA719854287A81A000623C15 /* UIEvent+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */; }; - AA719855287A81A000623C15 /* CALayer-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */; }; - AA719856287A81A000623C15 /* NSPredicate+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */; }; - AA719857287A81A000623C15 /* UIScrollView-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */; }; - AA719858287A81A000623C15 /* UIWindow-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */; }; - AA719859287A81A000623C15 /* CGGeometry-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */; }; - AA71985A287A81A000623C15 /* UIApplication-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */; }; - AA71985B287A81A000623C15 /* NSString+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */; }; - AA71985C287A81A000623C15 /* NSException-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */; }; - AA71985D287A81A000623C15 /* UIScreen+KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */; }; - AA71985E287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */; }; AA71985F287A81A000623C15 /* IOHIDEvent+KIF.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */; }; - AA719860287A81A000623C15 /* UIView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719832287A819F00623C15 /* UIView-KIFAdditions.m */; }; - AA719861287A81A000623C15 /* NSFileManager-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */; }; AA719862287A81A000623C15 /* UITouch-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */; }; - AA719863287A81A000623C15 /* UITableView-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */; }; - AA719864287A81A000623C15 /* UIView-Debugging.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719836287A819F00623C15 /* UIView-Debugging.h */; }; - AA719865287A81A000623C15 /* UIEvent+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */; }; - AA719866287A81A000623C15 /* LoadableCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719838287A819F00623C15 /* LoadableCategory.h */; }; - AA719867287A81A000623C15 /* NSPredicate+KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */; }; - AA719868287A81A000623C15 /* NSBundle-KIFAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */; }; - AA719869287A81A000623C15 /* CALayer-KIFAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */; }; AA71986A287A81A000623C15 /* PTFakeMetaTouch.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983C287A81A000623C15 /* PTFakeMetaTouch.m */; }; AA71986B287A81A000623C15 /* UIApplication+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983D287A81A000623C15 /* UIApplication+Private.h */; }; AA71986C287A81A000623C15 /* NSObject+Swizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = AA71983E287A81A000623C15 /* NSObject+Swizzle.m */; }; AA71986D287A81A000623C15 /* PTFakeMetaTouch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */; }; AA71986E287A81A000623C15 /* NSObject+Swizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719840287A81A000623C15 /* NSObject+Swizzle.h */; }; - AA71986F287A81A000623C15 /* NSBundle+Swizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719841287A81A000623C15 /* NSBundle+Swizzle.h */; }; AA719870287A81A000623C15 /* UIEvent+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719842287A81A000623C15 /* UIEvent+Private.h */; }; - AA719871287A81A000623C15 /* FixCategoryBug.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719843287A81A000623C15 /* FixCategoryBug.h */; }; AA719872287A81A000623C15 /* UITouch+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = AA719844287A81A000623C15 /* UITouch+Private.h */; }; AA818CB9287ABFB1000BEE9D /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA818CB8287ABFB1000BEE9D /* IOKit.framework */; }; B127172228817AB90025112B /* SwordRPC in Frameworks */ = {isa = PBXBuildFile; productRef = B127172128817AB90025112B /* SwordRPC */; }; @@ -107,7 +71,6 @@ 6E7663A028D0FB5300DE4AF9 /* AKPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AKPlugin.swift; sourceTree = ""; }; 6E7663A428D0FEBE00DE4AF9 /* AKPluginLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AKPluginLoader.swift; sourceTree = ""; }; 6E84A14C28D0F96D00BF7495 /* AKInterface.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AKInterface.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - AA3430B0287AB7F2004E208A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; AA7196D8287A447700623C15 /* PlayTools.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PlayTools.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AA719702287A44D200623C15 /* PlayLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayLoader.m; sourceTree = ""; }; AA719703287A44D200623C15 /* PlayScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayScreen.swift; sourceTree = ""; }; @@ -115,7 +78,6 @@ AA719705287A44D200623C15 /* PlayLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayLoader.h; sourceTree = ""; }; AA719706287A44D200623C15 /* PlayCover.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayCover.swift; sourceTree = ""; }; AA719708287A44D200623C15 /* PlayTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayTools.h; sourceTree = ""; }; - AA719709287A44D200623C15 /* PlayUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayUI.swift; sourceTree = ""; }; AA71970A287A44D200623C15 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AA719722287A480C00623C15 /* PlayMice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayMice.swift; sourceTree = ""; }; AA719723287A480C00623C15 /* PlayAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayAction.swift; sourceTree = ""; }; @@ -132,51 +94,16 @@ AA71979C287A481500623C15 /* EditorController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditorController.swift; sourceTree = ""; }; AA71979D287A481500623C15 /* DragElementsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragElementsView.swift; sourceTree = ""; }; AA71979E287A481500623C15 /* KeyCodeNames.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyCodeNames.swift; sourceTree = ""; }; - AA719816287A819F00623C15 /* NSBundle+Swizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+Swizzle.m"; sourceTree = ""; }; AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IOHIDEvent+KIF.h"; sourceTree = ""; }; - AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAccessibilityElement-KIFAdditions.m"; sourceTree = ""; }; - AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScreen+KIFAdditions.m"; sourceTree = ""; }; - AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSException-KIFAdditions.m"; sourceTree = ""; }; - AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+KIFAdditions.m"; sourceTree = ""; }; - AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication-KIFAdditions.h"; sourceTree = ""; }; - AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CGGeometry-KIFAdditions.m"; sourceTree = ""; }; - AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWindow-KIFAdditions.m"; sourceTree = ""; }; - AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView-KIFAdditions.m"; sourceTree = ""; }; - AA719821287A819F00623C15 /* UIView-Debugging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView-Debugging.m"; sourceTree = ""; }; AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITouch-KIFAdditions.m"; sourceTree = ""; }; - AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView-KIFAdditions.h"; sourceTree = ""; }; - AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFileManager-KIFAdditions.h"; sourceTree = ""; }; - AA719825287A819F00623C15 /* UIView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView-KIFAdditions.h"; sourceTree = ""; }; - AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEvent+KIFAdditions.h"; sourceTree = ""; }; - AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer-KIFAdditions.h"; sourceTree = ""; }; - AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+KIFAdditions.h"; sourceTree = ""; }; - AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView-KIFAdditions.h"; sourceTree = ""; }; - AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow-KIFAdditions.h"; sourceTree = ""; }; - AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CGGeometry-KIFAdditions.h"; sourceTree = ""; }; - AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIApplication-KIFAdditions.m"; sourceTree = ""; }; - AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+KIFAdditions.h"; sourceTree = ""; }; - AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSException-KIFAdditions.h"; sourceTree = ""; }; - AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScreen+KIFAdditions.h"; sourceTree = ""; }; - AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAccessibilityElement-KIFAdditions.h"; sourceTree = ""; }; AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "IOHIDEvent+KIF.m"; sourceTree = ""; }; - AA719832287A819F00623C15 /* UIView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView-KIFAdditions.m"; sourceTree = ""; }; - AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileManager-KIFAdditions.m"; sourceTree = ""; }; AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch-KIFAdditions.h"; sourceTree = ""; }; - AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView-KIFAdditions.m"; sourceTree = ""; }; - AA719836287A819F00623C15 /* UIView-Debugging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView-Debugging.h"; sourceTree = ""; }; - AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIEvent+KIFAdditions.m"; sourceTree = ""; }; - AA719838287A819F00623C15 /* LoadableCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableCategory.h; sourceTree = ""; }; - AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSPredicate+KIFAdditions.m"; sourceTree = ""; }; - AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle-KIFAdditions.h"; sourceTree = ""; }; - AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer-KIFAdditions.m"; sourceTree = ""; }; AA71983C287A81A000623C15 /* PTFakeMetaTouch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PTFakeMetaTouch.m; sourceTree = ""; }; AA71983D287A81A000623C15 /* UIApplication+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIApplication+Private.h"; sourceTree = ""; }; AA71983E287A81A000623C15 /* NSObject+Swizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Swizzle.m"; sourceTree = ""; }; AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PTFakeMetaTouch.h; sourceTree = ""; }; AA719840287A81A000623C15 /* NSObject+Swizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Swizzle.h"; sourceTree = ""; }; - AA719841287A81A000623C15 /* NSBundle+Swizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+Swizzle.h"; sourceTree = ""; }; AA719842287A81A000623C15 /* UIEvent+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIEvent+Private.h"; sourceTree = ""; }; - AA719843287A81A000623C15 /* FixCategoryBug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FixCategoryBug.h; sourceTree = ""; }; AA719844287A81A000623C15 /* UITouch+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch+Private.h"; sourceTree = ""; }; AA818CB8287ABFB1000BEE9D /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/IOKit.framework; sourceTree = DEVELOPER_DIR; }; AA818CBA287ABFD5000BEE9D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; @@ -222,7 +149,6 @@ AA7196DA287A447700623C15 /* PlayTools */, 6E76639928D0FA6F00DE4AF9 /* AKInterface */, AA7196D9287A447700623C15 /* Products */, - AA818CB6287ABFA7000BEE9D /* Recovered References */, AA818CB7287ABFB1000BEE9D /* Frameworks */, ); sourceTree = ""; @@ -248,7 +174,6 @@ AA719706287A44D200623C15 /* PlayCover.swift */, AA719703287A44D200623C15 /* PlayScreen.swift */, AA719704287A44D200623C15 /* PlaySettings.swift */, - AA719709287A44D200623C15 /* PlayUI.swift */, AA719705287A44D200623C15 /* PlayLoader.h */, AA719702287A44D200623C15 /* PlayLoader.m */, AA719708287A44D200623C15 /* PlayTools.h */, @@ -305,10 +230,7 @@ AA719813287A813A00623C15 /* PTFakeTouch */ = { isa = PBXGroup; children = ( - AA719817287A819F00623C15 /* addition */, - AA719843287A81A000623C15 /* FixCategoryBug.h */, - AA719841287A81A000623C15 /* NSBundle+Swizzle.h */, - AA719816287A819F00623C15 /* NSBundle+Swizzle.m */, + AA719817287A819F00623C15 /* Additions */, AA719840287A81A000623C15 /* NSObject+Swizzle.h */, AA71983E287A81A000623C15 /* NSObject+Swizzle.m */, AA71983F287A81A000623C15 /* PTFakeMetaTouch.h */, @@ -320,55 +242,15 @@ path = PTFakeTouch; sourceTree = ""; }; - AA719817287A819F00623C15 /* addition */ = { + AA719817287A819F00623C15 /* Additions */ = { isa = PBXGroup; children = ( AA719818287A819F00623C15 /* IOHIDEvent+KIF.h */, - AA719819287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.m */, - AA71981A287A819F00623C15 /* UIScreen+KIFAdditions.m */, - AA71981B287A819F00623C15 /* NSException-KIFAdditions.m */, - AA71981C287A819F00623C15 /* NSString+KIFAdditions.m */, - AA71981D287A819F00623C15 /* UIApplication-KIFAdditions.h */, - AA71981E287A819F00623C15 /* CGGeometry-KIFAdditions.m */, - AA71981F287A819F00623C15 /* UIWindow-KIFAdditions.m */, - AA719820287A819F00623C15 /* UIScrollView-KIFAdditions.m */, - AA719821287A819F00623C15 /* UIView-Debugging.m */, - AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */, - AA719823287A819F00623C15 /* UITableView-KIFAdditions.h */, - AA719824287A819F00623C15 /* NSFileManager-KIFAdditions.h */, - AA719825287A819F00623C15 /* UIView-KIFAdditions.h */, - AA719826287A819F00623C15 /* UIEvent+KIFAdditions.h */, - AA719827287A819F00623C15 /* CALayer-KIFAdditions.h */, - AA719828287A819F00623C15 /* NSPredicate+KIFAdditions.h */, - AA719829287A819F00623C15 /* UIScrollView-KIFAdditions.h */, - AA71982A287A819F00623C15 /* UIWindow-KIFAdditions.h */, - AA71982B287A819F00623C15 /* CGGeometry-KIFAdditions.h */, - AA71982C287A819F00623C15 /* UIApplication-KIFAdditions.m */, - AA71982D287A819F00623C15 /* NSString+KIFAdditions.h */, - AA71982E287A819F00623C15 /* NSException-KIFAdditions.h */, - AA71982F287A819F00623C15 /* UIScreen+KIFAdditions.h */, - AA719830287A819F00623C15 /* UIAccessibilityElement-KIFAdditions.h */, AA719831287A819F00623C15 /* IOHIDEvent+KIF.m */, - AA719832287A819F00623C15 /* UIView-KIFAdditions.m */, - AA719833287A819F00623C15 /* NSFileManager-KIFAdditions.m */, AA719834287A819F00623C15 /* UITouch-KIFAdditions.h */, - AA719835287A819F00623C15 /* UITableView-KIFAdditions.m */, - AA719836287A819F00623C15 /* UIView-Debugging.h */, - AA719837287A819F00623C15 /* UIEvent+KIFAdditions.m */, - AA719838287A819F00623C15 /* LoadableCategory.h */, - AA719839287A819F00623C15 /* NSPredicate+KIFAdditions.m */, - AA71983A287A819F00623C15 /* NSBundle-KIFAdditions.h */, - AA71983B287A819F00623C15 /* CALayer-KIFAdditions.m */, - ); - path = addition; - sourceTree = ""; - }; - AA818CB6287ABFA7000BEE9D /* Recovered References */ = { - isa = PBXGroup; - children = ( - AA3430B0287AB7F2004E208A /* UIKit.framework */, + AA719822287A819F00623C15 /* UITouch-KIFAdditions.m */, ); - name = "Recovered References"; + path = Additions; sourceTree = ""; }; AA818CB7287ABFB1000BEE9D /* Frameworks */ = { @@ -397,32 +279,13 @@ buildActionMask = 2147483647; files = ( AA71986E287A81A000623C15 /* NSObject+Swizzle.h in Headers */, - AA719871287A81A000623C15 /* FixCategoryBug.h in Headers */, - AA719853287A81A000623C15 /* UIView-KIFAdditions.h in Headers */, - AA71985E287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.h in Headers */, AA719846287A81A000623C15 /* IOHIDEvent+KIF.h in Headers */, - AA71985C287A81A000623C15 /* NSException-KIFAdditions.h in Headers */, - AA719852287A81A000623C15 /* NSFileManager-KIFAdditions.h in Headers */, - AA719855287A81A000623C15 /* CALayer-KIFAdditions.h in Headers */, AA719862287A81A000623C15 /* UITouch-KIFAdditions.h in Headers */, AA71986B287A81A000623C15 /* UIApplication+Private.h in Headers */, AA71986D287A81A000623C15 /* PTFakeMetaTouch.h in Headers */, - AA71984B287A81A000623C15 /* UIApplication-KIFAdditions.h in Headers */, AA719870287A81A000623C15 /* UIEvent+Private.h in Headers */, - AA719854287A81A000623C15 /* UIEvent+KIFAdditions.h in Headers */, AA71970E287A44D200623C15 /* PlayLoader.h in Headers */, - AA719856287A81A000623C15 /* NSPredicate+KIFAdditions.h in Headers */, - AA71986F287A81A000623C15 /* NSBundle+Swizzle.h in Headers */, - AA719851287A81A000623C15 /* UITableView-KIFAdditions.h in Headers */, AA719872287A81A000623C15 /* UITouch+Private.h in Headers */, - AA719866287A81A000623C15 /* LoadableCategory.h in Headers */, - AA719858287A81A000623C15 /* UIWindow-KIFAdditions.h in Headers */, - AA719857287A81A000623C15 /* UIScrollView-KIFAdditions.h in Headers */, - AA71985B287A81A000623C15 /* NSString+KIFAdditions.h in Headers */, - AA71985D287A81A000623C15 /* UIScreen+KIFAdditions.h in Headers */, - AA719864287A81A000623C15 /* UIView-Debugging.h in Headers */, - AA719868287A81A000623C15 /* NSBundle-KIFAdditions.h in Headers */, - AA719859287A81A000623C15 /* CGGeometry-KIFAdditions.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -562,35 +425,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - AA719848287A81A000623C15 /* UIScreen+KIFAdditions.m in Sources */, - AA71984C287A81A000623C15 /* CGGeometry-KIFAdditions.m in Sources */, - AA719869287A81A000623C15 /* CALayer-KIFAdditions.m in Sources */, AA71975A287A480D00623C15 /* Toucher.swift in Sources */, - AA71984A287A81A000623C15 /* NSString+KIFAdditions.m in Sources */, AA7197A1287A481500623C15 /* CircleMenuLoader.swift in Sources */, 6E76639B28D0FAE700DE4AF9 /* Plugin.swift in Sources */, B1271729288284BE0025112B /* DiscordActivity.swift in Sources */, - AA71984E287A81A000623C15 /* UIScrollView-KIFAdditions.m in Sources */, - AA719849287A81A000623C15 /* NSException-KIFAdditions.m in Sources */, AA7197AB287A481500623C15 /* ControlModel.swift in Sources */, AA7197AE287A481500623C15 /* DragElementsView.swift in Sources */, AA71970D287A44D200623C15 /* PlaySettings.swift in Sources */, - AA71984F287A81A000623C15 /* UIView-Debugging.m in Sources */, AA719759287A480D00623C15 /* PlayAction.swift in Sources */, - AA719847287A81A000623C15 /* UIAccessibilityElement-KIFAdditions.m in Sources */, - AA71984D287A81A000623C15 /* UIWindow-KIFAdditions.m in Sources */, 6E7663A528D0FEBE00DE4AF9 /* AKPluginLoader.swift in Sources */, - AA719867287A81A000623C15 /* NSPredicate+KIFAdditions.m in Sources */, - AA719845287A81A000623C15 /* NSBundle+Swizzle.m in Sources */, AA7197A2287A481500623C15 /* CircleMenu.swift in Sources */, AA71978B287A480D00623C15 /* MenuController.swift in Sources */, - AA719863287A81A000623C15 /* UITableView-KIFAdditions.m in Sources */, AA7197AA287A481500623C15 /* Toast.swift in Sources */, AA719789287A480D00623C15 /* PlayInput.swift in Sources */, - AA719865287A81A000623C15 /* UIEvent+KIFAdditions.m in Sources */, AA71970B287A44D200623C15 /* PlayLoader.m in Sources */, - AA719712287A44D200623C15 /* PlayUI.swift in Sources */, - AA719860287A81A000623C15 /* UIView-KIFAdditions.m in Sources */, AA7197AF287A481500623C15 /* KeyCodeNames.swift in Sources */, AA71978A287A480D00623C15 /* ControlMode.swift in Sources */, AA719758287A480D00623C15 /* PlayMice.swift in Sources */, @@ -604,9 +452,7 @@ B127172528817C040025112B /* DiscordIPC.swift in Sources */, AA719850287A81A000623C15 /* UITouch-KIFAdditions.m in Sources */, AA71985F287A81A000623C15 /* IOHIDEvent+KIF.m in Sources */, - AA719861287A81A000623C15 /* NSFileManager-KIFAdditions.m in Sources */, B1E8CF8A28BBE2AB004340D3 /* Keymapping.swift in Sources */, - AA71985A287A81A000623C15 /* UIApplication-KIFAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -632,7 +478,7 @@ "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.3; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = io.playcover.AKInterface; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -664,7 +510,7 @@ "@executable_path/../Frameworks", "@loader_path/../Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 12.3; + MACOSX_DEPLOYMENT_TARGET = 12.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = io.playcover.AKInterface; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -728,7 +574,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -785,7 +632,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 14.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MACOSX_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; diff --git a/PlayTools/Controls/ControlMode.swift b/PlayTools/Controls/ControlMode.swift index 6b032e4b..35661efb 100644 --- a/PlayTools/Controls/ControlMode.swift +++ b/PlayTools/Controls/ControlMode.swift @@ -21,7 +21,6 @@ public class ControlMode { } if PlaySettings.shared.mouseMapping { AKInterface.shared!.unhideCursor() - disableCursor(1) } PlayInput.shared.invalidate() } @@ -29,7 +28,6 @@ public class ControlMode { if visible { if PlaySettings.shared.mouseMapping { AKInterface.shared!.hideCursor() - disableCursor(0) } if screen.fullscreen { screen.switchDock(false) diff --git a/PlayTools/Controls/MenuController.swift b/PlayTools/Controls/MenuController.swift index 10d34a23..3ec96d13 100644 --- a/PlayTools/Controls/MenuController.swift +++ b/PlayTools/Controls/MenuController.swift @@ -75,12 +75,9 @@ var keymappingSelectors = [#selector(UIApplication.switchEditorMode(_:)), class MenuController { init(with builder: UIMenuBuilder) { - if #available(iOS 15.0, *) { - builder.insertSibling(MenuController.keymappingMenu(), afterMenu: .view) - } + builder.insertSibling(MenuController.keymappingMenu(), afterMenu: .view) } - @available(iOS 15.0, *) class func keymappingMenu() -> UIMenu { let keyCommands = [ "K", UIKeyCommand.inputDelete, UIKeyCommand.inputUpArrow, UIKeyCommand.inputDownArrow, "R" ] diff --git a/PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.h b/PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.h similarity index 94% rename from PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.h rename to PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.h index b800c733..18ab3234 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.h +++ b/PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.h @@ -6,6 +6,5 @@ // Copyright © 2016年 PugaTang. All rights reserved. // - typedef struct __IOHIDEvent * IOHIDEventRef; -IOHIDEventRef kif_IOHIDEventWithTouches(NSArray *touches) CF_RETURNS_RETAINED; \ No newline at end of file +IOHIDEventRef kif_IOHIDEventWithTouches(NSArray *touches) CF_RETURNS_RETAINED; diff --git a/PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.m b/PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.m similarity index 85% rename from PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.m rename to PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.m index 444bb7c0..d4628564 100644 --- a/PlayTools/Controls/PTFakeTouch/addition/IOHIDEvent+KIF.m +++ b/PlayTools/Controls/PTFakeTouch/Additions/IOHIDEvent+KIF.m @@ -24,12 +24,15 @@ void IOHIDEventSetIntegerValue(IOHIDEventRef event, IOHIDEventField field, int value); void IOHIDEventSetSenderID(IOHIDEventRef event, uint64_t sender); +// Derived from https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/IOHIDEventTypes.h + enum { kIOHIDDigitizerTransducerTypeStylus = 0, kIOHIDDigitizerTransducerTypePuck, kIOHIDDigitizerTransducerTypeFinger, kIOHIDDigitizerTransducerTypeHand }; + enum { kIOHIDEventTypeNULL, // 0 kIOHIDEventTypeVendorDefined, @@ -54,7 +57,7 @@ kIOHIDEventTypeGyro, // 20 kIOHIDEventTypeCompass, kIOHIDEventTypeZoomToggle, - kIOHIDEventTypeDockSwipe, // just like kIOHIDEventTypeNavigationSwipe, but intended for consumption by Dock + kIOHIDEventTypeDockSwipe, // Just like kIOHIDEventTypeNavigationSwipe, but intended for consumption by Dock kIOHIDEventTypeSymbolicHotKey, kIOHIDEventTypePower, // 25 kIOHIDEventTypeLED, @@ -65,27 +68,34 @@ kIOHIDEventTypeAtmosphericPressure, kIOHIDEventTypeUndefined, kIOHIDEventTypeCount, // This should always be last + // DEPRECATED: kIOHIDEventTypeSwipe = kIOHIDEventTypeNavigationSwipe, kIOHIDEventTypeMouse = kIOHIDEventTypePointer }; + enum { - kIOHIDDigitizerEventRange = 0x00000001, - kIOHIDDigitizerEventTouch = 0x00000002, - kIOHIDDigitizerEventPosition = 0x00000004, - kIOHIDDigitizerEventStop = 0x00000008, - kIOHIDDigitizerEventPeak = 0x00000010, - kIOHIDDigitizerEventIdentity = 0x00000020, - kIOHIDDigitizerEventAttribute = 0x00000040, - kIOHIDDigitizerEventCancel = 0x00000080, - kIOHIDDigitizerEventStart = 0x00000100, - kIOHIDDigitizerEventResting = 0x00000200, - kIOHIDDigitizerEventSwipeUp = 0x01000000, - kIOHIDDigitizerEventSwipeDown = 0x02000000, - kIOHIDDigitizerEventSwipeLeft = 0x04000000, - kIOHIDDigitizerEventSwipeRight = 0x08000000, - kIOHIDDigitizerEventSwipeMask = 0xFF000000, + kIOHIDDigitizerEventRange = 1<<0, + kIOHIDDigitizerEventTouch = 1<<1, + kIOHIDDigitizerEventPosition = 1<<2, + kIOHIDDigitizerEventStop = 1<<3, + kIOHIDDigitizerEventPeak = 1<<4, + kIOHIDDigitizerEventIdentity = 1<<5, + kIOHIDDigitizerEventAttribute = 1<<6, + kIOHIDDigitizerEventCancel = 1<<7, + kIOHIDDigitizerEventStart = 1<<8, + kIOHIDDigitizerEventResting = 1<<9, + kIOHIDDigitizerEventFromEdgeFlat = 1<<10, + kIOHIDDigitizerEventFromEdgeTip = 1<<11, + kIOHIDDigitizerEventFromCorner = 1<<12, + kIOHIDDigitizerEventSwipePending = 1<<13, + kIOHIDDigitizerEventSwipeUp = 1<<24, + kIOHIDDigitizerEventSwipeDown = 1<<25, + kIOHIDDigitizerEventSwipeLeft = 1<<26, + kIOHIDDigitizerEventSwipeRight = 1<<27, + kIOHIDDigitizerEventSwipeMask = 0xFF<<24, }; + enum { kIOHIDEventFieldDigitizerX = IOHIDEventFieldBase(kIOHIDEventTypeDigitizer), kIOHIDEventFieldDigitizerY, @@ -98,7 +108,7 @@ kIOHIDEventFieldDigitizerRange, kIOHIDEventFieldDigitizerTouch, kIOHIDEventFieldDigitizerPressure, - kIOHIDEventFieldDigitizerAuxiliaryPressure, //BarrelPressure + kIOHIDEventFieldDigitizerAuxiliaryPressure, // BarrelPressure kIOHIDEventFieldDigitizerTwist, kIOHIDEventFieldDigitizerTiltX, kIOHIDEventFieldDigitizerTiltY, @@ -115,18 +125,18 @@ kIOHIDEventFieldDigitizerIsDisplayIntegrated, kIOHIDEventFieldDigitizerQualityRadiiAccuracy, }; + IOHIDEventRef IOHIDEventCreateDigitizerEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, IOHIDDigitizerTransducerType type, uint32_t index, uint32_t identity, uint32_t eventMask, uint32_t buttonMask, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat barrelPressure, Boolean range, Boolean touch, IOOptionBits options); + IOHIDEventRef IOHIDEventCreateDigitizerFingerEventWithQuality(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint32_t index, uint32_t identity, uint32_t eventMask, IOHIDFloat x, IOHIDFloat y, IOHIDFloat z, IOHIDFloat tipPressure, IOHIDFloat twist, IOHIDFloat minorRadius, IOHIDFloat majorRadius, IOHIDFloat quality, IOHIDFloat density, IOHIDFloat irregularity, Boolean range, Boolean touch, IOOptionBits options); - - IOHIDEventRef kif_IOHIDEventWithTouches(NSArray *touches) { uint64_t abTime = mach_absolute_time(); AbsoluteTime timeStamp; @@ -148,8 +158,8 @@ IOHIDEventRef kif_IOHIDEventWithTouches(NSArray *touches) { true, // touch 0); // options IOHIDEventSetIntegerValue(handEvent, kIOHIDEventFieldDigitizerIsDisplayIntegrated, true); - for (UITouch *touch in touches) - { + + for (UITouch *touch in touches) { uint32_t eventMask = (touch.phase == UITouchPhaseMoved) ? kIOHIDDigitizerEventPosition : (kIOHIDDigitizerEventRange | kIOHIDDigitizerEventTouch); uint32_t isTouching = (touch.phase == UITouchPhaseEnded) ? 0 : 1; CGPoint touchLocation = [touch locationInView:touch.window]; @@ -177,11 +187,3 @@ IOHIDEventRef kif_IOHIDEventWithTouches(NSArray *touches) { } return handEvent; } - - - - - - - - diff --git a/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.h new file mode 100644 index 00000000..bada64eb --- /dev/null +++ b/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.h @@ -0,0 +1,22 @@ +// +// UITouch-KIFAdditions.h +// KIF +// +// Created by Eric Firestone on 5/20/11. +// Licensed to Square, Inc. under one or more contributor license agreements. +// See the LICENSE file distributed with this work for the terms under +// which Square, Inc. licenses this file to you. + +#import +#import "IOHIDEvent+KIF.h" +#import "UITouch+Private.h" + +@interface UITouch (KIFAdditions) + +- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window onView:(UIView*)view; +- (id)initTouch; + +- (void)setLocationInWindow:(CGPoint)location; +- (void)setPhaseAndUpdateTimestamp:(UITouchPhase)phase; + +@end diff --git a/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.m new file mode 100644 index 00000000..4776716a --- /dev/null +++ b/PlayTools/Controls/PTFakeTouch/Additions/UITouch-KIFAdditions.m @@ -0,0 +1,106 @@ +// +// UITouch-KIFAdditions.m +// KIF +// +// Created by Eric Firestone on 5/20/11. +// Licensed to Square, Inc. under one or more contributor license agreements. +// See the LICENSE file distributed with this work for the terms under +// which Square, Inc. licenses this file to you. + +#import "UITouch-KIFAdditions.h" +#import +#import "PTFakeMetaTouch.h" + +@implementation UITouch (KIFAdditions) + +- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window onView:(UIView*)view; +{ + self = [super init]; + if (self == nil) { + return nil; + } + + // Create a fake tap touch + [self setWindow:window]; // Wipes out some values. Needs to be first. + + [self _setLocationInWindow:point resetPrevious:YES]; + + UIView *hitTestView = view; + + [self setView:hitTestView]; + [self setPhase:UITouchPhaseBegan]; + if (![[NSProcessInfo processInfo] isiOSAppOnMac] && ![[NSProcessInfo processInfo] isMacCatalystApp]) { + [self _setIsTapToClick:NO]; + } else { + [self _setIsFirstTouchForView:YES]; + [self setIsTap:NO]; + } + [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; + if ([self respondsToSelector:@selector(setGestureView:)]) { + [self setGestureView:hitTestView]; + } + + [self kif_setHidEvent]; + return self; +} + +- (id)initTouch; +{ + //DLog(@"init...touch..."); + self = [super init]; + if (self == nil) { + return nil; + } + NSArray *scenes = [[[UIApplication sharedApplication] connectedScenes] allObjects]; + NSArray *windows = [[scenes objectAtIndex:0] windows]; + UIWindow *window = [windows lastObject]; + CGPoint point = CGPointMake(0, 0); + [self setWindow:window]; // Wipes out some values. Needs to be first. + + [self _setLocationInWindow:point resetPrevious:YES]; + + UIView *hitTestView = [window hitTest:point withEvent:nil]; + + [self setView:hitTestView]; + [self setPhase:UITouchPhaseEnded]; + //DLog(@"init...touch...setPhase 3"); + if (![[NSProcessInfo processInfo] isiOSAppOnMac] && ![[NSProcessInfo processInfo] isMacCatalystApp]) { + [self _setIsTapToClick:NO]; + } else { + [self _setIsFirstTouchForView:YES]; + [self setIsTap:NO]; + } + [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; + if ([self respondsToSelector:@selector(setGestureView:)]) { + [self setGestureView:hitTestView]; + } + + [self kif_setHidEvent]; + return self; +} + +// +// setLocationInWindow: +// +// Setter to allow access to the _locationInWindow member. +// +- (void)setLocationInWindow:(CGPoint)location +{ + [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; + [self _setLocationInWindow:location resetPrevious:NO]; +} + +- (void)setPhaseAndUpdateTimestamp:(UITouchPhase)phase +{ + //DLog(@"setPhaseAndUpdateTimestamp : %ld",(long)phase); + [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; + [self setPhase:phase]; +} + +- (void)kif_setHidEvent { + IOHIDEventRef event = kif_IOHIDEventWithTouches(@[self]); + [self _setHidEvent:event]; + CFRelease(event); +} + +@end diff --git a/PlayTools/Controls/PTFakeTouch/FixCategoryBug.h b/PlayTools/Controls/PTFakeTouch/FixCategoryBug.h deleted file mode 100644 index 46bdeb92..00000000 --- a/PlayTools/Controls/PTFakeTouch/FixCategoryBug.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// FixCategoryBug.h -// FakeTouch -// -// Created by PugaTang on 16/4/7. -// Copyright © 2016年 PugaTang. All rights reserved. -// - -#ifndef MainLib_FixCategoryBug_h -#define MainLib_FixCategoryBug_h - -#define __kw_to_string_1(x) #x -#define __kw_to_string(x) __kw_to_string_1(x) - -// 需要在有category的头文件中调用,例如 KW_FIX_CATEGORY_BUG_H(NSString_Extented) -#define KW_FIX_CATEGORY_BUG_H(name) \ -@interface KW_FIX_CATEGORY_BUG_##name : NSObject \ -+(void)print; \ -@end - -// 需要在有category的源文件中调用,例如 KW_FIX_CATEGORY_BUG_M(NSString_Extented) -#define KW_FIX_CATEGORY_BUG_M(name) \ -@implementation KW_FIX_CATEGORY_BUG_##name \ -+ (void)print { \ -NSLog(@"[Enable]"); \ -} \ -@end \ - - -// 在target中启用这个宏,其实就是调用下category中定义的类的print方法。 -#define KW_ENABLE_CATEGORY(name) [KW_FIX_CATEGORY_BUG_##name print] - -#endif \ No newline at end of file diff --git a/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.h b/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.h index b4414de9..1142c7a4 100644 --- a/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.h +++ b/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.h @@ -11,9 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface NSObject (Swizzle) -+ (void)swizzleClassMethod:(SEL)origSelector withMethod:(SEL)newSelector; - (void)swizzleInstanceMethod:(SEL)origSelector withMethod:(SEL)newSelector; -- (void)isMethodExists:(SEL)origSelector; @end diff --git a/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.m b/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.m index d8cb36e0..3526f0c7 100644 --- a/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.m +++ b/PlayTools/Controls/PTFakeTouch/NSObject+Swizzle.m @@ -12,60 +12,29 @@ #import #import "PTFakeMetaTouch.h" - @implementation NSObject (Swizzle) -+ (void)swizzleClassMethod:(SEL)origSelector withMethod:(SEL)newSelector +- (void) swizzleInstanceMethod:(SEL)origSelector withMethod:(SEL)newSelector { Class cls = [self class]; - - Method originalMethod = class_getClassMethod(cls, origSelector); - Method swizzledMethod = class_getClassMethod(cls, newSelector); - - Class metacls = objc_getMetaClass(NSStringFromClass(cls).UTF8String); - if (class_addMethod(metacls, - origSelector, - method_getImplementation(swizzledMethod), - method_getTypeEncoding(swizzledMethod)) ) { - /* swizzing super class method, added if not exist */ - class_replaceMethod(metacls, - newSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)); - - } else { - /* swizzleMethod maybe belong to super */ - class_replaceMethod(metacls, - newSelector, - class_replaceMethod(metacls, - origSelector, - method_getImplementation(swizzledMethod), - method_getTypeEncoding(swizzledMethod)), - method_getTypeEncoding(originalMethod)); - } -} - -- (void)swizzleInstanceMethod:(SEL)origSelector withMethod:(SEL)newSelector -{ - Class cls = [self class]; - /* if current class not exist selector, then get super*/ + // If current class doesn't exist selector, then get super Method originalMethod = class_getInstanceMethod(cls, origSelector); Method swizzledMethod = class_getInstanceMethod(cls, newSelector); - /* add selector if not exist, implement append with method */ + // Add selector if it doesn't exist, implement append with method if (class_addMethod(cls, origSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)) ) { - /* replace class instance method, added if selector not exist */ - /* for class cluster , it always add new selector here */ + // Replace class instance method, added if selector not exist + // For class cluster, it always adds new selector here class_replaceMethod(cls, newSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); } else { - /* swizzleMethod maybe belong to super */ + // SwizzleMethod maybe belongs to super class_replaceMethod(cls, newSelector, class_replaceMethod(cls, @@ -76,54 +45,27 @@ - (void)swizzleInstanceMethod:(SEL)origSelector withMethod:(SEL)newSelector } } - -+(void)load ++ (void) load { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ // TODO: UINSview - if ([[PlaySettings shared] adaptiveDisplay]){ + if ([[PlaySettings shared] adaptiveDisplay]) { [objc_getClass("FBSSceneSettings") swizzleInstanceMethod:@selector(frame) withMethod:@selector(hook_frame)]; [objc_getClass("FBSSceneSettings") swizzleInstanceMethod:@selector(bounds) withMethod:@selector(hook_bounds)]; [objc_getClass("FBSDisplayMode") swizzleInstanceMethod:@selector(size) withMethod:@selector(hook_size)]; } - [objc_getClass("NSMenuItem") swizzleClassMethod:@selector(enabled) withMethod:@selector(hook_enabled)]; - [objc_getClass("IOSViewController") swizzleInstanceMethod:@selector(prefersPointerLocked) withMethod:@selector(hook_prefersPointerLocked)]; - - if ([[[NSBundle mainBundle] bundleIdentifier] isEqual:@"com.riotgames.league.wildrift"] || [[[NSBundle mainBundle] bundleIdentifier] isEqual:@"com.tencent.lolm"]){ - [objc_getClass("MTLRenderPipelineDescriptorInternal") swizzleInstanceMethod:@selector(validateWithDevice:error:) withMethod:@selector(hook_validateWithDevice:error:)]; - [objc_getClass("MTLRenderPipelineDescriptorInternal") swizzleInstanceMethod:@selector(depthStencilPixelformat) withMethod:@selector(hook_depthAttachmentPixelFormat)]; - [objc_getClass("MTLRenderPipelineDescriptorInternal") swizzleInstanceMethod:@selector(stencilAttachmentPixelFormat) withMethod:@selector(hook_stencilAttachmentPixelFormat)]; - } - - + [self swizzleInstanceMethod:@selector(init) withMethod:@selector(hook_init)]; }); } --(BOOL) hook_prefersPointerLocked { +- (BOOL) hook_prefersPointerLocked { return false; } -- (MTLPixelFormat) hook_stencilAttachmentPixelFormat { - return MTLPixelFormatDepth32Float; -} - -- (MTLPixelFormat) hook_depthAttachmentPixelFormat { - return MTLPixelFormatDepth32Float; -} - --(BOOL) hook_enabled { - printf("NSMenuCall"); - return true; -} - --(BOOL)hook_validateWithDevice:(id)arg1 error:(id*)arg2 { - return true; -} - - (CGRect) hook_frame { return [PlayScreen frame:[self hook_frame]]; } @@ -136,14 +78,9 @@ - (CGSize) hook_size { return [PlayScreen sizeAspectRatio:[self hook_size]]; } -bool menuWasCreated = false; - --(id)init { - if (!menuWasCreated) { - if ([[self class] isEqual: NSClassFromString(@"_UIMenuBuilder")]) { - [PlayCover initMenuWithMenu: self]; - menuWasCreated = TRUE; - } +- (id) hook_init { + if ([[self class] isEqual: NSClassFromString(@"_UIMenuBuilder")]) { + [PlayCover initMenuWithMenu: self]; } return self; diff --git a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h index 9ac39168..62dca6f9 100644 --- a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h +++ b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.h @@ -9,13 +9,8 @@ #import #import -typedef struct { - unsigned char r, g, b; -} RGB; - -double ColourDistance(RGB e1, RGB e2); - @interface PTFakeMetaTouch : NSObject + + (void)load; + (UITouch* ) touch: (NSInteger) pointId; @@ -32,9 +27,5 @@ double ColourDistance(RGB e1, RGB e2); */ + (NSInteger)fakeTouchId:(NSInteger)pointId AtPoint:(CGPoint)point withTouchPhase:(UITouchPhase)phase inWindow:(UIWindow*)window onView:(UIView*)view; -/** - * Get a not used pointId 获取一个没有使用过的触屏序列号 obtain a never used touch screen sequence number - * - * @return pointId 返回序列号 returns sequence number - */ + @end diff --git a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.m b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.m index ac04c75c..19088100 100644 --- a/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.m +++ b/PlayTools/Controls/PTFakeTouch/PTFakeMetaTouch.m @@ -8,8 +8,8 @@ #import "PTFakeMetaTouch.h" #import "UITouch-KIFAdditions.h" -#import "UIApplication-KIFAdditions.h" -#import "UIEvent+KIFAdditions.h" +#import "UIApplication+Private.h" +#import "UIEvent+Private.h" #import "CoreFoundation/CFRunLoop.h" #include #include @@ -21,50 +21,6 @@ static UITouch* toRemove = NULL, *toStationarify = NULL; NSArray *safeTouchAry; -void disableCursor(boolean_t disable){ - void *handle; - void (*test)(boolean_t); - char *error; - - handle = dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics", RTLD_LAZY); - if (!handle) { - fprintf(stderr, "%s\n", dlerror()); - } - - dlerror(); - - *(void **) (&test) = dlsym(handle, "CGAssociateMouseAndMouseCursorPosition"); - - if ((error = dlerror()) != NULL) { - - } else{ - (*test)(disable); - dlclose(handle); - } -} - -void moveCursorTo(CGPoint point){ - void *handle; - void (*test)(CGPoint); - char *error; - - handle = dlopen("/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics", RTLD_LAZY); - if (!handle) { - fprintf(stderr, "%s\n", dlerror()); - } - - dlerror(); - - *(void **) (&test) = dlsym(handle, "CGWarpMouseCursorPosition"); - - if ((error = dlerror()) != NULL) { - - } else{ - (*test)(point); - dlclose(handle); - } -} - void eventSendCallback(void* info) { UIEvent *event = [[UIApplication sharedApplication] _touchesEvent]; // to retain objects from being released @@ -77,7 +33,6 @@ void eventSendCallback(void* info) { toRemove = aTouch; break; case UITouchPhaseBegan: -// case UITouchPhaseMoved: toStationarify = aTouch; break; default: @@ -90,9 +45,7 @@ void eventSendCallback(void* info) { @implementation PTFakeMetaTouch -+ (void)load{ - KW_ENABLE_CATEGORY(UITouch_KIFAdditions); - KW_ENABLE_CATEGORY(UIEvent_KIFAdditions); ++ (void)load { livingTouchAry = [[NSMutableArray alloc] init]; touchAry = [[NSMutableArray alloc] init]; for (NSInteger i = 0; i< 100; i++) { @@ -107,18 +60,16 @@ + (void)load{ source = CFRunLoopSourceCreate(NULL, -2, &context); CFRunLoopRef loop = CFRunLoopGetMain(); CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes); -// CFRunLoopMode mode = (CFRunLoopMode)UITrackingRunLoopMode; -// CFRunLoopAddSource(loop, source, GSEventReceiveRunLoopMode); } -+ (UITouch* ) touch: (NSInteger) pointId { ++ (UITouch*)touch: (NSInteger) pointId { if ([touchAry count] > pointId){ return [touchAry objectAtIndex:pointId]; } return nil; } -+ (NSInteger)fakeTouchId:(NSInteger)pointId AtPoint:(CGPoint)point withTouchPhase:(UITouchPhase)phase inWindow:(UIWindow*)window onView:(UIView*)view{ ++ (NSInteger)fakeTouchId: (NSInteger)pointId AtPoint: (CGPoint)point withTouchPhase: (UITouchPhase)phase inWindow: (UIWindow*)window onView:(UIView*)view { bool deleted = false; UITouch* touch = NULL; bool needsCopy = false; @@ -156,43 +107,12 @@ + (NSInteger)fakeTouchId:(NSInteger)pointId AtPoint:(CGPoint)point withTouchPhas [touch setLocationInWindow:point]; } [touch setPhaseAndUpdateTimestamp:phase]; -// CFRunLoopSourceContext context; -// CFRunLoopSourceGetContext(source, &context); if(needsCopy) { CFTypeRef delayRelease = CFBridgingRetain(safeTouchAry); safeTouchAry = [[NSArray alloc] initWithArray:livingTouchAry copyItems:NO]; CFBridgingRelease(delayRelease); } CFRunLoopSourceSignal(source); -// UIEvent *event = [self eventWithTouches:livingTouchAry]; return deleted; } - - -+ (UIEvent *)eventWithTouches:(NSArray *)touches -{ - // _touchesEvent is a private selector, interface is exposed in UIApplication(KIFAdditionsPrivate) - UIEvent *event = [[UIApplication sharedApplication] _touchesEvent]; - [event _clearTouches]; - [event kif_setEventWithTouches:touches]; - - for (UITouch *aTouch in touches) { - [event _addTouch:aTouch forDelayedDelivery:NO]; - } - - return event; -} - -+ (NSInteger)getAvailablePointId{ - NSInteger availablePointId=0; - NSMutableArray *availableIds = [[NSMutableArray alloc]init]; - for (NSInteger i=0; i - -CG_INLINE CGPoint CGPointCenteredInRect(CGRect bounds) { - return CGPointMake(bounds.origin.x + bounds.size.width * 0.5f, bounds.origin.y + bounds.size.height * 0.5f); -} diff --git a/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.m deleted file mode 100644 index bb4062b1..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/CGGeometry-KIFAdditions.m +++ /dev/null @@ -1,11 +0,0 @@ -// -// CGGeometry-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/22/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "CGGeometry-KIFAdditions.h" - diff --git a/PlayTools/Controls/PTFakeTouch/addition/LoadableCategory.h b/PlayTools/Controls/PTFakeTouch/addition/LoadableCategory.h deleted file mode 100644 index 92259bb3..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/LoadableCategory.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// LoadableCategory.h -// KIF -// -// Created by Karl Stenerud on 7/16/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -/** Make all categories in the current file loadable without using -load-all. - * - * Normally, compilers will skip linking files that contain only categories. - * Adding a call to this macro adds a dummy class, which causes the linker - * to add the file. - * - * @param UNIQUE_NAME A globally unique name. - */ -#define MAKE_CATEGORIES_LOADABLE(UNIQUE_NAME) @interface FORCELOAD_##UNIQUE_NAME : NSObject @end @implementation FORCELOAD_##UNIQUE_NAME @end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.h deleted file mode 100644 index 98f06f0b..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// NSPredicate+KIFAdditions.h -// KIF -// -// Created by Alex Odawa on 2/3/15. -// -// - -#import - -@interface NSPredicate (KIFAdditions) - -@property NSString *kifPredicateDescription; - -- (NSArray *)flatten; -- (NSCompoundPredicate *)minusSubpredicatesFrom:(NSPredicate *)otherPredicate; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.m deleted file mode 100644 index d2f3fc28..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSPredicate+KIFAdditions.m +++ /dev/null @@ -1,72 +0,0 @@ -// -// NSPredicate+KIFAdditions.m -// KIF -// -// Created by Alex Odawa on 2/3/15. -// -// - -#import -#import "NSPredicate+KIFAdditions.h" - -@implementation NSPredicate (KIFAdditions) - -- (NSArray *)flatten -{ - NSMutableArray *result = [[NSMutableArray alloc] init]; - - if ([self isKindOfClass:[NSCompoundPredicate class]]) { - for (NSPredicate *predicate in ((NSCompoundPredicate *)self).subpredicates) { - [result addObjectsFromArray:[predicate flatten]]; - } - } else { - [result addObject:self]; - } - - return result; -} - -- (NSCompoundPredicate *)minusSubpredicatesFrom:(NSPredicate *)otherPredicate; -{ - if (self == otherPredicate) { - return nil; - } - NSMutableSet *subpredicates = [NSMutableSet setWithArray:[self flatten]]; - NSMutableSet *otherSubpredicates = [NSMutableSet setWithArray:[otherPredicate flatten]]; - [subpredicates minusSet:otherSubpredicates]; - return [[NSCompoundPredicate alloc] initWithType:NSAndPredicateType - subpredicates:[subpredicates allObjects]]; -} - -- (void)setKifPredicateDescription:(NSString *)description; -{ - NSString *desc = description.copy; - objc_setAssociatedObject(self, @selector(kifPredicateDescription), desc, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} - -- (NSString *)kifPredicateDescription; -{ - id object = objc_getAssociatedObject(self, @selector(kifPredicateDescription)); - if (object) { - return object; - } - // Compound predicates containing subpredicates with the kifPredicateDescription set should still get our pretty formatting. - if ([self isKindOfClass:[NSCompoundPredicate class]]) { - NSArray *subpredicates = [self flatten]; - NSString *description = @""; - - for (NSPredicate *predicate in subpredicates) { - if (description.length > 0) { - description = [description stringByAppendingString:@", "]; - } - description = [description stringByAppendingString:predicate.kifPredicateDescription]; - } - if (description.length > 0) { - return description; - } - } - - return self.description; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.h deleted file mode 100644 index 1cbacf62..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// NSString+KIFAdditions.h -// KIF -// -// Created by Alex Odawa on 1/28/16. -// -// - -#import - -#pragma mark - NSString -@interface NSString (KIFAdditions) - -- (BOOL)KIF_isEqualToStringOrAttributedString:(id)aString; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.m deleted file mode 100644 index c20fc3e1..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/NSString+KIFAdditions.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// NSString+KIFAdditions.m -// KIF -// -// Created by Alex Odawa on 1/28/16. -// -// - -#import "NSString+KIFAdditions.h" - -#pragma mark - NSString -@implementation NSString (KIFAdditions) - -- (BOOL)KIF_isEqualToStringOrAttributedString:(id)aString; -{ - // Somtimes Accessibility Elements will return an AXAttributedString. - // This compares the raw backing string against a vanilla NSString, ignoring any attributes. - if ([aString respondsToSelector:@selector(string)]) { - return [self isEqualToString:[(id)aString string]]; - } - return [self isEqualToString:aString]; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h deleted file mode 100644 index 4b1439c4..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.h +++ /dev/null @@ -1,99 +0,0 @@ -// -// UIApplication-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - -#define UIApplicationCurrentRunMode ([[UIApplication sharedApplication] currentRunLoopMode]) - -/*! - @abstract When mocking @c -openURL:, this notification is posted. - */ -UIKIT_EXTERN NSString *const UIApplicationDidMockOpenURLNotification; - -/*! - @abstract When mocking @c -canOpenURL:, this notification is posted. - */ -UIKIT_EXTERN NSString *const UIApplicationDidMockCanOpenURLNotification; - -/*! - @abstract The key for the opened URL in the @c UIApplicationDidMockOpenURLNotification notification. - */ -UIKIT_EXTERN NSString *const UIApplicationOpenedURLKey; - -@interface UIApplication (KIFAdditions) - -/*! - @returns The window containing the keyboard or @c nil if the keyboard is not visible. - */ -- (UIWindow *)keyboardWindow; - -/*! - @returns The topmost window containing a @c UIDatePicker. - */ -- (UIWindow *)datePickerWindow; - -/*! - @returns The topmost window containing a @c UIPickerView. - */ -- (UIWindow *)pickerViewWindow; - -/*! - @returns The topmost window containing a @c UIDimmingView. - */ -- (UIWindow *)dimmingViewWindow; - -/*! - @returns All windows in the application, including the key window even if it does not appear in @c -windows. - */ -- (NSArray *)windowsWithKeyWindow; - -/*! - @abstract Writes a screenshot to disk. - @discussion This method only works if the @c KIF_SCREENSHOTS environment variable is set. - @param lineNumber The line number in the code at which the screenshot was taken. - @param filename The name of the file in which the screenshot was taken. - @param description An optional description of the scene being captured. - @param error If the method returns @c YES, this optional parameter provides additional information as to why it failed. - @returns @c YES if the screenshot was written to disk, otherwise @c NO. - */ -- (BOOL)writeScreenshotForLine:(NSUInteger)lineNumber inFile:(NSString *)filename description:(NSString *)description error:(NSError **)error; - -/*! - @returns The current run loop mode. - */ -- (CFStringRef)currentRunLoopMode; - -/*! - @abstract Swizzles the run loop modes so KIF can better switch between them. - */ -+ (void)swizzleRunLoop; - -/*! - @abstract Starts mocking requests to @c -openURL:, announcing all requests with a notification. - @discussion After calling this method, whenever @c -openURL: is called a notification named @c UIApplicationDidMockOpenURLNotification with the URL in the @c UIApplicationOpenedURL will be raised and the normal behavior will be cancelled. - @param returnValue The value to return when @c -openURL: is called. - */ -+ (void)startMockingOpenURLWithReturnValue:(BOOL)returnValue; - -/*! - @abstract Stops the application from mocking requests to @c -openURL:. - */ -+ (void)stopMockingOpenURL; - -@end - -@interface UIApplication (Private) -- (UIWindow *)statusBarWindow; -@property(getter=isStatusBarHidden) BOOL statusBarHidden; -@end - -@interface UIApplication (KIFAdditionsPrivate) -- (UIEvent *)_touchesEvent; -@end - diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m deleted file mode 100644 index 8ff89855..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIApplication-KIFAdditions.m +++ /dev/null @@ -1,259 +0,0 @@ -// -// UIApplication-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UIApplication-KIFAdditions.h" -#import "LoadableCategory.h" -#import "UIView-KIFAdditions.h" -#import -#import -#import - -MAKE_CATEGORIES_LOADABLE(UIApplication_KIFAdditions) - -static BOOL _KIF_UIApplicationMockOpenURL = NO; -static BOOL _KIF_UIApplicationMockOpenURL_returnValue = NO; - -@interface UIApplication (Undocumented) -- (void)pushRunLoopMode:(id)arg1; -- (void)pushRunLoopMode:(id)arg1 requester:(id)requester; -- (void)popRunLoopMode:(id)arg1; -- (void)popRunLoopMode:(id)arg1 requester:(id)requester; -@end - -NSString *const UIApplicationDidMockOpenURLNotification = @"UIApplicationDidMockOpenURLNotification"; -NSString *const UIApplicationDidMockCanOpenURLNotification = @"UIApplicationDidMockCanOpenURLNotification"; -NSString *const UIApplicationOpenedURLKey = @"UIApplicationOpenedURL"; -static const void *KIFRunLoopModesKey = &KIFRunLoopModesKey; - -@implementation UIApplication (KIFAdditions) - -#pragma mark - Interesting windows - -- (UIWindow *)keyboardWindow; -{ - for (UIWindow *window in self.windowsWithKeyWindow) { - if ([NSStringFromClass([window class]) isEqual:@"UITextEffectsWindow"]) { - return window; - } - } - - return nil; -} - -- (UIWindow *)datePickerWindow; -{ - return [self getWindowForSubviewClass:@"UIDatePicker"]; -} - -- (UIWindow *)pickerViewWindow; -{ - return [self getWindowForSubviewClass:@"UIPickerView"]; -} - -- (UIWindow *)dimmingViewWindow; -{ - return [self getWindowForSubviewClass:@"UIDimmingView"]; -} - -- (UIWindow *)getWindowForSubviewClass:(NSString*)className; -{ - for (UIWindow *window in self.windowsWithKeyWindow) { - NSArray *subViews = [window subviewsWithClassNameOrSuperClassNamePrefix:className]; - if (subViews.count > 0) { - return window; - } - } - - return nil; -} - -- (NSArray *)windowsWithKeyWindow -{ - NSMutableArray *windows = self.windows.mutableCopy; -// UIWindow *keyWindow = self.keyWindow; -// if (![windows containsObject:keyWindow]) { -// [windows addObject:keyWindow]; -// } - return windows; -} - -#pragma mark - Screenshotting - -- (BOOL)writeScreenshotForLine:(NSUInteger)lineNumber inFile:(NSString *)filename description:(NSString *)description error:(NSError **)error; -{ - NSString *outputPath = [[[NSProcessInfo processInfo] environment] objectForKey:@"KIF_SCREENSHOTS"]; - if (!outputPath) { - return NO; - } - - NSArray *windows = [self windowsWithKeyWindow]; - if (windows.count == 0) { - return NO; - } - - if (!filename.length) { - return NO; - } - - UIGraphicsBeginImageContextWithOptions([[windows objectAtIndex:0] bounds].size, YES, 0); - for (UIWindow *window in windows) { - //avoid https://github.com/kif-framework/KIF/issues/679 - if (window.hidden) { - continue; - } - - if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { - [window drawViewHierarchyInRect:window.bounds afterScreenUpdates:YES]; - } else { - [window.layer renderInContext:UIGraphicsGetCurrentContext()]; - } - } - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - outputPath = [outputPath stringByExpandingTildeInPath]; - - NSError *directoryCreationError = nil; - if (![[NSFileManager defaultManager] createDirectoryAtPath:outputPath withIntermediateDirectories:YES attributes:nil error:&directoryCreationError]) { - return NO; - } - - NSString *imageName = [self imageNameForFile:filename lineNumber:lineNumber description:description]; - - outputPath = [outputPath stringByAppendingPathComponent:imageName]; - outputPath = [outputPath stringByAppendingPathExtension:@"png"]; - - if (![UIImagePNGRepresentation(image) writeToFile:outputPath atomically:YES]) { - return NO; - } - - return YES; -} - -- (NSString *)imageNameForFile:(NSString *)filename lineNumber:(NSUInteger)lineNumber description:(NSString *)description { - if (!filename.length) { - return nil; - } - - NSString *imageName = [filename lastPathComponent]; - - if (lineNumber > 0) { - imageName = [imageName stringByAppendingFormat:@", line %lu", (unsigned long)lineNumber]; - } - - if (description.length) { - imageName = [imageName stringByAppendingFormat:@", %@", description]; - } - - return imageName; -} - -#pragma mark - Run loop monitoring - -- (NSMutableArray *)KIF_runLoopModes; -{ - NSMutableArray *modes = objc_getAssociatedObject(self, KIFRunLoopModesKey); - if (!modes) { - modes = [NSMutableArray arrayWithObject:(id)kCFRunLoopDefaultMode]; - objc_setAssociatedObject(self, KIFRunLoopModesKey, modes, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - return modes; -} - -- (CFStringRef)currentRunLoopMode; -{ - return (__bridge CFStringRef)[self KIF_runLoopModes].lastObject; -} - -- (void)KIF_pushRunLoopMode:(NSString *)mode; -{ - [[self KIF_runLoopModes] addObject:mode]; - [self KIF_pushRunLoopMode:mode]; -} - -- (void)KIF_pushRunLoopMode:(NSString *)mode requester:(id)requester; -{ - [[self KIF_runLoopModes] addObject:mode]; - [self KIF_pushRunLoopMode:mode requester:requester]; -} - -- (void)KIF_popRunLoopMode:(NSString *)mode; -{ - [[self KIF_runLoopModes] removeLastObject]; - [self KIF_popRunLoopMode:mode]; -} - - -- (void)KIF_popRunLoopMode:(NSString *)mode requester:(id)requester; -{ - [[self KIF_runLoopModes] removeLastObject]; - [self KIF_popRunLoopMode:mode requester:requester]; -} - -- (BOOL)KIF_openURL:(NSURL *)URL; -{ - if (_KIF_UIApplicationMockOpenURL) { - [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidMockOpenURLNotification object:self userInfo:@{UIApplicationOpenedURLKey: URL}]; - return _KIF_UIApplicationMockOpenURL_returnValue; - } else { - return [self KIF_openURL:URL]; - } -} - -- (BOOL)KIF_canOpenURL:(NSURL *)URL; -{ - if (_KIF_UIApplicationMockOpenURL) { - [[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationDidMockCanOpenURLNotification object:self userInfo:@{UIApplicationOpenedURLKey: URL}]; - return _KIF_UIApplicationMockOpenURL_returnValue; - } else { - return [self KIF_canOpenURL:URL]; - } -} - -static inline void Swizzle(Class c, SEL orig, SEL new) -{ - Method origMethod = class_getInstanceMethod(c, orig); - Method newMethod = class_getInstanceMethod(c, new); - if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) - class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); - else - method_exchangeImplementations(origMethod, newMethod); -} - -+ (void)swizzleRunLoop; -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - Swizzle(self, @selector(pushRunLoopMode:), @selector(KIF_pushRunLoopMode:)); - Swizzle(self, @selector(pushRunLoopMode:requester:), @selector(KIF_pushRunLoopMode:requester:)); - Swizzle(self, @selector(popRunLoopMode:), @selector(KIF_popRunLoopMode:)); - Swizzle(self, @selector(popRunLoopMode:requester:), @selector(KIF_popRunLoopMode:requester:)); - }); -} - -#pragma mark - openURL mocking - -+ (void)startMockingOpenURLWithReturnValue:(BOOL)returnValue; -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - Swizzle(self, @selector(openURL:), @selector(KIF_openURL:)); - Swizzle(self, @selector(canOpenURL:), @selector(KIF_canOpenURL:)); - }); - - _KIF_UIApplicationMockOpenURL = YES; - _KIF_UIApplicationMockOpenURL_returnValue = returnValue; -} - -+ (void)stopMockingOpenURL; -{ - _KIF_UIApplicationMockOpenURL = NO; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.h deleted file mode 100644 index eaeb2571..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// UIEvent+KIFAdditions.h -// KIF -// -// Created by Thomas on 3/1/15. -// -// - -#import -#import "FixCategoryBug.h" -KW_FIX_CATEGORY_BUG_H(UIEvent_KIFAdditions) - -// Exposes methods of UITouchesEvent so that the compiler doesn't complain -@interface UIEvent (KIFAdditionsPrivateHeaders) -- (void)_addTouch:(UITouch *)touch forDelayedDelivery:(BOOL)arg2; -- (void)_clearTouches; -@end - -@interface UIEvent (KIFAdditions) -- (void)kif_setEventWithTouches:(NSArray *)touches; -@end \ No newline at end of file diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.m deleted file mode 100644 index 2d80f0b1..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIEvent+KIFAdditions.m +++ /dev/null @@ -1,94 +0,0 @@ -// -// UIEvent+KIFAdditions.m -// KIF -// -// Created by Thomas on 3/1/15. -// -// - -#import "UIEvent+KIFAdditions.h" -#import "LoadableCategory.h" -#import "IOHIDEvent+KIF.h" - -KW_FIX_CATEGORY_BUG_M(UIEvent_KIFAdditions) - -MAKE_CATEGORIES_LOADABLE(UIEvent_KIFAdditions) - - -// -// GSEvent is an undeclared object. We don't need to use it ourselves but some -// Apple APIs (UIScrollView in particular) require the x and y fields to be present. -// -@interface KIFGSEventProxy : NSObject -{ -@public - unsigned int flags; - unsigned int type; - unsigned int ignored1; - float x1; - float y1; - float x2; - float y2; - unsigned int ignored2[10]; - unsigned int ignored3[7]; - float sizeX; - float sizeY; - float x3; - float y3; - unsigned int ignored4[3]; -} -@end - -@implementation KIFGSEventProxy -@end - -typedef struct __GSEvent * GSEventRef; - -@interface UIEvent (KIFAdditionsMorePrivateHeaders) -- (void)_setGSEvent:(GSEventRef)event; -- (void)_setHIDEvent:(IOHIDEventRef)event; -- (void)_setTimestamp:(NSTimeInterval)timestemp; -@end - -@implementation UIEvent (KIFAdditions) - -- (void)kif_setEventWithTouches:(NSArray *)touches -{ - NSOperatingSystemVersion iOS8 = {8, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] - && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS8]) { - [self kif_setIOHIDEventWithTouches:touches]; - } else { - [self kif_setGSEventWithTouches:touches]; - } -} - -- (void)kif_setGSEventWithTouches:(NSArray *)touches -{ - UITouch *touch = touches[0]; - CGPoint location = [touch locationInView:touch.window]; - KIFGSEventProxy *gsEventProxy = [[KIFGSEventProxy alloc] init]; - gsEventProxy->x1 = location.x; - gsEventProxy->y1 = location.y; - gsEventProxy->x2 = location.x; - gsEventProxy->y2 = location.y; - gsEventProxy->x3 = location.x; - gsEventProxy->y3 = location.y; - gsEventProxy->sizeX = 1.0; - gsEventProxy->sizeY = 1.0; - gsEventProxy->flags = ([touch phase] == UITouchPhaseEnded) ? 0x1010180 : 0x3010180; - gsEventProxy->type = 3001; - - [self _setGSEvent:(GSEventRef)gsEventProxy]; - - [self _setTimestamp:(((UITouch*)touches[0]).timestamp)]; -} - -- (void)kif_setIOHIDEventWithTouches:(NSArray *)touches -{ - IOHIDEventRef event = kif_IOHIDEventWithTouches(touches); - [self _setHIDEvent:event]; - CFRelease(event); -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.h deleted file mode 100644 index e51d023f..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// UIScreen+KIFAdditions.h -// KIF -// -// Created by Steven King on 25/02/2016. -// -// - -#import - -@interface UIScreen (KIFAdditions) - -@property (nonatomic, readonly) CGFloat majorSwipeDisplacement; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.m deleted file mode 100644 index 0cf213a3..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIScreen+KIFAdditions.m +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIScreen+KIFAdditions.m -// KIF -// -// Created by Steven King on 25/02/2016. -// -// - -#import "UIScreen+KIFAdditions.h" - -@implementation UIScreen (KIFAdditions) - -- (CGFloat)majorSwipeDisplacement { - return self.bounds.size.width * 0.625; -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.h deleted file mode 100644 index be81e6dd..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// UITouch-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import -#import "IOHIDEvent+KIF.h" -#import "FixCategoryBug.h" - -KW_FIX_CATEGORY_BUG_H(UITouch_KIFAdditions) - -@interface UITouch () - - -- (void)setWindow:(UIWindow *)window; -- (void)setView:(UIView *)view; -- (void)setTapCount:(NSUInteger)tapCount; -- (void)setIsTap:(BOOL)isTap; -- (void)setTimestamp:(NSTimeInterval)timestamp; -- (void)setPhase:(UITouchPhase)touchPhase; -- (void)setGestureView:(UIView *)view; -- (void)_setLocationInWindow:(CGPoint)location resetPrevious:(BOOL)resetPrevious; -- (void)_setIsFirstTouchForView:(BOOL)firstTouchForView; -- (void)_setIsTapToClick:(BOOL)isTapToClick; - -- (void)_setHidEvent:(IOHIDEventRef)event; - -@end - -@interface UITouch (KIFAdditions) - -- (id)initInView:(UIView *)view; -- (id)initAtPoint:(CGPoint)point inView:(UIView *)view; -- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window; -- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window onView:(UIView*)view; -- (id)initTouch; -- (void)resetTouch; - -- (void)setLocationInWindow:(CGPoint)location; -- (void)setPhaseAndUpdateTimestamp:(UITouchPhase)phase; - -@end - diff --git a/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.m deleted file mode 100644 index bdcff737..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UITouch-KIFAdditions.m +++ /dev/null @@ -1,181 +0,0 @@ -// -// UITouch-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UITouch-KIFAdditions.h" -#import "LoadableCategory.h" -#import -#import "PTFakeMetaTouch.h" - -KW_FIX_CATEGORY_BUG_M(UITouch_KIFAdditions) - -MAKE_CATEGORIES_LOADABLE(UITouch_KIFAdditions) - -typedef struct { - unsigned int _firstTouchForView:1; - unsigned int _isTap:1; - unsigned int _isDelayed:1; - unsigned int _sentTouchesEnded:1; - unsigned int _abandonForwardingRecord:1; -} UITouchFlags; - -@implementation UITouch (KIFAdditions) - -- (id)initInView:(UIView *)view; -{ - CGRect frame = view.frame; - CGPoint centerPoint = CGPointMake(frame.size.width * 0.5f, frame.size.height * 0.5f); - return [self initAtPoint:centerPoint inView:view]; -} - -- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window; -{ - UIView *view = [window hitTest:point withEvent:nil]; - return [self initAtPoint:point inWindow:window onView:view]; -} - -- (id)initAtPoint:(CGPoint)point inWindow:(UIWindow *)window onView:(UIView *)view; -{ - self = [super init]; - if (self == nil) { - return nil; - } - - // Create a fake tap touch - [self setWindow:window]; // Wipes out some values. Needs to be first. - - //[self setTapCount:1]; - [self _setLocationInWindow:point resetPrevious:YES]; - - UIView *hitTestView = view; - - [self setView:hitTestView]; - [self setPhase:UITouchPhaseBegan]; - NSOperatingSystemVersion iOS14 = {14, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS14] && ![[NSProcessInfo processInfo] isiOSAppOnMac] && ![[NSProcessInfo processInfo] isMacCatalystApp]) { - [self _setIsTapToClick:NO]; - } else { - [self _setIsFirstTouchForView:YES]; - [self setIsTap:NO]; - } - [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; - if ([self respondsToSelector:@selector(setGestureView:)]) { - [self setGestureView:hitTestView]; - } - - // Starting with iOS 9, internal IOHIDEvent must be set for UITouch object - NSOperatingSystemVersion iOS9 = {9, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS9]) { - [self kif_setHidEvent]; - } - - return self; -} - -- (void)resetTouch{ - // Create a fake tap touch - UIWindow *window = [[UIApplication sharedApplication].windows lastObject]; - CGPoint point = CGPointMake(0, 0); - [self setWindow:window]; // Wipes out some values. Needs to be first. - - //[self setTapCount:1]; - [self _setLocationInWindow:CGPointMake(0, 0) resetPrevious:YES]; - - UIView *hitTestView = [window hitTest:point withEvent:nil]; - - NSOperatingSystemVersion iOS14 = {14, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS14] && ![[NSProcessInfo processInfo] isiOSAppOnMac] && ![[NSProcessInfo processInfo] isMacCatalystApp]) { - [self _setIsTapToClick:NO]; - } else { - [self _setIsFirstTouchForView:YES]; - [self setIsTap:NO]; - } - - [self setView:hitTestView]; - [self setPhase:UITouchPhaseBegan]; - //DLog(@"resetTouch setPhase 0"); - [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; - if ([self respondsToSelector:@selector(setGestureView:)]) { - [self setGestureView:hitTestView]; - } - - // Starting with iOS 9, internal IOHIDEvent must be set for UITouch object - NSOperatingSystemVersion iOS9 = {9, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS9]) { - [self kif_setHidEvent]; - } -} - -- (id)initTouch; -{ - //DLog(@"init...touch..."); - self = [super init]; - if (self == nil) { - return nil; - } - UIWindow *window = [[UIApplication sharedApplication].windows lastObject]; - CGPoint point = CGPointMake(0, 0); - [self setWindow:window]; // Wipes out some values. Needs to be first. - - [self _setLocationInWindow:point resetPrevious:YES]; - - UIView *hitTestView = [window hitTest:point withEvent:nil]; - - [self setView:hitTestView]; - [self setPhase:UITouchPhaseEnded]; - //DLog(@"init...touch...setPhase 3"); - NSOperatingSystemVersion iOS14 = {14, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS14] && ![[NSProcessInfo processInfo] isiOSAppOnMac] && ![[NSProcessInfo processInfo] isMacCatalystApp]) { - [self _setIsTapToClick:NO]; - } else { - [self _setIsFirstTouchForView:YES]; - [self setIsTap:NO]; - } - [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; - if ([self respondsToSelector:@selector(setGestureView:)]) { - [self setGestureView:hitTestView]; - } - - // Starting with iOS 9, internal IOHIDEvent must be set for UITouch object - NSOperatingSystemVersion iOS9 = {9, 0, 0}; - if ([NSProcessInfo instancesRespondToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo new] isOperatingSystemAtLeastVersion:iOS9]) { - [self kif_setHidEvent]; - } - return self; -} - -- (id)initAtPoint:(CGPoint)point inView:(UIView *)view; -{ - return [self initAtPoint:[view.window convertPoint:point fromView:view] inWindow:view.window]; -} - -// -// setLocationInWindow: -// -// Setter to allow access to the _locationInWindow member. -// -- (void)setLocationInWindow:(CGPoint)location -{ - [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; - [self _setLocationInWindow:location resetPrevious:NO]; -} - -- (void)setPhaseAndUpdateTimestamp:(UITouchPhase)phase -{ - //DLog(@"setPhaseAndUpdateTimestamp : %ld",(long)phase); - [self setTimestamp: [[NSProcessInfo processInfo] systemUptime]]; - [self setPhase:phase]; -} - -- (void)kif_setHidEvent { - IOHIDEventRef event = kif_IOHIDEventWithTouches(@[self]); - [self _setHidEvent:event]; - CFRelease(event); -} - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h deleted file mode 100644 index 17a0d539..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// UIView-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - -extern double KIFDegreesToRadians(double deg); -extern double KIFRadiansToDegrees(double rad); - -typedef CGPoint KIFDisplacement; - -@interface UIView (KIFAdditions) - -- (BOOL)isDescendantOfFirstResponder; - -- (UIView *)subviewWithClassNamePrefix:(NSString *)prefix __deprecated; -- (NSArray *)subviewsWithClassNamePrefix:(NSString *)prefix; -- (UIView *)subviewWithClassNameOrSuperClassNamePrefix:(NSString *)prefix __deprecated; -- (NSArray *)subviewsWithClassNameOrSuperClassNamePrefix:(NSString *)prefix; - -- (void)flash; -- (void)tap; -- (void)tapAtPoint:(CGPoint)point; -- (void)twoFingerTapAtPoint:(CGPoint)point; -- (void)longPressAtPoint:(CGPoint)point duration:(NSTimeInterval)duration; - -/*! - @method dragFromPoint:toPoint: - @abstract Simulates dragging a finger on the screen between the given points. - @discussion Causes the application to dispatch a sequence of touch events which simulate dragging a finger from startPoint to endPoint. - @param startPoint The point at which to start the drag, in the coordinate system of the receiver. - @param endPoint The point at which to end the drag, in the coordinate system of the receiver. - */ -- (void)dragFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint; -- (void)dragFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint steps:(NSUInteger)stepCount; -- (void)dragFromPoint:(CGPoint)startPoint displacement:(KIFDisplacement)displacement steps:(NSUInteger)stepCount; -- (void)dragAlongPathWithPoints:(CGPoint *)points count:(NSInteger)count; -- (void)twoFingerPanFromPoint:(CGPoint)startPoint toPoint:(CGPoint)toPoint steps:(NSUInteger)stepCount; -- (void)pinchAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount; -- (void)zoomAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount; -- (void)twoFingerRotateAtPoint:(CGPoint)centerPoint angle:(CGFloat)angleInDegrees; - -- (UIEvent *)eventWithTouch:(UITouch *)touch; - -/*! - @abstract Evaluates if user interaction is enabled including edge cases. - */ -- (BOOL)isUserInteractionActuallyEnabled; - -/*! - @abstract Evaluates if the view and all its superviews are visible. - */ -- (BOOL)isVisibleInViewHierarchy; - -/*! - @method performBlockOnDescendentViews: - @abstract Calls a block on the view itself and on all its descendent views. - @param block The block that will be called on the views. Stop the traversation of the views by assigning YES to the stop-parameter of the block. - */ -- (void)performBlockOnDescendentViews:(void (^)(UIView *view, BOOL *stop))block; - -/*! - @method performBlockOnAscendentViews: - @abstract Calls a block on the view itself and on all its superviews. - @param block The block that will be called on the views. Stop the traversation of the views by assigning YES to the stop-parameter of the block. - */ -- (void)performBlockOnAscendentViews:(void (^)(UIView *view, BOOL *stop))block; - -/*! - @abstract Returns either the current window or another window if a transform is applied. Returns `nil` if all windows in the application have transforms. - */ -@property (nonatomic, readonly) UIWindow *windowOrIdentityWindow; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m deleted file mode 100644 index 042d0cc8..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIView-KIFAdditions.m +++ /dev/null @@ -1,578 +0,0 @@ -// -// UIView-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UIView-KIFAdditions.h" -#import "CGGeometry-KIFAdditions.h" -#import "UIApplication-KIFAdditions.h" -#import "UITouch-KIFAdditions.h" -#import -#import "UIEvent+KIFAdditions.h" - -double KIFDegreesToRadians(double deg) { - return (deg) / 180.0 * M_PI; -} - -double KIFRadiansToDegrees(double rad) { - return ((rad) * (180.0 / M_PI)); -} - -static CGFloat const kTwoFingerConstantWidth = 40; - - -@interface NSObject (UIWebDocumentViewInternal) - -- (void)tapInteractionWithLocation:(CGPoint)point; - -@end - -// On iOS 6 the accessibility label may contain line breaks, so when trying to find the -// element, these line breaks are necessary. But on iOS 7 the system replaces them with -// spaces. So the same test breaks on either iOS 6 or iOS 7. iOS8 befuddles this again by -//limiting replacement to spaces in between strings. To work around this replace -// the line breaks in both and try again. -NS_INLINE BOOL StringsMatchExceptLineBreaks(NSString *expected, NSString *actual) { - if (expected == actual) { - return YES; - } - - if (expected.length != actual.length) { - return NO; - } - - if ([expected isEqualToString:actual]) { - return YES; - } - - if ([expected rangeOfString:@"\n"].location == NSNotFound && - [actual rangeOfString:@"\n"].location == NSNotFound) { - return NO; - } - - for (NSUInteger i = 0; i < expected.length; i ++) { - unichar expectedChar = [expected characterAtIndex:i]; - unichar actualChar = [actual characterAtIndex:i]; - if (expectedChar != actualChar && - !(expectedChar == '\n' && actualChar == ' ') && - !(expectedChar == ' ' && actualChar == '\n')) { - return NO; - } - } - - return YES; -} - - -@implementation UIView (KIFAdditions) - -+ (NSSet *)classesToSkipAccessibilitySearchRecursion -{ - static NSSet *classesToSkip; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // UIDatePicker contains hundreds of thousands of placeholder accessibility elements that aren't useful to KIF, - // so don't recurse into a date picker when searching for matching accessibility elements - classesToSkip = [[NSSet alloc] initWithObjects:[UIDatePicker class], nil]; - }); - - return classesToSkip; -} - -- (UIView *)subviewWithClassNamePrefix:(NSString *)prefix; -{ - NSArray *subviews = [self subviewsWithClassNamePrefix:prefix]; - if ([subviews count] == 0) { - return nil; - } - - return subviews[0]; -} - -- (NSArray *)subviewsWithClassNamePrefix:(NSString *)prefix; -{ - NSMutableArray *result = [NSMutableArray array]; - - // Breadth-first population of matching subviews - // First traverse the next level of subviews, adding matches. - for (UIView *view in self.subviews) { - if ([NSStringFromClass([view class]) hasPrefix:prefix]) { - [result addObject:view]; - } - } - - // Now traverse the subviews of the subviews, adding matches. - for (UIView *view in self.subviews) { - NSArray *matchingSubviews = [view subviewsWithClassNamePrefix:prefix]; - [result addObjectsFromArray:matchingSubviews]; - } - - return result; -} - -- (UIView *)subviewWithClassNameOrSuperClassNamePrefix:(NSString *)prefix; -{ - NSArray *subviews = [self subviewsWithClassNameOrSuperClassNamePrefix:prefix]; - if ([subviews count] == 0) { - return nil; - } - - return subviews[0]; -} - -- (NSArray *)subviewsWithClassNameOrSuperClassNamePrefix:(NSString *)prefix; -{ - NSMutableArray * result = [NSMutableArray array]; - - // Breadth-first population of matching subviews - // First traverse the next level of subviews, adding matches - for (UIView *view in self.subviews) { - Class klass = [view class]; - while (klass) { - if ([NSStringFromClass(klass) hasPrefix:prefix]) { - [result addObject:view]; - break; - } - - klass = [klass superclass]; - } - } - - // Now traverse the subviews of the subviews, adding matches - for (UIView *view in self.subviews) { - NSArray * matchingSubviews = [view subviewsWithClassNameOrSuperClassNamePrefix:prefix]; - [result addObjectsFromArray:matchingSubviews]; - } - - return result; -} - - -- (BOOL)isDescendantOfFirstResponder; -{ - if ([self isFirstResponder]) { - return YES; - } - return [self.superview isDescendantOfFirstResponder]; -} - -- (void)flash; -{ - UIColor *originalBackgroundColor = self.backgroundColor; - for (NSUInteger i = 0; i < 5; i++) { - self.backgroundColor = [UIColor yellowColor]; - CFRunLoopRunInMode(kCFRunLoopDefaultMode, .05, false); - self.backgroundColor = [UIColor blueColor]; - CFRunLoopRunInMode(kCFRunLoopDefaultMode, .05, false); - } - self.backgroundColor = originalBackgroundColor; -} - -- (void)tap; -{ - CGPoint centerPoint = CGPointMake(self.frame.size.width * 0.5f, self.frame.size.height * 0.5f); - - [self tapAtPoint:centerPoint]; -} - -- (void)tapAtPoint:(CGPoint)point; -{ - - // Handle touches in the normal way for other views - UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - - UIEvent *event = [self eventWithTouch:touch]; - - [[UIApplication sharedApplication] sendEvent:event]; - - [touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - [[UIApplication sharedApplication] sendEvent:event]; - - // Dispatching the event doesn't actually update the first responder, so fake it - if ([touch.view isDescendantOfView:self] && [self canBecomeFirstResponder]) { - [self becomeFirstResponder]; - } - -} - -- (void)twoFingerTapAtPoint:(CGPoint)point { - CGPoint finger1 = CGPointMake(point.x - kTwoFingerConstantWidth, point.y - kTwoFingerConstantWidth); - CGPoint finger2 = CGPointMake(point.x + kTwoFingerConstantWidth, point.y + kTwoFingerConstantWidth); - UITouch *touch1 = [[UITouch alloc] initAtPoint:finger1 inView:self]; - UITouch *touch2 = [[UITouch alloc] initAtPoint:finger2 inView:self]; - [touch1 setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - [touch2 setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - - UIEvent *event = [self eventWithTouches:@[touch1, touch2]]; - [[UIApplication sharedApplication] sendEvent:event]; - - [touch1 setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - [touch2 setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - - [[UIApplication sharedApplication] sendEvent:event]; -} - -#define DRAG_TOUCH_DELAY 0.01 - -- (void)longPressAtPoint:(CGPoint)point duration:(NSTimeInterval)duration -{ - UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - - UIEvent *eventDown = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventDown]; - - CFRunLoopRunInMode(kCFRunLoopDefaultMode, DRAG_TOUCH_DELAY, false); - - for (NSTimeInterval timeSpent = DRAG_TOUCH_DELAY; timeSpent < duration; timeSpent += DRAG_TOUCH_DELAY) - { - [touch setPhaseAndUpdateTimestamp:UITouchPhaseStationary]; - - UIEvent *eventStillDown = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventStillDown]; - - CFRunLoopRunInMode(kCFRunLoopDefaultMode, DRAG_TOUCH_DELAY, false); - } - - [touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - UIEvent *eventUp = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventUp]; - - // Dispatching the event doesn't actually update the first responder, so fake it - if ([touch.view isDescendantOfView:self] && [self canBecomeFirstResponder]) { - [self becomeFirstResponder]; - } - -} - -- (void)dragFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint; -{ - [self dragFromPoint:startPoint toPoint:endPoint steps:3]; -} - - -- (void)dragFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint steps:(NSUInteger)stepCount; -{ - KIFDisplacement displacement = CGPointMake(endPoint.x - startPoint.x, endPoint.y - startPoint.y); - [self dragFromPoint:startPoint displacement:displacement steps:stepCount]; -} - -- (void)dragFromPoint:(CGPoint)startPoint displacement:(KIFDisplacement)displacement steps:(NSUInteger)stepCount; -{ - CGPoint endPoint = CGPointMake(startPoint.x + displacement.x, startPoint.y + displacement.y); - NSArray *path = [self pointsFromStartPoint:startPoint toPoint:endPoint steps:stepCount]; - [self dragPointsAlongPaths:@[path]]; -} - -- (void)dragAlongPathWithPoints:(CGPoint *)points count:(NSInteger)count; -{ - // convert point array into NSArray with NSValue - NSMutableArray *array = [NSMutableArray array]; - for (int i = 0; i < count; i++) - { - [array addObject:[NSValue valueWithCGPoint:points[i]]]; - } - [self dragPointsAlongPaths:@[[array copy]]]; -} - -- (void)dragPointsAlongPaths:(NSArray *)arrayOfPaths { - // must have at least one path, and each path must have the same number of points - if (arrayOfPaths.count == 0) - { - return; - } - - // all paths must have similar number of points - NSUInteger pointsInPath = [arrayOfPaths[0] count]; - for (NSArray *path in arrayOfPaths) - { - if (path.count != pointsInPath) - { - return; - } - } - - NSMutableArray *touches = [NSMutableArray array]; - - for (NSUInteger pointIndex = 0; pointIndex < pointsInPath; pointIndex++) { - // create initial touch event and send touch down event - if (pointIndex == 0) - { - for (NSArray *path in arrayOfPaths) - { - CGPoint point = [path[pointIndex] CGPointValue]; - UITouch *touch = [[UITouch alloc] initAtPoint:point inView:self]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseBegan]; - [touches addObject:touch]; - } - UIEvent *eventDown = [self eventWithTouches:[NSArray arrayWithArray:touches]]; - [[UIApplication sharedApplication] sendEvent:eventDown]; - - CFRunLoopRunInMode(UIApplicationCurrentRunMode, DRAG_TOUCH_DELAY, false); - } - else - { - UITouch *touch; - for (NSUInteger pathIndex = 0; pathIndex < arrayOfPaths.count; pathIndex++) - { - NSArray *path = arrayOfPaths[pathIndex]; - CGPoint point = [path[pointIndex] CGPointValue]; - touch = touches[pathIndex]; - [touch setLocationInWindow:[self.window convertPoint:point fromView:self]]; - [touch setPhaseAndUpdateTimestamp:UITouchPhaseMoved]; - } - UIEvent *event = [self eventWithTouches:[NSArray arrayWithArray:touches]]; - [[UIApplication sharedApplication] sendEvent:event]; - - CFRunLoopRunInMode(UIApplicationCurrentRunMode, DRAG_TOUCH_DELAY, false); - - // The last point needs to also send a phase ended touch. - if (pointIndex == pointsInPath - 1) { - for (UITouch * touch in touches) { - [touch setPhaseAndUpdateTimestamp:UITouchPhaseEnded]; - UIEvent *eventUp = [self eventWithTouch:touch]; - [[UIApplication sharedApplication] sendEvent:eventUp]; - - } - - } - } - } - - // Dispatching the event doesn't actually update the first responder, so fake it - if ([touches[0] view] == self && [self canBecomeFirstResponder]) { - [self becomeFirstResponder]; - } - - while (UIApplicationCurrentRunMode != kCFRunLoopDefaultMode) { - CFRunLoopRunInMode(UIApplicationCurrentRunMode, 0.1, false); - } -} - -- (void)twoFingerPanFromPoint:(CGPoint)startPoint toPoint:(CGPoint)toPoint steps:(NSUInteger)stepCount { - //estimate the first finger to be diagonally up and left from the center - CGPoint finger1Start = CGPointMake(startPoint.x - kTwoFingerConstantWidth, - startPoint.y - kTwoFingerConstantWidth); - CGPoint finger1End = CGPointMake(toPoint.x - kTwoFingerConstantWidth, - toPoint.y - kTwoFingerConstantWidth); - //estimate the second finger to be diagonally down and right from the center - CGPoint finger2Start = CGPointMake(startPoint.x + kTwoFingerConstantWidth, - startPoint.y + kTwoFingerConstantWidth); - CGPoint finger2End = CGPointMake(toPoint.x + kTwoFingerConstantWidth, - toPoint.y + kTwoFingerConstantWidth); - NSArray *finger1Path = [self pointsFromStartPoint:finger1Start toPoint:finger1End steps:stepCount]; - NSArray *finger2Path = [self pointsFromStartPoint:finger2Start toPoint:finger2End steps:stepCount]; - NSArray *paths = @[finger1Path, finger2Path]; - - [self dragPointsAlongPaths:paths]; -} - -- (void)pinchAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount { - //estimate the first finger to be on the left - CGPoint finger1Start = CGPointMake(centerPoint.x - kTwoFingerConstantWidth - distance, centerPoint.y); - CGPoint finger1End = CGPointMake(centerPoint.x - kTwoFingerConstantWidth, centerPoint.y); - //estimate the second finger to be on the right - CGPoint finger2Start = CGPointMake(centerPoint.x + kTwoFingerConstantWidth + distance, centerPoint.y); - CGPoint finger2End = CGPointMake(centerPoint.x + kTwoFingerConstantWidth, centerPoint.y); - NSArray *finger1Path = [self pointsFromStartPoint:finger1Start toPoint:finger1End steps:stepCount]; - NSArray *finger2Path = [self pointsFromStartPoint:finger2Start toPoint:finger2End steps:stepCount]; - NSArray *paths = @[finger1Path, finger2Path]; - - [self dragPointsAlongPaths:paths]; -} - -- (void)zoomAtPoint:(CGPoint)centerPoint distance:(CGFloat)distance steps:(NSUInteger)stepCount { - //estimate the first finger to be on the left - CGPoint finger1Start = CGPointMake(centerPoint.x - kTwoFingerConstantWidth, centerPoint.y); - CGPoint finger1End = CGPointMake(centerPoint.x - kTwoFingerConstantWidth - distance, centerPoint.y); - //estimate the second finger to be on the right - CGPoint finger2Start = CGPointMake(centerPoint.x + kTwoFingerConstantWidth, centerPoint.y); - CGPoint finger2End = CGPointMake(centerPoint.x + kTwoFingerConstantWidth + distance, centerPoint.y); - NSArray *finger1Path = [self pointsFromStartPoint:finger1Start toPoint:finger1End steps:stepCount]; - NSArray *finger2Path = [self pointsFromStartPoint:finger2Start toPoint:finger2End steps:stepCount]; - NSArray *paths = @[finger1Path, finger2Path]; - - [self dragPointsAlongPaths:paths]; -} - -- (void)twoFingerRotateAtPoint:(CGPoint)centerPoint angle:(CGFloat)angleInDegrees { - NSInteger stepCount = ABS(angleInDegrees)/2; // very rough approximation. 90deg = ~45 steps, 360 deg = ~180 steps - CGFloat radius = kTwoFingerConstantWidth*2; - double angleInRadians = KIFDegreesToRadians(angleInDegrees); - - NSMutableArray *finger1Path = [NSMutableArray array]; - NSMutableArray *finger2Path = [NSMutableArray array]; - for (NSUInteger i = 0; i < stepCount; i++) { - double currentAngle = 0; - if (i == stepCount - 1) { - currentAngle = angleInRadians; // do not interpolate for the last step for maximum accuracy - } - else { - double interpolation = i/(double)stepCount; - currentAngle = interpolation * angleInRadians; - } - // interpolate betwen 0 and the target rotation - CGPoint offset1 = CGPointMake(radius * cos(currentAngle), radius * sin(currentAngle)); - CGPoint offset2 = CGPointMake(-offset1.x, -offset1.y); // second finger is just opposite of the first - - CGPoint finger1 = CGPointMake(centerPoint.x + offset1.x, centerPoint.y + offset1.y); - CGPoint finger2 = CGPointMake(centerPoint.x + offset2.x, centerPoint.y + offset2.y); - - [finger1Path addObject:[NSValue valueWithCGPoint:finger1]]; - [finger2Path addObject:[NSValue valueWithCGPoint:finger2]]; - } - [self dragPointsAlongPaths:@[[finger1Path copy], [finger2Path copy]]]; -} - -- (NSArray *)pointsFromStartPoint:(CGPoint)startPoint toPoint:(CGPoint)toPoint steps:(NSUInteger)stepCount { - - CGPoint displacement = CGPointMake(toPoint.x - startPoint.x, toPoint.y - startPoint.y); - NSMutableArray *points = [NSMutableArray array]; - - for (NSUInteger i = 0; i < stepCount; i++) { - CGFloat progress = ((CGFloat)i)/(stepCount - 1); - CGPoint point = CGPointMake(startPoint.x + (progress * displacement.x), - startPoint.y + (progress * displacement.y)); - [points addObject:[NSValue valueWithCGPoint:point]]; - } - return [NSArray arrayWithArray:points]; -} - -- (UIEvent *)eventWithTouches:(NSArray *)touches -{ - // _touchesEvent is a private selector, interface is exposed in UIApplication(KIFAdditionsPrivate) - UIEvent *event = [[UIApplication sharedApplication] _touchesEvent]; - - [event _clearTouches]; - [event kif_setEventWithTouches:touches]; - - for (UITouch *aTouch in touches) { - [event _addTouch:aTouch forDelayedDelivery:NO]; - } - - return event; -} - -- (UIEvent *)eventWithTouch:(UITouch *)touch; -{ - NSArray *touches = touch ? @[touch] : nil; - return [self eventWithTouches:touches]; -} - -- (BOOL)isUserInteractionActuallyEnabled; -{ - BOOL isUserInteractionEnabled = self.userInteractionEnabled; - - // Navigation item views don't have user interaction enabled, but their parent nav bar does and will forward the event - if (!isUserInteractionEnabled && [self isNavigationItemView]) { - // If this view is inside a nav bar, and the nav bar is enabled, then consider it enabled - UIView *navBar = [self superview]; - while (navBar && ![navBar isKindOfClass:[UINavigationBar class]]) { - navBar = [navBar superview]; - } - if (navBar && navBar.userInteractionEnabled) { - isUserInteractionEnabled = YES; - } - } - - // UIActionsheet Buttons have UIButtonLabels with userInteractionEnabled=NO inside, - // grab the superview UINavigationButton instead. - if (!isUserInteractionEnabled && [self isKindOfClass:NSClassFromString(@"UIButtonLabel")]) { - UIView *button = [self superview]; - while (button && ![button isKindOfClass:NSClassFromString(@"UINavigationButton")]) { - button = [button superview]; - } - if (button && button.userInteractionEnabled) { - isUserInteractionEnabled = YES; - } - } - - // Somtimes views are inside a UIControl and don't have user interaction enabled. - // Walk up the hierarchary evaluating the parent UIControl subclass and use that instead. - if (!isUserInteractionEnabled && [self.superview isKindOfClass:[UIControl class]]) { - // If this view is inside a UIControl, and it is enabled, then consider the view enabled - UIControl *control = (UIControl *)[self superview]; - while (control && [control isKindOfClass:[UIControl class]]) { - if (control.isUserInteractionEnabled) { - isUserInteractionEnabled = YES; - break; - } - control = (UIControl *)[control superview]; - } - } - - return isUserInteractionEnabled; -} - -- (BOOL)isNavigationItemView; -{ - return [self isKindOfClass:NSClassFromString(@"UINavigationItemView")] || [self isKindOfClass:NSClassFromString(@"_UINavigationBarBackIndicatorView")]; -} - -- (UIWindow *)windowOrIdentityWindow -{ - if (CGAffineTransformIsIdentity(self.window.transform)) { - return self.window; - } - - for (UIWindow *window in [[UIApplication sharedApplication] windowsWithKeyWindow]) { - if (CGAffineTransformIsIdentity(window.transform)) { - return window; - } - } - - return nil; -} - -- (BOOL)isVisibleInViewHierarchy -{ - __block BOOL result = YES; - [self performBlockOnAscendentViews:^(UIView *view, BOOL *stop) { - if (view.isHidden) { - result = NO; - if (stop != NULL) { - *stop = YES; - } - } - }]; - return result; -} - -- (void)performBlockOnDescendentViews:(void (^)(UIView *view, BOOL *stop))block -{ - BOOL stop = NO; - [self performBlockOnDescendentViews:block stop:&stop]; -} - -- (void)performBlockOnDescendentViews:(void (^)(UIView *view, BOOL *stop))block stop:(BOOL *)stop -{ - block(self, stop); - if (*stop) { - return; - } - - for (UIView *view in self.subviews) { - [view performBlockOnDescendentViews:block stop:stop]; - if (*stop) { - return; - } - } -} - -- (void)performBlockOnAscendentViews:(void (^)(UIView *view, BOOL *stop))block -{ - BOOL stop = NO; - UIView *checkedView = self; - while(checkedView && stop == NO) { - block(checkedView, &stop); - checkedView = checkedView.superview; - } -} - - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.h b/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.h deleted file mode 100644 index 64c9b2c4..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIWindow-KIFAdditions.h -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import - - -@interface UIWindow (KIFAdditions) - -- (UIResponder *)firstResponder; - -@end diff --git a/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.m b/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.m deleted file mode 100644 index 893b49e1..00000000 --- a/PlayTools/Controls/PTFakeTouch/addition/UIWindow-KIFAdditions.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// UIWindow-KIFAdditions.m -// KIF -// -// Created by Eric Firestone on 5/20/11. -// Licensed to Square, Inc. under one or more contributor license agreements. -// See the LICENSE file distributed with this work for the terms under -// which Square, Inc. licenses this file to you. - -#import "UIWindow-KIFAdditions.h" - - -//@implementation UIWindow (KIFAdditions) -// -//@end diff --git a/PlayTools/Controls/PlayInput.swift b/PlayTools/Controls/PlayInput.swift index a3bb0d64..f25b159c 100644 --- a/PlayTools/Controls/PlayInput.swift +++ b/PlayTools/Controls/PlayInput.swift @@ -73,11 +73,9 @@ class PlayInput { private func isSafeToBind(_ input: GCKeyboardInput) -> Bool { var result = true - for forbidden in PlayInput.FORBIDDEN { - if input.button(forKeyCode: forbidden)?.isPressed ?? false { - result = false - break - } + for forbidden in PlayInput.FORBIDDEN where input.button(forKeyCode: forbidden)?.isPressed ?? false { + result = false + break } return result } diff --git a/PlayTools/Controls/PlayMice.swift b/PlayTools/Controls/PlayMice.swift index fc5d5c71..6b879642 100644 --- a/PlayTools/Controls/PlayMice.swift +++ b/PlayTools/Controls/PlayMice.swift @@ -30,9 +30,7 @@ public class PlayMice { public var cursorPos: CGPoint { var point = CGPoint(x: 0, y: 0) - if #available(macOS 11, *) { - point = AKInterface.shared!.mousePoint - } + point = AKInterface.shared!.mousePoint let rect = AKInterface.shared!.windowFrame let viewRect: CGRect = screen.screenRect let widthRate = viewRect.width / rect.width diff --git a/PlayTools/Controls/Toucher.swift b/PlayTools/Controls/Toucher.swift index edcbf553..6eb0bec8 100644 --- a/PlayTools/Controls/Toucher.swift +++ b/PlayTools/Controls/Toucher.swift @@ -7,7 +7,6 @@ import Foundation import UIKit class Toucher { - static weak var keyWindow: UIWindow? static weak var keyView: UIView? static var touchQueue = DispatchQueue.init(label: "playcover.toucher", qos: .userInteractive) diff --git a/PlayTools/Keymap/ControlModel.swift b/PlayTools/Keymap/ControlModel.swift index 4a21569c..69dc4536 100644 --- a/PlayTools/Keymap/ControlModel.swift +++ b/PlayTools/Keymap/ControlModel.swift @@ -123,7 +123,7 @@ class ButtonModel: ControlModel { button.titleLabel?.numberOfLines = 1 button.titleLabel?.adjustsFontSizeToFitWidth = true button.titleLabel?.textAlignment = .center - button.contentEdgeInsets = UIEdgeInsets(top: 2, left: 2, bottom: 2, right: 2) + button.configuration?.contentInsets = NSDirectionalEdgeInsets(top: 2, leading: 2, bottom: 2, trailing: 2) } override func focus(_ focus: Bool) { diff --git a/PlayTools/PlayCover.swift b/PlayTools/PlayCover.swift index 15092916..860f1266 100644 --- a/PlayTools/PlayCover.swift +++ b/PlayTools/PlayCover.swift @@ -6,14 +6,10 @@ import Foundation import UIKit -final public class PlayCover: NSObject { - - @objc static let shared = PlayCover() +public class PlayCover: NSObject { + static let shared = PlayCover() var menuController: MenuController? - var firstTime = true - - private override init() {} @objc static public func launch() { quitWhenClose() @@ -22,18 +18,6 @@ final public class PlayCover: NSObject { DiscordIPC.shared.initialize() } - @objc static public func quitWhenClose() { - NotificationCenter.default.addObserver( - forName: NSNotification.Name(rawValue: "NSWindowWillCloseNotification"), - object: nil, - queue: OperationQueue.main - ) { noti in - if PlayScreen.shared.nsWindow?.isEqual(noti.object) ?? false { - AKInterface.shared!.terminateApplication() - } - } - } - @objc static public func initMenu(menu: NSObject) { delay(0.005) { guard let menuBuilder = menu as? UIMenuBuilder else { return } @@ -46,56 +30,20 @@ final public class PlayCover: NSObject { } } - static func delay(_ delay: Double, closure:@escaping () -> Void) { - let when = DispatchTime.now() + delay - DispatchQueue.main.asyncAfter(deadline: when, execute: closure) - } - - func processSubviews(of viewOptional: UIView?) { - if let view = viewOptional { - for subview in view.subviews { - print(subview.description) - processSubviews(of: subview) + static public func quitWhenClose() { + NotificationCenter.default.addObserver( + forName: NSNotification.Name(rawValue: "NSWindowWillCloseNotification"), + object: nil, + queue: OperationQueue.main + ) { notif in + if PlayScreen.shared.nsWindow?.isEqual(notif.object) ?? false { + AKInterface.shared!.terminateApplication() } } } -} - -@objc extension FileManager { - private static let FOUNDATION = "/System/Library/Frameworks/Foundation.framework/Foundation" - - static func classInit() { - let originalMethod = class_getInstanceMethod(FileManager.self, #selector(fileExists(atPath:))) - let swizzledMethod = class_getInstanceMethod(FileManager.self, #selector(hook_fileExists(atPath:))) - method_exchangeImplementations(originalMethod!, swizzledMethod!) - let originalMethod3 = class_getInstanceMethod(FileManager.self, #selector(isReadableFile(atPath:))) - let swizzledMethod3 = class_getInstanceMethod(FileManager.self, #selector(hook_isReadableFile(atPath:))) - - method_exchangeImplementations(originalMethod3!, swizzledMethod3!) - } - - func hook_fileExists(atPath: String) -> Bool { - let answer = hook_fileExists(atPath: atPath) - if atPath.elementsEqual(FileManager.FOUNDATION) { - return true - } - return answer - } - - func hook_fileExists(atPath path: String, isDirectory: UnsafeMutablePointer?) -> Bool { - let answer = hook_fileExists(atPath: path, isDirectory: isDirectory) - if path.elementsEqual(FileManager.FOUNDATION) { - return true - } - return answer - } - - func hook_isReadableFile(atPath path: String) -> Bool { - let answer = hook_isReadableFile(atPath: path) - if path.elementsEqual(FileManager.FOUNDATION) { - return true - } - return answer + static func delay(_ delay: Double, closure: @escaping () -> Void) { + let when = DispatchTime.now() + delay + DispatchQueue.main.asyncAfter(deadline: when, execute: closure) } } diff --git a/PlayTools/PlayLoader.m b/PlayTools/PlayLoader.m index 02581324..61a66c78 100644 --- a/PlayTools/PlayLoader.m +++ b/PlayTools/PlayLoader.m @@ -2,139 +2,99 @@ // PlayLoader.m // PlayTools // -#import "PlayLoader.h" -#import -#include + #include -#include -#include -#import #include -#include + +#import "PlayLoader.h" +#import #import -#include #import "NSObject+Swizzle.h" -#include "sandbox.h" - -#define SYSTEM_INFO_PATH "/System/Library/CoreServices/SystemVersion.plist" -#define IOS_SYSTEM_INFO_PATH "/System/Library/CoreServices/iOSSystemVersion.plist" - -#define CS_OPS_STATUS 0 /* return status */ -#define CS_OPS_ENTITLEMENTS_BLOB 7 /* get entitlements blob */ -#define CS_OPS_IDENTITY 11 /* get codesign identity */ -int dyld_get_active_platform(void); - -int my_dyld_get_active_platform(void) { return 2; } - -extern uint64_t dyld_get_base_platform(void *platform); - -uint64_t my_dyld_get_base_platform(void *platform) { return 2; } - -// get device model from playcover .plist +// Get device model from playcover .plist #define DEVICE_MODEL ([[[PlaySettings shared] deviceModel] UTF8String]) #define OEM_ID ([[[PlaySettings shared] oemID] UTF8String]) +#define PLATFORM_IOS 2 + +// Define dyld_get_active_platform function for interpose +int dyld_get_active_platform(void); +int pt_dyld_get_active_platform(void) { return PLATFORM_IOS; } -static int my_uname(struct utsname *uts) { - int result = 0; - NSString *nickname = @"ipad"; - if (nickname.length == 0) - result = uname(uts); - else { - strncpy(uts->nodename, [nickname UTF8String], nickname.length + 1); +// Change the machine output by uname to match expected output on iOS +static int pt_uname(struct utsname *uts) { + uname(uts); strncpy(uts->machine, DEVICE_MODEL, strlen(DEVICE_MODEL) + 1); - } - return result; + return 0; } -static int my_sysctl(int *name, u_int types, void *buf, size_t *size, void *arg0, size_t arg1) { - if (name[0] == CTL_HW && (name[1] == HW_MACHINE || name[0] == HW_PRODUCT)) { - if (NULL == buf) { - *size = strlen(DEVICE_MODEL) + 1; - } else { - if (*size > strlen(DEVICE_MODEL)) { - strcpy(buf, DEVICE_MODEL); - } else { - return ENOMEM; - } +// Update output of sysctl for key values hw.machine, hw.product and hw.target to match iOS output +// This spoofs the device type to apps allowing us to report as any iOS device +static int pt_sysctl(int *name, u_int types, void *buf, size_t *size, void *arg0, size_t arg1) { + if (name[0] == CTL_HW && (name[1] == HW_MACHINE || name[0] == HW_PRODUCT)) { + if (NULL == buf) { + *size = strlen(DEVICE_MODEL) + 1; + } else { + if (*size > strlen(DEVICE_MODEL)) { + strcpy(buf, DEVICE_MODEL); + } else { + return ENOMEM; + } + } + return 0; + } else if (name[0] == CTL_HW && (name[1] == HW_TARGET)) { + if (NULL == buf) { + *size = strlen(OEM_ID) + 1; + } else { + if (*size > strlen(OEM_ID)) { + strcpy(buf, OEM_ID); + } else { + return ENOMEM; + } + } + return 0; } - return 0; - } else if (name[0] == CTL_HW && (name[1] == HW_TARGET)) { - if (NULL == buf) { - *size = strlen(OEM_ID) + 1; - } else { - if (*size > strlen(OEM_ID)) { - strcpy(buf, OEM_ID); - } else { - return ENOMEM; - } - } - return 0; - } - return sysctl(name, types, buf, size, arg0, arg1); + return sysctl(name, types, buf, size, arg0, arg1); } -static int my_sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, - size_t newlen) { - if ((strcmp(name, "hw.machine") == 0) || (strcmp(name, "hw.product") == 0) || - (strcmp(name, "hw.model") == 0)) { - if (oldp != NULL) { - int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); - const char *machine = DEVICE_MODEL; - strncpy((char *)oldp, machine, strlen(machine)); - *oldlenp = strlen(machine); - return ret; - } else { - int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); - return ret; - } - } else if ((strcmp(name, "hw.target") == 0)) { - if (oldp != NULL) { - int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); - const char *machine = OEM_ID; - strncpy((char *)oldp, machine, strlen(machine)); - *oldlenp = strlen(machine); - return ret; +static int pt_sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) { + if ((strcmp(name, "hw.machine") == 0) || (strcmp(name, "hw.product") == 0) || (strcmp(name, "hw.model") == 0)) { + if (oldp != NULL) { + int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); + const char *machine = DEVICE_MODEL; + strncpy((char *)oldp, machine, strlen(machine)); + *oldlenp = strlen(machine); + return ret; + } else { + int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); + return ret; + } + } else if ((strcmp(name, "hw.target") == 0)) { + if (oldp != NULL) { + int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); + const char *machine = OEM_ID; + strncpy((char *)oldp, machine, strlen(machine)); + *oldlenp = strlen(machine); + return ret; + } else { + int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); + return ret; + } } else { - int ret = sysctlbyname(name, oldp, oldlenp, newp, newlen); - return ret; + return sysctlbyname(name, oldp, oldlenp, newp, newlen); } - } else { - return sysctlbyname(name, oldp, oldlenp, newp, newlen); - } -} - -static bool isGenshin = false; - -extern int csops(pid_t pid, unsigned int ops, user_addr_t useraddr, size_t usersize); - -int my_csops(pid_t pid, uint32_t ops, user_addr_t useraddr, user_size_t usersize) { - if (isGenshin) { - if (ops == CS_OPS_STATUS || ops == CS_OPS_IDENTITY) { - printf("Hooking %s: %s wrapper \n", DEVICE_MODEL, OEM_ID); - printf("Hooked CSOPS %d \n", ops); - return 0; - } - } - - return csops(pid, ops, useraddr, usersize); } -DYLD_INTERPOSE(my_csops, csops) -DYLD_INTERPOSE(my_dyld_get_active_platform, dyld_get_active_platform) -DYLD_INTERPOSE(my_dyld_get_base_platform, dyld_get_base_platform) -DYLD_INTERPOSE(my_uname, uname) -DYLD_INTERPOSE(my_sysctlbyname, sysctlbyname) -DYLD_INTERPOSE(my_sysctl, sysctl) +// Interpose the functions create the wrapper +DYLD_INTERPOSE(pt_dyld_get_active_platform, dyld_get_active_platform) +DYLD_INTERPOSE(pt_uname, uname) +DYLD_INTERPOSE(pt_sysctlbyname, sysctlbyname) +DYLD_INTERPOSE(pt_sysctl, sysctl) @implementation PlayLoader static void __attribute__((constructor)) initialize(void) { - NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier]; - isGenshin = - [bundleId isEqual:@"com.miHoYo.GenshinImpact"] || [bundleId isEqual:@"com.miHoYo.Yuanshen"]; - [PlayCover launch]; + [PlayCover launch]; } @end diff --git a/PlayTools/PlayScreen.swift b/PlayTools/PlayScreen.swift index 4f124384..b933df85 100644 --- a/PlayTools/PlayScreen.swift +++ b/PlayTools/PlayScreen.swift @@ -120,7 +120,11 @@ public class PlayScreen: NSObject { } var window: UIWindow? { - return UIApplication.shared.windows.first + return UIApplication.shared.connectedScenes + .filter({$0.activationState == .foregroundActive}) + .compactMap({$0 as? UIWindowScene}) + .first?.windows + .filter({$0.isKeyWindow}).first } var nsWindow: NSObject? { diff --git a/PlayTools/PlayUI.swift b/PlayTools/PlayUI.swift deleted file mode 100644 index 702d1c88..00000000 --- a/PlayTools/PlayUI.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// PlayViews.swift -// PlayTools -// - -import Foundation -import UIKit - -class PlayUI { - static let shared = PlayUI() - - func showAlert(_ title: String, _ content: String) { - let alertController = UIAlertController(title: title, message: content, preferredStyle: .alert) - PlayInput.shared.root?.present(alertController, animated: true, completion: nil) - } - - func showLauncherWarning() { - let alertController = UIAlertController(title: "PlayCover Launcher is not found!", - message: "Please, install it from playcover.io site to use this app.", - preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: "OK", style: .default) { _ in - AKInterface.shared!.terminateApplication() - }) - PlayInput.shared.root?.present(alertController, animated: true, completion: nil) - } -}