mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 11:43:24 +01:00
[AltStore] Fixes duplicate alerts when refreshing in background
This commit is contained in:
@@ -383,13 +383,19 @@ private extension AppDelegate
|
|||||||
if delay > 0
|
if delay > 0
|
||||||
{
|
{
|
||||||
DispatchQueue.global().asyncAfter(deadline: .now() + delay) {
|
DispatchQueue.global().asyncAfter(deadline: .now() + delay) {
|
||||||
|
UNUserNotificationCenter.current().getPendingNotificationRequests() { (requests) in
|
||||||
// If app is still running at this point, we schedule another notification with same identifier.
|
// If app is still running at this point, we schedule another notification with same identifier.
|
||||||
// This prevents the currently scheduled notification from displaying, and starts another countdown timer.
|
// This prevents the currently scheduled notification from displaying, and starts another countdown timer.
|
||||||
|
// First though, make sure there _is_ still a pending request, otherwise it's been cancelled
|
||||||
|
// and we should stop polling.
|
||||||
|
guard requests.contains(where: { $0.identifier == identifier }) else { return }
|
||||||
|
|
||||||
scheduleFinishedRefreshingNotification()
|
scheduleFinishedRefreshingNotification()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scheduleFinishedRefreshingNotification()
|
scheduleFinishedRefreshingNotification()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user