updateEventMemberInfo method
dynamic
updateEventMemberInfo(
- EventNotificationModel _event, {
- required bool isAccepted,
- required bool isSharing,
- required bool isExited,
updates SendLocationNotification().allAtsignsLocationData
for the _event
.
Implementation
updateEventMemberInfo(EventNotificationModel _event,
{required bool isAccepted,
required bool isSharing,
required bool isExited}) async {
String _id = trimAtsignsFromKey(_event.key!);
List<String> _allAtsignsInEvent = getAtsignsFromEvent(_event);
for (var _atsign in _allAtsignsInEvent) {
if (SendLocationNotification().allAtsignsLocationData[_atsign] != null) {
if (SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id] !=
null) {
SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id]!
.isAccepted = isAccepted;
SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id]!
.isSharing = isSharing;
SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id]!
.isExited = isExited;
} else {
var _fromAndTo = getFromAndToForEvent(_event);
SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id] =
LocationSharingFor(_fromAndTo['from'], _fromAndTo['to'],
LocationSharingType.Event, isAccepted, isExited, isSharing);
}
} else {
var _fromAndTo = getFromAndToForEvent(_event);
SendLocationNotification().allAtsignsLocationData[_atsign] =
LocationDataModel({
trimAtsignsFromKey(_event.key!): LocationSharingFor(
_fromAndTo['from'],
_fromAndTo['to'],
LocationSharingType.Event,
isAccepted,
isExited,
isSharing),
}, null, null, DateTime.now(), currentAtSign!, _atsign);
}
}
await SendLocationNotification()
.sendLocationAfterDataUpdate(_allAtsignsInEvent);
}