From 1e840f3090265c959cc208acd83b3fdc3681297b Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Tue, 17 Sep 2019 13:42:18 -0500 Subject: [PATCH] Move WebKit "inspector starts attached" user default to AppDefaults --- Mac/AppDefaults.swift | 10 ++++++++++ Mac/AppDelegate.swift | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Mac/AppDefaults.swift b/Mac/AppDefaults.swift index c35d99644..175d75dc8 100644 --- a/Mac/AppDefaults.swift +++ b/Mac/AppDefaults.swift @@ -38,6 +38,7 @@ struct AppDefaults { static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount" static let webInspectorEnabled = "WebInspectorEnabled" + static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached" } private static let smallestFontSizeRawValue = FontSize.small.rawValue @@ -149,6 +150,15 @@ struct AppDefaults { } } + static var webInspectorStartsAttached: Bool { + get { + return bool(for: Key.webInspectorStartsAttached) + } + set { + setBool(for: Key.webInspectorStartsAttached, newValue) + } + } + static var timelineSortDirection: ComparisonResult { get { return sortDirection(for: Key.timelineSortDirection) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 9679cfc2f..fca38aae0 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -534,7 +534,7 @@ extension AppDelegate { AppDefaults.webInspectorEnabled = newValue // An attached inspector can display incorrectly on certain setups (like mine); default to displaying in a separate window, // and reset to a separate window when the preference is toggled off and on again in case the inspector is accidentally reattached. - UserDefaults.standard.set(false, forKey: "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached") + AppDefaults.webInspectorStartsAttached = false NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue) } }