Merge branch 'mac-release'

This commit is contained in:
Maurice Parker 2019-09-19 11:59:01 -05:00
commit d3a5bdf6d3
5 changed files with 57 additions and 39 deletions

View File

@ -38,8 +38,10 @@ struct AppDefaults {
static let showTitleOnMainWindow = "KafasisTitleMode" static let showTitleOnMainWindow = "KafasisTitleMode"
static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount" static let hideDockUnreadCount = "JustinMillerHideDockUnreadCount"
#if !MAC_APP_STORE
static let webInspectorEnabled = "WebInspectorEnabled" static let webInspectorEnabled = "WebInspectorEnabled"
static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached" static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached"
#endif
} }
private static let smallestFontSizeRawValue = FontSize.small.rawValue private static let smallestFontSizeRawValue = FontSize.small.rawValue
@ -142,6 +144,7 @@ struct AppDefaults {
return bool(for: Key.hideDockUnreadCount) return bool(for: Key.hideDockUnreadCount)
} }
#if !MAC_APP_STORE
static var webInspectorEnabled: Bool { static var webInspectorEnabled: Bool {
get { get {
return bool(for: Key.webInspectorEnabled) return bool(for: Key.webInspectorEnabled)
@ -159,6 +162,7 @@ struct AppDefaults {
setBool(for: Key.webInspectorStartsAttached, newValue) setBool(for: Key.webInspectorStartsAttached, newValue)
} }
} }
#endif
static var timelineSortDirection: ComparisonResult { static var timelineSortDirection: ComparisonResult {
get { get {

View File

@ -314,9 +314,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) { if item.action == #selector(showAddFeedWindow(_:)) || item.action == #selector(showAddFolderWindow(_:)) {
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
} }
#if !MAC_APP_STORE
if item.action == #selector(toggleWebInspectorEnabled(_:)) { if item.action == #selector(toggleWebInspectorEnabled(_:)) {
(item as! NSMenuItem).state = AppDefaults.webInspectorEnabled ? .on : .off (item as! NSMenuItem).state = AppDefaults.webInspectorEnabled ? .on : .off
} }
#endif
return true return true
} }
@ -540,6 +542,7 @@ extension AppDelegate {
} }
@IBAction func toggleWebInspectorEnabled(_ sender: Any?) { @IBAction func toggleWebInspectorEnabled(_ sender: Any?) {
#if !MAC_APP_STORE
let newValue = !AppDefaults.webInspectorEnabled let newValue = !AppDefaults.webInspectorEnabled
AppDefaults.webInspectorEnabled = newValue AppDefaults.webInspectorEnabled = newValue
@ -549,6 +552,7 @@ extension AppDelegate {
AppDefaults.webInspectorStartsAttached = false AppDefaults.webInspectorStartsAttached = false
NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue) NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue)
#endif
} }
} }

View File

@ -480,7 +480,7 @@
<menuItem title="Enable Web Inspector" id="EwI-z4-ZA3"> <menuItem title="Enable Web Inspector" id="EwI-z4-ZA3">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="toggleWebInspectorEnabled:" target="Voe-Tx-rLC" id="nsd-PV-Tz2"/> <action selector="toggleWebInspectorEnabled:" target="Voe-Tx-rLC" id="SNL-zh-XIE"/>
</connections> </connections>
</menuItem> </menuItem>
</items> </items>
@ -596,6 +596,7 @@
<outlet property="checkForUpdatesMenuItem" destination="1nF-7O-aKU" id="JmT-jc-DJ8"/> <outlet property="checkForUpdatesMenuItem" destination="1nF-7O-aKU" id="JmT-jc-DJ8"/>
<outlet property="debugMenuItem" destination="UqE-mp-gtV" id="OnR-lr-Zlt"/> <outlet property="debugMenuItem" destination="UqE-mp-gtV" id="OnR-lr-Zlt"/>
<outlet property="groupArticlesByFeedMenuItem" destination="Zxm-O6-NRE" id="gwn-VT-2YZ"/> <outlet property="groupArticlesByFeedMenuItem" destination="Zxm-O6-NRE" id="gwn-VT-2YZ"/>
<outlet property="enableWebInspectorMenuItem" destination="EwI-z4-ZA3" id="EGp-lP-f91"/>
<outlet property="sortByNewestArticleOnTopMenuItem" destination="TNS-TV-n0U" id="gix-Nd-9k4"/> <outlet property="sortByNewestArticleOnTopMenuItem" destination="TNS-TV-n0U" id="gix-Nd-9k4"/>
<outlet property="sortByOldestArticleOnTopMenuItem" destination="iii-kP-qoF" id="fTe-Tf-EWG"/> <outlet property="sortByOldestArticleOnTopMenuItem" destination="iii-kP-qoF" id="fTe-Tf-EWG"/>
</connections> </connections>

View File

@ -28,6 +28,7 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
} }
} }
#if !MAC_APP_STORE
private var webInspectorEnabled: Bool { private var webInspectorEnabled: Bool {
get { get {
return webView.configuration.preferences._developerExtrasEnabled return webView.configuration.preferences._developerExtrasEnabled
@ -36,6 +37,7 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
webView.configuration.preferences._developerExtrasEnabled = newValue webView.configuration.preferences._developerExtrasEnabled = newValue
} }
} }
#endif
private var waitingForFirstReload = false private var waitingForFirstReload = false
private let keyboardDelegate = DetailKeyboardDelegate() private let keyboardDelegate = DetailKeyboardDelegate()
@ -96,9 +98,11 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
webView.isHidden = true webView.isHidden = true
waitingForFirstReload = true waitingForFirstReload = true
#if !MAC_APP_STORE
webInspectorEnabled = AppDefaults.webInspectorEnabled webInspectorEnabled = AppDefaults.webInspectorEnabled
NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil)
#endif
reloadHTML() reloadHTML()
} }
@ -201,9 +205,11 @@ private extension DetailWebViewController {
} }
} }
#if !MAC_APP_STORE
@objc func webInspectorEnabledDidChange(_ notification: Notification) { @objc func webInspectorEnabledDidChange(_ notification: Notification) {
self.webInspectorEnabled = notification.object! as! Bool self.webInspectorEnabled = notification.object! as! Bool
} }
#endif
} }
// MARK: - ScrollInfo // MARK: - ScrollInfo

View File

@ -13,7 +13,10 @@ extension Notification.Name {
static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification") static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification")
static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification") static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification")
static let UserDidRequestSidebarSelection = Notification.Name("UserDidRequestSidebarSelectionNotification") static let UserDidRequestSidebarSelection = Notification.Name("UserDidRequestSidebarSelectionNotification")
#if !MAC_APP_STORE
static let WebInspectorEnabledDidChange = Notification.Name("WebInspectorEnabledDidChange") static let WebInspectorEnabledDidChange = Notification.Name("WebInspectorEnabledDidChange")
#endif
} }
typealias UserInfoDictionary = [AnyHashable: Any] typealias UserInfoDictionary = [AnyHashable: Any]