Enable ShowDebugMenu on master

This commit is contained in:
Nate Weaver 2019-11-28 14:59:45 -06:00
parent 3d582270ad
commit 229f1604f0
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 {