From 84b8b045528e2d96b4b8882ea05fcd5ec8a9161e Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 23 Apr 2019 17:15:19 -0500 Subject: [PATCH] Comment non-working background refresh code. --- iOS/AppDelegate.swift | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 5b28ba98b..74f0edb87 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -89,12 +89,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele } } - // TODO: Remove this testing code... -// AppDefaults.refreshInterval = RefreshInterval.every10Minutes - UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds()) +// UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds()) NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) +// NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil) return true @@ -141,20 +139,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { - - AccountManager.shared.refreshAll() - while (!AccountManager.shared.combinedRefreshProgress.isComplete) { - sleep(1) - } - - if didDownloadArticles { - completionHandler(.newData) - } else { - completionHandler(.noData) - } - - } +// func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { +// +// AccountManager.shared.refreshAll() +// while (!AccountManager.shared.combinedRefreshProgress.isComplete) { +// sleep(1) +// } +// +// if didDownloadArticles { +// completionHandler(.newData) +// } else { +// completionHandler(.noData) +// } +// +// } // MARK: - Split view @@ -176,9 +174,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele } } - @objc func userDefaultsDidChange(_ note: Notification) { - UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds()) - } +// @objc func userDefaultsDidChange(_ note: Notification) { +// UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds()) +// } @objc func accountDidDownloadArticles(_ note: Notification) { didDownloadArticles = true