handleNotificationQueue method

Future<void> handleNotificationQueue(
  1. BuildContext context
)

Implementation

Future<void> handleNotificationQueue(BuildContext context) async {
  if (!$signedIn) {
    warn("Can't handle notification queue because we're not signed in!");
    return;
  }

  while (notificationQueue.isNotEmpty) {
    N n = notificationQueue.removeFirst();
    verbose("Handling notification: ${n.runtimeType}");
    try {
      if (n.user != $uid) {
        warn("Notification is not for the current user. Ignoring.");
        continue;
      }

      await handleNotification(context, n);
      success("Handled notification: ${n.runtimeType}");
    } catch (e, es) {
      error("Failed to handle notification: ${n.runtimeType}");
      error(e);
      error(es);
    }
  }
}