getMyEventInfo method
will return for event's for which i am member
Implementation
EventInfo? getMyEventInfo(EventNotificationModel _event) {
String _id = trimAtsignsFromKey(_event.key!);
String? _atsign;
if (!compareAtSign(_event.atsignCreator!,
AtClientManager.getInstance().atClient.getCurrentAtSign()!)) {
_atsign = _event.atsignCreator;
}
if (_atsign == null && _event.group!.members!.isNotEmpty) {
Set<AtContact>? groupMembers = _event.group!.members!;
for (var member in groupMembers) {
if (!compareAtSign(member.atSign!,
AtClientManager.getInstance().atClient.getCurrentAtSign()!)) {
_atsign = member.atSign;
break;
}
}
}
if (SendLocationNotification().allAtsignsLocationData[_atsign] != null) {
if (SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id] !=
null) {
var _locationSharingFor = SendLocationNotification()
.allAtsignsLocationData[_atsign]!
.locationSharingFor[_id]!;
return EventInfo(
isSharing: _locationSharingFor.isSharing,
isExited: _locationSharingFor.isExited,
isAccepted: _locationSharingFor.isAccepted);
}
}
for (var key in SendLocationNotification().allAtsignsLocationData.entries) {
if (SendLocationNotification()
.allAtsignsLocationData[key.key]!
.locationSharingFor[_id] !=
null) {
var _locationSharingFor = SendLocationNotification()
.allAtsignsLocationData[key.key]!
.locationSharingFor[_id]!;
return EventInfo(
isSharing: _locationSharingFor.isSharing,
isExited: _locationSharingFor.isExited,
isAccepted: _locationSharingFor.isAccepted,
from: _locationSharingFor.from,
);
}
}
return null;
}