Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74556927be | |||
| fee9e30df9 | |||
| 5e2b5feca4 | |||
| 3ffdde8904 |
@@ -162,7 +162,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
|
||||
/// Gesture endpoints. Each point represents a corner of the screen. TODO: Handle screen rotation.
|
||||
var possibleEndpoints: [CGPoint] {
|
||||
guard let consoleWindow else { return [] }
|
||||
guard let consoleWindow = consoleWindow else { return [] }
|
||||
|
||||
let screenSize = viewController.view.frame.size
|
||||
|
||||
@@ -580,10 +580,9 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
// MARK: Handle keyboard show/hide.
|
||||
private var keyboardHeight: CGFloat? = nil {
|
||||
didSet {
|
||||
|
||||
temporaryKeyboardHeightValueTracker = oldValue
|
||||
|
||||
if consoleView.center != possibleEndpoints[0] && consoleView.center != possibleEndpoints[1] {
|
||||
if possibleEndpoints.count > 2, consoleView.center != possibleEndpoints[0] && consoleView.center != possibleEndpoints[1] {
|
||||
let nearestTargetPosition = nearestTargetTo(consoleView.center, possibleTargets: possibleEndpoints.suffix(2))
|
||||
|
||||
UIViewPropertyAnimator(duration: 0.55, dampingRatio: 1) {
|
||||
@@ -1179,28 +1178,19 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
|
||||
|
||||
// Custom window for the console to appear above other windows while passing touches down.
|
||||
class ConsoleWindow: UIWindow {
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
|
||||
if let hitView = super.hitTest(point, with: event) {
|
||||
return hitView.isKind(of: ConsoleWindow.self) ? nil : hitView
|
||||
}
|
||||
return super.hitTest(point, with: event)
|
||||
}
|
||||
}
|
||||
|
||||
// Custom view for the console to appear above other windows while passing touches down.
|
||||
class PassthroughView: UIView {
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
|
||||
if let hitView = super.hitTest(point, with: event) {
|
||||
return hitView.isKind(of: PassthroughView.self) ? nil : hitView
|
||||
if hitView.isKind(of: PassthroughView.self) {
|
||||
return nil
|
||||
}
|
||||
return hitView
|
||||
}
|
||||
return super.hitTest(point, with: event)
|
||||
}
|
||||
}
|
||||
|
||||
// Custom view that is passed through if it is the returned hitTest for ConsoleWindow.
|
||||
class PassthroughView: UIView { }
|
||||
|
||||
import UIKit.UIGestureRecognizerSubclass
|
||||
|
||||
@@ -1280,41 +1270,56 @@ class SwizzleTool: NSObject {
|
||||
class LumaView: UIView {
|
||||
lazy var visualEffectView: UIView = {
|
||||
Bundle(path: "/Sys" + "tem/Lib" + "rary/Private" + "Framework" + "s/Material" + "Kit." + "framework")!.load()
|
||||
|
||||
let Pill = NSClassFromString("MT" + "Luma" + "Dodge" + "Pill" + "View") as! UIView.Type
|
||||
|
||||
let pillView = Pill.init()
|
||||
|
||||
enum Style: Int {
|
||||
case none = 0
|
||||
case thin = 1
|
||||
case gray = 2
|
||||
case black = 3
|
||||
case white = 4
|
||||
|
||||
if let Pill = NSClassFromString("MT" + "Luma" + "Dodge" + "Pill" + "View") as? UIView.Type {
|
||||
|
||||
let pillView = Pill.init()
|
||||
|
||||
enum Style: Int {
|
||||
case none = 0
|
||||
case thin = 1
|
||||
case gray = 2
|
||||
case black = 3
|
||||
case white = 4
|
||||
}
|
||||
|
||||
enum BackgroundLuminance: Int {
|
||||
case unknown = 0
|
||||
case dark = 1
|
||||
case light = 2
|
||||
}
|
||||
|
||||
pillView.setValue(2, forKey: "style")
|
||||
pillView.setValue(1, forKey: "background" + "Luminance")
|
||||
pillView.perform(NSSelectorFromString("_" + "update" + "Style"))
|
||||
|
||||
addSubview(pillView)
|
||||
|
||||
pillView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
pillView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
pillView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
pillView.topAnchor.constraint(equalTo: topAnchor),
|
||||
pillView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
])
|
||||
|
||||
return pillView
|
||||
} else {
|
||||
let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterialDark))
|
||||
addSubview(visualEffectView)
|
||||
|
||||
visualEffectView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
visualEffectView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
visualEffectView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
visualEffectView.topAnchor.constraint(equalTo: topAnchor),
|
||||
visualEffectView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
])
|
||||
|
||||
return visualEffectView
|
||||
}
|
||||
|
||||
enum BackgroundLuminance: Int {
|
||||
case unknown = 0
|
||||
case dark = 1
|
||||
case light = 2
|
||||
}
|
||||
|
||||
pillView.setValue(2, forKey: "style")
|
||||
pillView.setValue(1, forKey: "background" + "Luminance")
|
||||
pillView.perform(NSSelectorFromString("_" + "update" + "Style"))
|
||||
|
||||
addSubview(pillView)
|
||||
|
||||
pillView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
pillView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
pillView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
pillView.topAnchor.constraint(equalTo: topAnchor),
|
||||
pillView.bottomAnchor.constraint(equalTo: bottomAnchor)
|
||||
])
|
||||
|
||||
return pillView
|
||||
}()
|
||||
|
||||
lazy var foregroundView: UIView = {
|
||||
|
||||
Reference in New Issue
Block a user