Fix to stop background refresh when interval set to manually.
This commit is contained in:
parent
d2482233ab
commit
2efbd44811
|
@ -92,7 +92,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds())
|
updateBackgroundRefreshInterval()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func userDefaultsDidChange(_ note: Notification) {
|
@objc func userDefaultsDidChange(_ note: Notification) {
|
||||||
UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds())
|
updateBackgroundRefreshInterval()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func accountRefreshDidFinish(_ note: Notification) {
|
@objc func accountRefreshDidFinish(_ note: Notification) {
|
||||||
|
@ -244,6 +244,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
|
|
||||||
private extension AppDelegate {
|
private extension AppDelegate {
|
||||||
|
|
||||||
|
func updateBackgroundRefreshInterval() {
|
||||||
|
let refreshInterval = AppDefaults.refreshInterval
|
||||||
|
if refreshInterval == .manually {
|
||||||
|
UIApplication.shared.setMinimumBackgroundFetchInterval(UIApplication.backgroundFetchIntervalNever)
|
||||||
|
} else {
|
||||||
|
UIApplication.shared.setMinimumBackgroundFetchInterval(AppDefaults.refreshInterval.inSeconds())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func sendReceivedArticlesUserNotification(newArticleCount: Int) {
|
func sendReceivedArticlesUserNotification(newArticleCount: Int) {
|
||||||
|
|
||||||
let content = UNMutableNotificationContent()
|
let content = UNMutableNotificationContent()
|
||||||
|
|
Loading…
Reference in New Issue