checkLocationSharingForEventData method

Future<void> checkLocationSharingForEventData(
  1. EventNotificationModel eventNotificationModel
)

Checks current status of currentAtSign in an event and updates SendLocationNotification location sending list.

Implementation

Future<void> checkLocationSharingForEventData(
    EventNotificationModel eventNotificationModel) async {
  if ((eventNotificationModel.atsignCreator == currentAtSign)) {
    if (eventNotificationModel.isSharing!) {
      // ignore: unawaited_futures
      await calculateLocationSharingForSingleEvent(eventNotificationModel);
    } else {
      List<String> atsignsToremove = [];
      for (var member in eventNotificationModel.group!.members!) {
        atsignsToremove.add(member.atSign!);
      }
      SendLocationNotification().removeMember(
          eventNotificationModel.key!, atsignsToremove,
          isAccepted: !eventNotificationModel.isCancelled!,
          isExited: eventNotificationModel.isCancelled!);
    }
  } else {
    await calculateLocationSharingForSingleEvent(eventNotificationModel);
  }
}