TitlebarView: move to drag api

This commit is contained in:
James Magahern
2024-05-10 17:01:14 -07:00
parent eec57f5f31
commit 6dccb25b3e
2 changed files with 8 additions and 6 deletions

View File

@@ -31,7 +31,8 @@ class ResourcePolicyManager: NSObject, SBRResourceOriginPolicyDataSource
func allowedOriginsForScriptResources() -> Set<String> { 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<String, ScriptPolicy.PolicyType> = {

View File

@@ -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) {