Merge pull request #1372 from Wevah/debug-menu-default

Enable ShowDebugMenu on master
This commit is contained in:
Maurice Parker 2019-11-29 13:23:44 -06:00 committed by GitHub
commit 514a498641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 8 deletions

View File

@ -34,6 +34,7 @@ struct AppDefaults {
static let exportOPMLAccountID = "exportOPMLAccountID"
// Hidden prefs
static let showDebugMenu = "ShowDebugMenu"
static let timelineShowsSeparators = "CorreiaSeparators"
static let showTitleOnMainWindow = "KafasisTitleMode"
static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount"
@ -149,6 +150,10 @@ struct AppDefaults {
return bool(for: Key.showTitleOnMainWindow)
}
static var showDebugMenu: Bool {
return bool(for: Key.showDebugMenu)
}
static var hideDockUnreadCount: Bool {
return bool(for: Key.hideDockUnreadCount)
}
@ -215,6 +220,12 @@ struct AppDefaults {
}
static func registerDefaults() {
#if DEBUG
let showDebugMenu = true
#else
let showDebugMenu = false
#endif
let defaults: [String : Any] = [Key.lastImageCacheFlushDate: Date(),
Key.sidebarFontSize: FontSize.medium.rawValue,
Key.timelineFontSize: FontSize.medium.rawValue,
@ -222,7 +233,8 @@ struct AppDefaults {
Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue,
Key.timelineGroupByFeed: false,
"NSScrollViewShouldScrollUnderTitlebar": false,
Key.refreshInterval: RefreshInterval.everyHour.rawValue]
Key.refreshInterval: RefreshInterval.everyHour.rawValue,
Key.showDebugMenu: showDebugMenu]
UserDefaults.standard.register(defaults: defaults)

View File

@ -220,18 +220,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
UNUserNotificationCenter.current().delegate = self
userNotificationManager = UserNotificationManager()
#if RELEASE
if AppDefaults.showDebugMenu {
refreshTimer!.update()
syncTimer!.update()
// The Web Inspector uses SPI and can never appear in a MAC_APP_STORE build.
#if MAC_APP_STORE
let debugMenu = debugMenuItem.submenu!
let toggleWebInspectorItemIndex = debugMenu.indexOfItem(withTarget: self, andAction: #selector(toggleWebInspectorEnabled(_:)))
if toggleWebInspectorItemIndex != -1 {
debugMenu.removeItem(at: toggleWebInspectorItemIndex)
}
#endif
} else {
debugMenuItem.menu?.removeItem(debugMenuItem)
DispatchQueue.main.async {
self.refreshTimer!.timedRefresh(nil)
self.syncTimer!.timedRefresh(nil)
}
#endif
#if DEBUG
refreshTimer!.update()
syncTimer!.update()
#endif
}
#if !MAC_APP_STORE
DispatchQueue.main.async {