checkForExpiredInvites method
dynamic
checkForExpiredInvites()
checks for expired LocationDataModel and removes from allAtsignsLocationData.
Implementation
checkForExpiredInvites() {
List<String> _idsToDelete = [];
List<String> _atsignsToDelete = [];
allAtsignsLocationData.forEach((key, value) {
allAtsignsLocationData[key]!
.locationSharingFor
.forEach((locKey, locValue) {
if (locValue.to != null && DateTime.now().isAfter(locValue.to!)) {
_idsToDelete.add(locKey);
}
});
for (var element in _idsToDelete) {
allAtsignsLocationData[key]!.locationSharingFor.remove(element);
}
if (allAtsignsLocationData[key]!.locationSharingFor.isEmpty) {
_atsignsToDelete.add(key);
}
});
for (var element in _atsignsToDelete) {
allAtsignsLocationData.remove(element);
}
}