From 6213ae128ba7325f08425b357a45226da3212864 Mon Sep 17 00:00:00 2001 From: krugerk <4656811+krugerk@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:50:00 +0200 Subject: [PATCH 1/2] a note about background fetch as well as changing the min interval to 60seconds --- BeeSwift/AppDelegate.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BeeSwift/AppDelegate.swift b/BeeSwift/AppDelegate.swift index c55264798..a0befa2f7 100644 --- a/BeeSwift/AppDelegate.swift +++ b/BeeSwift/AppDelegate.swift @@ -43,6 +43,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD NotificationCenter.default.addObserver(self, selector: #selector(self.updateBadgeCount), name: NSNotification.Name(rawValue: CurrentUserManager.goalsFetchedNotificationName), object: nil) + application.setMinimumBackgroundFetchInterval(60) + return true } @@ -78,6 +80,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } + /// https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/updating_your_app_with_background_app_refresh + /// + /// and for iOS 13 and over: https://developer.apple.com/documentation/backgroundtasks/bgapprefreshtask func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { CurrentUserManager.sharedManager.fetchGoals(success: { (goals) in completionHandler(.newData) @@ -85,6 +90,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD completionHandler(.failed) } } + + func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { if url.scheme == "beeminder" { From 3ec320d45fa6bc9b471d451497bb4cb26a6b7a76 Mon Sep 17 00:00:00 2001 From: krugerk <4656811+krugerk@users.noreply.github.com> Date: Mon, 10 Aug 2020 16:58:10 +0200 Subject: [PATCH 2/2] setting a minimum background fetch interval --- BeeSwift/AppDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BeeSwift/AppDelegate.swift b/BeeSwift/AppDelegate.swift index a0befa2f7..0a9a6088a 100644 --- a/BeeSwift/AppDelegate.swift +++ b/BeeSwift/AppDelegate.swift @@ -43,7 +43,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD NotificationCenter.default.addObserver(self, selector: #selector(self.updateBadgeCount), name: NSNotification.Name(rawValue: CurrentUserManager.goalsFetchedNotificationName), object: nil) - application.setMinimumBackgroundFetchInterval(60) + application.setMinimumBackgroundFetchInterval(15 * 60) return true }