From 6dccb25b3ef09057e107dfbec5808b4537858df8 Mon Sep 17 00:00:00 2001 From: James Magahern Date: Fri, 10 May 2024 17:01:14 -0700 Subject: [PATCH] TitlebarView: move to drag api --- App/Backend/ResourcePolicyManager.swift | 3 ++- App/Titlebar and URL Bar/TitlebarView.swift | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/App/Backend/ResourcePolicyManager.swift b/App/Backend/ResourcePolicyManager.swift index 5b16884..ffb74c3 100644 --- a/App/Backend/ResourcePolicyManager.swift +++ b/App/Backend/ResourcePolicyManager.swift @@ -31,7 +31,8 @@ class ResourcePolicyManager: NSObject, SBRResourceOriginPolicyDataSource func allowedOriginsForScriptResources() -> Set { allowedOriginSet } func scriptPolicyTypeByOrigin() -> [String : NSNumber] { - return scriptPolicies.mapValues { NSNumber(integerLiteral: $0.rawValue) } + let types = scriptPolicies.mapValues { NSNumber(integerLiteral: $0.rawValue) } + return types } private lazy var scriptPolicies: Dictionary = { diff --git a/App/Titlebar and URL Bar/TitlebarView.swift b/App/Titlebar and URL Bar/TitlebarView.swift index b10aa7b..63631a0 100644 --- a/App/Titlebar and URL Bar/TitlebarView.swift +++ b/App/Titlebar and URL Bar/TitlebarView.swift @@ -61,11 +61,7 @@ class TitlebarView: UIView private let separatorView = UIView(frame: .zero) private let securityIndicatorView = SecurityIndicatorView() - - override var _sceneDraggingBehaviorOnPan: _UIViewSceneDraggingBehaviorOnPan { - _UIViewSceneDraggingBehaviorOnPan.dragScene - } - + convenience init() { self.init(frame: .zero) addSubview(backgroundView) @@ -88,6 +84,11 @@ class TitlebarView: UIView securityIndicatorView.label.font = UIFont.systemFont(ofSize: 10.0) backgroundView.alpha = 0.98 + + // Make draggable + if #available(iOS 17.0, *) { + addInteraction(UIWindowSceneDragInteraction()) + } } func setTitle(_ title: String) {