Rolls back low power changes.

This commit is contained in:
Stuart Breckenridge 2019-06-21 22:16:02 +08:00
parent 183490d3b0
commit 5e5c0e0e3d
2 changed files with 2 additions and 9 deletions

View File

@ -253,20 +253,13 @@ private extension AppDelegate {
} }
} }
/// Performs background feed refresh. If the device is in low power mode, it will not proceed with the refresh. /// Performs background feed refresh.
/// - Parameter task: `BGAppRefreshTask` /// - Parameter task: `BGAppRefreshTask`
/// - Warning: As of Xcode 11 beta 2, when triggered from the debugger this doesn't work. /// - Warning: As of Xcode 11 beta 2, when triggered from the debugger this doesn't work.
func performBackgroundFeedRefresh(with task: BGAppRefreshTask) { func performBackgroundFeedRefresh(with task: BGAppRefreshTask) {
scheduleBackgroundFeedRefresh() // schedule next refresh scheduleBackgroundFeedRefresh() // schedule next refresh
// If the device is in low power mode, return early
if ProcessInfo.processInfo.isLowPowerModeEnabled {
os_log("Device is in low power mode. Background refresh terminated.", log: self.log, type: .info)
task.setTaskCompleted(success: false)
return
}
var startingUnreadCount = 0 var startingUnreadCount = 0
DispatchQueue.global(qos: .background).async { [unowned self] in DispatchQueue.global(qos: .background).async { [unowned self] in

View File

@ -41,7 +41,7 @@ struct SettingsView : View {
} }
} }
Section(header: Text("DATABASE"), footer: Text("If your device is in Low Power mode feeds will not be refreshed.").lineLimit(3)) { Section(header: Text("DATABASE")) {
Picker(selection: $viewModel.refreshInterval, label: Text("Refresh Interval")) { Picker(selection: $viewModel.refreshInterval, label: Text("Refresh Interval")) {
ForEach(RefreshInterval.allCases.identified(by: \.self)) { interval in ForEach(RefreshInterval.allCases.identified(by: \.self)) { interval in
Text(interval.description()).tag(interval) Text(interval.description()).tag(interval)