isActionRequired method

bool isActionRequired(
  1. EventNotificationModel event
)

Implementation

bool isActionRequired(EventNotificationModel event) {
  if (event.isCancelled!) return true;

  var isRequired = true;
  var currentAtsign =
      AtEventNotificationListener().atClientInstance!.currentAtSign;

  if (event.group!.members!.isEmpty) return true;

  event.group!.members!.forEach((member) {
    if (member.atSign![0] != '@') member.atSign = '@' + member.atSign!;
    if (currentAtsign![0] != '@') currentAtsign = '@' + currentAtsign!;

    if ((member.tags!['isAccepted'] != null &&
            member.tags!['isAccepted'] == true) &&
        member.tags!['isExited'] == false &&
        member.atSign!.toLowerCase() == currentAtsign!.toLowerCase()) {
      isRequired = false;
    }
  });

  if (event.atsignCreator == currentAtsign) isRequired = false;

  return isRequired;
}