Skip to content

Commit feb4bf3

Browse files
committed
Remove not-going-to-get-used MAC_APP_STORE define.
1 parent f96ba49 commit feb4bf3

File tree

5 files changed

+59
-114
lines changed

5 files changed

+59
-114
lines changed

Mac/AppDefaults.swift

+21-25
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ final class AppDefaults {
4949
static let showTitleOnMainWindow = "KafasisTitleMode"
5050
static let feedDoubleClickMarkAsRead = "GruberFeedDoubleClickMarkAsRead"
5151
static let suppressSyncOnLaunch = "DevroeSuppressSyncOnLaunch"
52-
53-
#if !MAC_APP_STORE
54-
static let webInspectorEnabled = "WebInspectorEnabled"
55-
static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached"
56-
#endif
52+
53+
static let webInspectorEnabled = "WebInspectorEnabled"
54+
static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached"
5755
}
58-
56+
5957
private static let smallestFontSizeRawValue = FontSize.small.rawValue
6058
private static let largestFontSizeRawValue = FontSize.veryLarge.rawValue
6159

@@ -237,27 +235,25 @@ final class AppDefaults {
237235
AppDefaults.setBool(for: Key.suppressSyncOnLaunch, newValue)
238236
}
239237
}
240-
241-
#if !MAC_APP_STORE
242-
var webInspectorEnabled: Bool {
243-
get {
244-
return AppDefaults.bool(for: Key.webInspectorEnabled)
245-
}
246-
set {
247-
AppDefaults.setBool(for: Key.webInspectorEnabled, newValue)
248-
}
238+
239+
var webInspectorEnabled: Bool {
240+
get {
241+
return AppDefaults.bool(for: Key.webInspectorEnabled)
249242
}
250-
251-
var webInspectorStartsAttached: Bool {
252-
get {
253-
return AppDefaults.bool(for: Key.webInspectorStartsAttached)
254-
}
255-
set {
256-
AppDefaults.setBool(for: Key.webInspectorStartsAttached, newValue)
257-
}
243+
set {
244+
AppDefaults.setBool(for: Key.webInspectorEnabled, newValue)
258245
}
259-
#endif
260-
246+
}
247+
248+
var webInspectorStartsAttached: Bool {
249+
get {
250+
return AppDefaults.bool(for: Key.webInspectorStartsAttached)
251+
}
252+
set {
253+
AppDefaults.setBool(for: Key.webInspectorStartsAttached, newValue)
254+
}
255+
}
256+
261257
var timelineSortDirection: ComparisonResult {
262258
get {
263259
return AppDefaults.sortDirection(for: Key.timelineSortDirection)

Mac/AppDelegate.swift

+20-55
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,7 @@ import RSCoreResources
1717
import Secrets
1818
import OSLog
1919
import CrashReporter
20-
21-
// If we're not going to import Sparkle, provide dummy protocols to make it easy
22-
// for AppDelegate to comply
23-
#if MAC_APP_STORE || TEST
24-
protocol SPUStandardUserDriverDelegate {}
25-
protocol SPUUpdaterDelegate {}
26-
#else
2720
import Sparkle
28-
#endif
2921

3022
var appDelegate: AppDelegate!
3123

@@ -100,22 +92,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
10092
private var inspectorWindowController: InspectorWindowController?
10193
private var crashReportWindowController: CrashReportWindowController? // For testing only
10294
private let appMovementMonitor = RSAppMovementMonitor()
103-
#if !MAC_APP_STORE && !TEST
10495
private var softwareUpdater: SPUUpdater!
10596
private var crashReporter: PLCrashReporter!
106-
#endif
107-
97+
10898
private var themeImportPath: String?
10999

110100
override init() {
111101
NSWindow.allowsAutomaticWindowTabbing = false
112102
super.init()
113103

114-
#if !MAC_APP_STORE
115104
let crashReporterConfig = PLCrashReporterConfig.defaultConfiguration()
116105
crashReporter = PLCrashReporter(configuration: crashReporterConfig)
117106
crashReporter.enable()
118-
#endif
119107

120108
AccountManager.shared = AccountManager(accountsFolder: Platform.dataSubfolder(forApplication: nil, folderName: "Accounts")!)
121109
ArticleThemesManager.shared = ArticleThemesManager(folderPath: Platform.dataSubfolder(forApplication: nil, folderName: "Themes")!)
@@ -171,22 +159,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
171159

172160
func applicationDidFinishLaunching(_ note: Notification) {
173161

174-
#if MAC_APP_STORE || TEST
175-
checkForUpdatesMenuItem.isHidden = true
176-
#else
177-
// Initialize Sparkle...
178-
let hostBundle = Bundle.main
179-
let updateDriver = SPUStandardUserDriver(hostBundle: hostBundle, delegate: self)
180-
self.softwareUpdater = SPUUpdater(hostBundle: hostBundle, applicationBundle: hostBundle, userDriver: updateDriver, delegate: self)
162+
// Initialize Sparkle...
163+
let hostBundle = Bundle.main
164+
let updateDriver = SPUStandardUserDriver(hostBundle: hostBundle, delegate: self)
165+
self.softwareUpdater = SPUUpdater(hostBundle: hostBundle, applicationBundle: hostBundle, userDriver: updateDriver, delegate: self)
166+
167+
do {
168+
try self.softwareUpdater.start()
169+
}
170+
catch {
171+
NSLog("Failed to start software updater with error: \(error)")
172+
}
181173

182-
do {
183-
try self.softwareUpdater.start()
184-
}
185-
catch {
186-
NSLog("Failed to start software updater with error: \(error)")
187-
}
188-
#endif
189-
190174
AppDefaults.shared.registerDefaults()
191175
let isFirstRun = AppDefaults.shared.isFirstRun
192176
if isFirstRun {
@@ -258,25 +242,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
258242
}
259243
#endif
260244

261-
if AppDefaults.shared.showDebugMenu {
262-
// The Web Inspector uses SPI and can never appear in a MAC_APP_STORE build.
263-
#if MAC_APP_STORE
264-
let debugMenu = debugMenuItem.submenu!
265-
let toggleWebInspectorItemIndex = debugMenu.indexOfItem(withTarget: self, andAction: #selector(toggleWebInspectorEnabled(_:)))
266-
if toggleWebInspectorItemIndex != -1 {
267-
debugMenu.removeItem(at: toggleWebInspectorItemIndex)
268-
}
269-
#endif
270-
} else {
245+
if !AppDefaults.shared.showDebugMenu {
271246
debugMenuItem.menu?.removeItem(debugMenuItem)
272247
}
273248

274-
#if !MAC_APP_STORE
275249
DispatchQueue.main.async {
276250
CrashReporter.check(crashReporter: self.crashReporter)
277251
}
278-
#endif
279-
280252
}
281253

282254
func application(_ application: NSApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([NSUserActivityRestoring]) -> Void) -> Bool {
@@ -456,12 +428,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
456428
return !isDisplayingSheet && !AccountManager.shared.activeAccounts.isEmpty
457429
}
458430

459-
#if !MAC_APP_STORE
460431
if item.action == #selector(toggleWebInspectorEnabled(_:)) {
461432
(item as! NSMenuItem).state = AppDefaults.shared.webInspectorEnabled ? .on : .off
462433
}
463-
#endif
464-
434+
465435
return true
466436
}
467437

@@ -682,11 +652,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
682652
}
683653

684654
@IBAction func checkForUpdates(_ sender: Any?) {
685-
#if !MAC_APP_STORE && !TEST
686-
self.softwareUpdater.checkForUpdates()
687-
#endif
655+
self.softwareUpdater.checkForUpdates()
688656
}
689-
690657
}
691658

692659
// MARK: - Debug Menu
@@ -728,18 +695,16 @@ extension AppDelegate {
728695
}
729696

730697
@IBAction func toggleWebInspectorEnabled(_ sender: Any?) {
731-
#if !MAC_APP_STORE
698+
732699
let newValue = !AppDefaults.shared.webInspectorEnabled
733700
AppDefaults.shared.webInspectorEnabled = newValue
734701

735-
// An attached inspector can display incorrectly on certain setups (like mine); default to displaying in a separate window,
736-
// and reset the default to a separate window when the preference is toggled off and on again in case the inspector is
737-
// accidentally reattached.
702+
// An attached inspector can display incorrectly on certain setups (like mine); default to displaying in a separate window,
703+
// and reset the default to a separate window when the preference is toggled off and on again in case the inspector is
704+
// accidentally reattached.
738705
AppDefaults.shared.webInspectorStartsAttached = false
739-
NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue)
740-
#endif
706+
NotificationCenter.default.post(name: .WebInspectorEnabledDidChange, object: newValue)
741707
}
742-
743708
}
744709

745710
internal extension AppDelegate {

Mac/MainWindow/Detail/DetailWebViewController.swift

+14-20
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,15 @@ final class DetailWebViewController: NSViewController {
4747
}
4848

4949
private var articleTextSize = AppDefaults.shared.articleTextSize
50-
51-
#if !MAC_APP_STORE
52-
private var webInspectorEnabled: Bool {
53-
get {
54-
return webView.configuration.preferences._developerExtrasEnabled
55-
}
56-
set {
57-
webView.configuration.preferences._developerExtrasEnabled = newValue
58-
}
50+
51+
private var webInspectorEnabled: Bool {
52+
get {
53+
return webView.configuration.preferences._developerExtrasEnabled
54+
}
55+
set {
56+
webView.configuration.preferences._developerExtrasEnabled = newValue
5957
}
60-
#endif
58+
}
6159

6260
private let detailIconSchemeHandler = DetailIconSchemeHandler()
6361
private var waitingForFirstReload = false
@@ -98,11 +96,9 @@ final class DetailWebViewController: NSViewController {
9896
// See bug #901.
9997
webView.isHidden = true
10098
waitingForFirstReload = true
101-
102-
#if !MAC_APP_STORE
103-
webInspectorEnabled = AppDefaults.shared.webInspectorEnabled
104-
NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil)
105-
#endif
99+
100+
webInspectorEnabled = AppDefaults.shared.webInspectorEnabled
101+
NotificationCenter.default.addObserver(self, selector: #selector(webInspectorEnabledDidChange(_:)), name: .WebInspectorEnabledDidChange, object: nil)
106102

107103
NotificationCenter.default.addObserver(self, selector: #selector(feedIconDidBecomeAvailable(_:)), name: .feedIconDidBecomeAvailable, object: nil)
108104
NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil)
@@ -322,11 +318,9 @@ private extension DetailWebViewController {
322318
}
323319
}
324320

325-
#if !MAC_APP_STORE
326-
@objc func webInspectorEnabledDidChange(_ notification: Notification) {
327-
self.webInspectorEnabled = notification.object! as! Bool
328-
}
329-
#endif
321+
@objc func webInspectorEnabledDidChange(_ notification: Notification) {
322+
self.webInspectorEnabled = notification.object! as! Bool
323+
}
330324
}
331325

332326
// MARK: - ScrollInfo

Mac/Preferences/PreferencesWindowController.swift

+3-10
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,9 @@ class PreferencesWindowController : NSWindowController, NSToolbarDelegate {
3939
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Accounts,
4040
name: NSLocalizedString("Accounts", comment: "Preferences"),
4141
image: AppAssets.preferencesToolbarAccountsImage)]
42-
43-
// Omit the Advanced Preferences for now because the Software Update related functionality is
44-
// forbidden/non-applicable, and we can rely upon Apple to some extent for crash reports. We
45-
// can add back the Crash Reporter preferences when we're ready to dynamically shuffle the rest
46-
// of the content in this tab.
47-
#if !MAC_APP_STORE
48-
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced,
49-
name: NSLocalizedString("Advanced", comment: "Preferences"),
50-
image: AppAssets.preferencesToolbarAdvancedImage)]
51-
#endif
42+
specs += [PreferencesToolbarItemSpec(identifierRawValue: ToolbarItemIdentifier.Advanced,
43+
name: NSLocalizedString("Advanced", comment: "Preferences"),
44+
image: AppAssets.preferencesToolbarAdvancedImage)]
5245
return specs
5346
}()
5447

Shared/AppNotifications.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@ import Articles
1212
extension Notification.Name {
1313
static let InspectableObjectsDidChange = Notification.Name("TimelineSelectionDidChangeNotification")
1414
static let UserDidAddFeed = Notification.Name("UserDidAddFeedNotification")
15-
16-
#if !MAC_APP_STORE
17-
static let WebInspectorEnabledDidChange = Notification.Name("WebInspectorEnabledDidChange")
18-
#endif
15+
static let WebInspectorEnabledDidChange = Notification.Name("WebInspectorEnabledDidChange")
1916
}

0 commit comments

Comments
 (0)