checkForPendingEvents method

Future<void> checkForPendingEvents()

Updates any received notification with haveResponded true, if already responded.

Implementation

Future<void> checkForPendingEvents() async {
  allEventNotifications.forEach((notification) async {
    notification.eventNotificationModel!.group!.members!
        .forEach((member) async {
      if ((member.atSign == currentAtSign) &&
          (member.tags!['isAccepted'] == false) &&
          (member.tags!['isExited'] == false)) {
        var atkeyMicrosecondId =
            notification.key!.split('createevent-')[1].split('@')[0];
        var acknowledgedKeyId = 'eventacknowledged-$atkeyMicrosecondId';
        var allRegexResponses =
            await atClientInstance!.getKeys(regex: acknowledgedKeyId);
        // ignore: unnecessary_null_comparison
        if ((allRegexResponses != null) && (allRegexResponses.isNotEmpty)) {
          notification.haveResponded = true;
        }
      }
    });
  });
}