|
@@ -350,18 +350,24 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
|
|
|
// MARK: - Background Task
|
|
|
|
|
|
+ /*
|
|
|
+ @discussion Schedule a refresh task request to ask that the system launch your app briefly so that you can download data and keep your app's contents up-to-date. The system will fulfill this request intelligently based on system conditions and app usage.
|
|
|
+ */
|
|
|
func scheduleAppRefresh() {
|
|
|
|
|
|
let request = BGAppRefreshTaskRequest(identifier: NCGlobal.shared.refreshTask)
|
|
|
- request.earliestBeginDate = Date(timeIntervalSinceNow: 5 * 60) // Refresh after 5 minutes.
|
|
|
+ request.earliestBeginDate = Date(timeIntervalSinceNow: 6 * 60) // Refresh after 6 minutes.
|
|
|
do {
|
|
|
try BGTaskScheduler.shared.submit(request)
|
|
|
- NKCommon.shared.writeLog("Refresh task success submit request \(request)")
|
|
|
+ NKCommon.shared.writeLog("Refresh task success submit request 6 minutes \(request)")
|
|
|
} catch {
|
|
|
NKCommon.shared.writeLog("Refresh task failed to submit request: \(error)")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ @discussion Schedule a processing task request to ask that the system launch your app when conditions are favorable for battery life to handle deferrable, longer-running processing, such as syncing, database maintenance, or similar tasks. The system will attempt to fulfill this request to the best of its ability within the next two days as long as the user has used your app within the past week.
|
|
|
+ */
|
|
|
func scheduleAppProcessing() {
|
|
|
|
|
|
let request = BGProcessingTaskRequest(identifier: NCGlobal.shared.processingTask)
|
|
@@ -370,7 +376,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|
|
request.requiresExternalPower = false
|
|
|
do {
|
|
|
try BGTaskScheduler.shared.submit(request)
|
|
|
- NKCommon.shared.writeLog("Background Processing task success submit request \(request)")
|
|
|
+ NKCommon.shared.writeLog("Background Processing task success submit request 5 minutes \(request)")
|
|
|
} catch {
|
|
|
NKCommon.shared.writeLog("Background Processing task failed to submit request: \(error)")
|
|
|
}
|