From f26e0b8c81287e7766729bdc9ec1e341f1eb418f Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Wed, 16 Jun 2021 20:20:32 -0500 Subject: [PATCH] Add hidden preference to suppress syncing on launch. Fixes #894 --- Mac/AppDefaults.swift | 10 ++++++++++ Mac/AppDelegate.swift | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Mac/AppDefaults.swift b/Mac/AppDefaults.swift index 00fee7fb7..2aa453d8d 100644 --- a/Mac/AppDefaults.swift +++ b/Mac/AppDefaults.swift @@ -44,6 +44,7 @@ final class AppDefaults { static let timelineShowsSeparators = "CorreiaSeparators" static let showTitleOnMainWindow = "KafasisTitleMode" static let feedDoubleClickMarkAsRead = "GruberFeedDoubleClickMarkAsRead" + static let suppressSyncOnLaunch = "DevroeSuppressSyncOnLaunch" #if !MAC_APP_STORE static let webInspectorEnabled = "WebInspectorEnabled" @@ -203,6 +204,15 @@ final class AppDefaults { } } + var suppressSyncOnLaunch: Bool { + get { + return AppDefaults.bool(for: Key.suppressSyncOnLaunch) + } + set { + AppDefaults.setBool(for: Key.suppressSyncOnLaunch, newValue) + } + } + #if !MAC_APP_STORE var webInspectorEnabled: Bool { get { diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index cf4af585a..f55bd5d74 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -251,9 +251,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, refreshTimer!.update() syncTimer!.update() #else - DispatchQueue.main.async { - self.refreshTimer!.timedRefresh(nil) - self.syncTimer!.timedRefresh(nil) + if AppDefaults.shared.suppressSyncOnLaunch { + refreshTimer!.update() + syncTimer!.update() + } else { + DispatchQueue.main.async { + self.refreshTimer!.timedRefresh(nil) + self.syncTimer!.timedRefresh(nil) + } } #endif