From abd5c45bb27ff739dcbd56e1e2265eb4b0502371 Mon Sep 17 00:00:00 2001 From: Min Sujin Date: Thu, 5 Sep 2024 14:24:34 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EC=BD=98=EC=86=94=20=EC=88=A8=EA=B9=80=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/LocalConsole/LCManager.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/LocalConsole/LCManager.swift b/Sources/LocalConsole/LCManager.swift index cbf404a..4546933 100644 --- a/Sources/LocalConsole/LCManager.swift +++ b/Sources/LocalConsole/LCManager.swift @@ -872,6 +872,10 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { } } + let hide = UIAction(title: "Hide Console", image: UIImage(systemName: "eye.slash")) { [weak self] _ in + self?.isVisible = false + } + // If device is phone in landscape, disable resize controller. if UIDevice.current.userInterfaceIdiom == .phone && consoleViewController.view.frame.width > consoleViewController.view.frame.height { resize.attributes = .disabled @@ -1086,9 +1090,9 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { var menuContent: [UIMenuElement] = [] if consoleTextView.text != "" { - menuContent.append(contentsOf: [UIMenu(title: "", options: .displayInline, children: [share, resize])]) + menuContent.append(contentsOf: [UIMenu(title: "", options: .displayInline, children: [share, resize, hide])]) } else { - menuContent.append(UIMenu(title: "", options: .displayInline, children: [resize])) + menuContent.append(UIMenu(title: "", options: .displayInline, children: [resize, hide])) } menuContent.append(debugMenu) From e06a5599675274f545bbae1b922c1536599d114b Mon Sep 17 00:00:00 2001 From: Min Sujin Date: Thu, 5 Sep 2024 15:35:27 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=EB=94=94=EB=B2=84=EA=B7=B8=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=20=EC=88=A8=EA=B9=80=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/LocalConsole/LCManager.swift | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Sources/LocalConsole/LCManager.swift b/Sources/LocalConsole/LCManager.swift index 4546933..4d0e2ee 100644 --- a/Sources/LocalConsole/LCManager.swift +++ b/Sources/LocalConsole/LCManager.swift @@ -1078,14 +1078,15 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { debugActions.append(contentsOf: [viewFrames, systemReport, displayReport]) let destructActions = [terminateApplication , respring] - - let debugMenu = UIMenu( - title: "Debug", image: UIImage(systemName: "ant"), - children: [ - UIMenu(title: "", options: .displayInline, children: debugActions), - UIMenu(title: "", options: .displayInline, children: destructActions), - ] - ) + + // 디버그 메뉴 숨김 처리 +// let debugMenu = UIMenu( +// title: "Debug", image: UIImage(systemName: "ant"), +// children: [ +// UIMenu(title: "", options: .displayInline, children: debugActions), +// UIMenu(title: "", options: .displayInline, children: destructActions), +// ] +// ) var menuContent: [UIMenuElement] = [] @@ -1095,7 +1096,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { menuContent.append(UIMenu(title: "", options: .displayInline, children: [resize, hide])) } - menuContent.append(debugMenu) +// menuContent.append(debugMenu) if let customMenu = menu { menuContent.append(customMenu) } From 11d501170cbcd347e74aa7cee6ffd41a9ebe0d84 Mon Sep 17 00:00:00 2001 From: Min Sujin Date: Thu, 5 Sep 2024 15:37:35 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EC=8B=9C=20=ED=95=98=EB=8B=A8=20=EB=A7=A8=20=EC=95=84?= =?UTF-8?q?=EB=9E=98=EA=B9=8C=EC=A7=80=20=EC=8A=A4=ED=81=AC=EB=A1=A4?= =?UTF-8?q?=EC=9D=B4=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/LocalConsole/LCManager.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Sources/LocalConsole/LCManager.swift b/Sources/LocalConsole/LCManager.swift index 4d0e2ee..fee9307 100644 --- a/Sources/LocalConsole/LCManager.swift +++ b/Sources/LocalConsole/LCManager.swift @@ -817,8 +817,8 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { if consoleTextView.contentOffset.y > consoleTextView.contentSize.height - consoleTextView.bounds.size.height - 20 { // Weird, weird fix that makes the scroll view bottom pinning system work. - consoleTextView.isScrollEnabled.toggle() - consoleTextView.isScrollEnabled.toggle() +// consoleTextView.isScrollEnabled.toggle() +// consoleTextView.isScrollEnabled.toggle() consoleTextView.pendingOffsetChange = true } @@ -841,7 +841,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { .font: UIFont.systemFont(ofSize: fontSize, weight: .semibold, design: .monospaced) ] - consoleTextView.attributedText = NSAttributedString(string: string, attributes: attributes) + consoleTextView.setAttributedText(NSAttributedString(string: string, attributes: attributes)) } // Displays all UserDefaults keys, including unneeded keys that are included by default. @@ -1474,13 +1474,20 @@ class LumaView: UIView { class InvertedTextView: UITextView { var pendingOffsetChange = false - + + func setAttributedText(_ attributedText: NSAttributedString) { + self.attributedText = attributedText + self.layoutIfNeeded() + } + // Thanks to WWDC21 UIKit Lab! override func layoutSubviews() { super.layoutSubviews() if panGestureRecognizer.numberOfTouches == 0 && pendingOffsetChange { - contentOffset.y = contentSize.height - bounds.size.height + DispatchQueue.main.async { + self.contentOffset.y = self.contentSize.height - self.bounds.size.height + } } else { pendingOffsetChange = false } From 1c9c44a2835c780cc53c625c6f9c26ad529240e0 Mon Sep 17 00:00:00 2001 From: Min Sujin Date: Fri, 6 Sep 2024 17:25:21 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=9D=B8?= =?UTF-8?q?=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/LocalConsole/LCManager.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/LocalConsole/LCManager.swift b/Sources/LocalConsole/LCManager.swift index fee9307..4a5cb15 100644 --- a/Sources/LocalConsole/LCManager.swift +++ b/Sources/LocalConsole/LCManager.swift @@ -271,7 +271,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { consoleView.layer.shadowOffset = CGSize(width: 0, height: 2) consoleView.alpha = 0 - consoleView.layer.cornerRadius = 24 + consoleView.layer.cornerRadius = 20 consoleView.layer.cornerCurve = .continuous let _ = lumaView @@ -297,7 +297,9 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate { consoleTextView.textContainerInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) consoleTextView.isSelectable = false - consoleTextView.showsVerticalScrollIndicator = false + consoleTextView.indicatorStyle = .white + consoleTextView.showsVerticalScrollIndicator = true + consoleTextView.scrollIndicatorInsets = UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0) consoleTextView.contentInsetAdjustmentBehavior = .never consoleView.addSubview(consoleTextView)