From 7f58422900e6b1a98f9c0d90c1d3cae24acab7af Mon Sep 17 00:00:00 2001 From: Chase Carroll Date: Mon, 5 Dec 2022 10:32:10 -0500 Subject: [PATCH] Add debug menu option Puts an option in the debug menu for toggling on/off visible touches. --- .../HomeTimeline/HomeTimelineViewController+DebugAction.swift | 4 ++++ .../Sources/MastodonUI/View/Window/TouchesVisibleWindow.swift | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift index ff90775ff..6bded8c37 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift @@ -122,6 +122,10 @@ extension HomeTimelineViewController { identifier: nil, options: [], children: [ + UIAction(title: "Toggle Visible Touches", image: UIImage(systemName: "hand.tap"), attributes: []) { [weak self] action in + guard let window = UIApplication.shared.keyWindow as? TouchesVisibleWindow else { return } + window.touchesVisible = !window.touchesVisible + }, UIAction(title: "Toggle EmptyView", image: UIImage(systemName: "clear"), attributes: []) { [weak self] action in guard let self = self else { return } if self.emptyView.superview != nil { diff --git a/MastodonSDK/Sources/MastodonUI/View/Window/TouchesVisibleWindow.swift b/MastodonSDK/Sources/MastodonUI/View/Window/TouchesVisibleWindow.swift index 26971ef1e..7a8a37976 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Window/TouchesVisibleWindow.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Window/TouchesVisibleWindow.swift @@ -49,7 +49,7 @@ fileprivate final class TouchView: UIView { public final class TouchesVisibleWindow: UIWindow { - var touchesVisible = false { + public var touchesVisible = false { didSet { if !touchesVisible { cleanUpAllTouches()