Drain the notifications queue in FIFO
This commit is contained in:
parent
4e3c6e52aa
commit
2787f9f19b
1 changed files with 6 additions and 1 deletions
|
|
@ -198,9 +198,14 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|||
|
||||
static void
|
||||
drain_pending_notifications(BOOL granted) {
|
||||
if (granted) {
|
||||
for (size_t i = 0; i < notification_queue.count; i++) {
|
||||
QueuedNotification *n = notification_queue.notifications + i;
|
||||
schedule_notification(n->identifier, n->title, n->body);
|
||||
}
|
||||
}
|
||||
while(notification_queue.count) {
|
||||
QueuedNotification *n = notification_queue.notifications + --notification_queue.count;
|
||||
if (granted) schedule_notification(n->identifier, n->title, n->body);
|
||||
free(n->identifier); free(n->title); free(n->body);
|
||||
n->identifier = NULL; n->title = NULL; n->body = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue