sendLocationAfterDataUpdate method
sends 'location-notify' key with updated LocationDataModel to atsignsUpdated
.
Implementation
sendLocationAfterDataUpdate(List<String> atsignsUpdated) async {
var _currentMyLatLng = await getMyLocation();
await Future.forEach(atsignsUpdated, (String atsign) async {
if ((allAtsignsLocationData[atsign] != null)) {
bool isLocSharing = false;
for (var key
in allAtsignsLocationData[atsign]!.locationSharingFor.entries) {
if (allAtsignsLocationData[atsign]!
.locationSharingFor[key.key]!
.isSharing) {
isLocSharing = true;
break;
}
}
await prepareLocationDataAndSend(
atsign,
allAtsignsLocationData[atsign]!,
(isLocSharing
? _currentMyLatLng ?? allAtsignsLocationData[atsign]!.getLatLng
: null));
/// send last latLng if _currentMyLatLng is null
}
});
}