The Debug menu can now be enabled in release builds.
`defaults write com.ranchero.NetNewsWire-Evergreen ShowDebugMenu -bool YES` Toggling the Web Inspector uses SPI, so it's always excluded from the Debug menu when building for the Mac App Store.
This commit is contained in:
parent
50276233d1
commit
be89df884d
|
@ -33,6 +33,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"
|
||||
|
@ -143,6 +144,10 @@ struct AppDefaults {
|
|||
return bool(for: Key.hideDockUnreadCount)
|
||||
}
|
||||
|
||||
static var showDebugMenu: Bool {
|
||||
return bool(for: Key.showDebugMenu)
|
||||
}
|
||||
|
||||
#if !MAC_APP_STORE
|
||||
static var webInspectorEnabled: Bool {
|
||||
get {
|
||||
|
@ -196,7 +201,22 @@ struct AppDefaults {
|
|||
}
|
||||
|
||||
static func registerDefaults() {
|
||||
let defaults: [String : Any] = [Key.lastImageCacheFlushDate: Date(), Key.sidebarFontSize: FontSize.medium.rawValue, Key.timelineFontSize: FontSize.medium.rawValue, Key.detailFontSize: FontSize.medium.rawValue, Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue, "NSScrollViewShouldScrollUnderTitlebar": false, Key.refreshInterval: RefreshInterval.everyHour.rawValue]
|
||||
#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,
|
||||
Key.detailFontSize: FontSize.medium.rawValue,
|
||||
Key.timelineSortDirection: ComparisonResult.orderedDescending.rawValue,
|
||||
"NSScrollViewShouldScrollUnderTitlebar": false,
|
||||
Key.refreshInterval: RefreshInterval.everyHour.rawValue,
|
||||
Key.showDebugMenu: showDebugMenu,
|
||||
]
|
||||
|
||||
UserDefaults.standard.register(defaults: defaults)
|
||||
|
||||
|
|
|
@ -175,18 +175,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
refreshTimer = AccountRefreshTimer()
|
||||
syncTimer = ArticleStatusSyncTimer()
|
||||
|
||||
#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 {
|
||||
|
@ -309,11 +316,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) {
|
||||
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
|
||||
}
|
||||
|
||||
#if !MAC_APP_STORE
|
||||
if item.action == #selector(toggleWebInspectorEnabled(_:)) {
|
||||
(item as! NSMenuItem).state = AppDefaults.webInspectorEnabled ? .on : .off
|
||||
}
|
||||
#endif
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue