Move WebKit "inspector starts attached" user default to AppDefaults

This commit is contained in:
Nate Weaver 2019-09-17 13:42:18 -05:00
parent 4a2724bcc4
commit 1e840f3090
2 changed files with 11 additions and 1 deletions

View File

@ -38,6 +38,7 @@ struct AppDefaults {
static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount" static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount"
static let webInspectorEnabled = "WebInspectorEnabled" static let webInspectorEnabled = "WebInspectorEnabled"
static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached"
} }
private static let smallestFontSizeRawValue = FontSize.small.rawValue 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 { static var timelineSortDirection: ComparisonResult {
get { get {
return sortDirection(for: Key.timelineSortDirection) return sortDirection(for: Key.timelineSortDirection)

View File

@ -534,7 +534,7 @@ extension AppDelegate {
AppDefaults.webInspectorEnabled = newValue AppDefaults.webInspectorEnabled = newValue
// An attached inspector can display incorrectly on certain setups (like mine); default to displaying in a separate window, // 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. // 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) NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue)
} }
} }