mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Presents alert when we fail to extend background refresh time
This commit is contained in:
@@ -94,7 +94,20 @@ extension AppDelegate
|
|||||||
BackgroundTaskManager.shared.performExtendedBackgroundTask { (taskResult, taskCompletionHandler) in
|
BackgroundTaskManager.shared.performExtendedBackgroundTask { (taskResult, taskCompletionHandler) in
|
||||||
if let error = taskResult.error
|
if let error = taskResult.error
|
||||||
{
|
{
|
||||||
print("Error starting extended background task.", error)
|
print("Error starting extended background task. Aborting.", error)
|
||||||
|
|
||||||
|
let content = UNMutableNotificationContent()
|
||||||
|
content.title = NSLocalizedString("Failed to refresh apps.", comment: "")
|
||||||
|
content.body = taskResult.error?.localizedDescription ?? ""
|
||||||
|
|
||||||
|
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.01, repeats: false)
|
||||||
|
|
||||||
|
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
|
||||||
|
UNUserNotificationCenter.current().add(request) { (error) in
|
||||||
|
if let error = error {
|
||||||
|
print(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait a few seconds so we have a chance to discover nearby AltServers.
|
// Wait a few seconds so we have a chance to discover nearby AltServers.
|
||||||
|
|||||||
Reference in New Issue
Block a user