checkForDeleteRequestAck method
void
checkForDeleteRequestAck()
Checks for missed 'Remove Person' requests for request location notifications
Implementation
void checkForDeleteRequestAck() async {
// Letting other events complete
await Future.delayed(const Duration(seconds: 5));
var dltRequestLocationResponse = await atClientInstance!.getKeys(
regex: 'deleterequestacklocation',
);
for (var i = 0; i < dltRequestLocationResponse.length; i++) {
/// Operate on receied notifications
if (dltRequestLocationResponse[i].contains('cached')) {
var atkeyMicrosecondId = dltRequestLocationResponse[i]
.split('deleterequestacklocation-')[1]
.split('@')[0];
var _index = allLocationNotifications.indexWhere((element) {
return (element.locationNotificationModel!.key!
.contains(atkeyMicrosecondId) &&
(element.locationNotificationModel!.key!
.contains(MixedConstants.SHARE_LOCATION)));
});
if (_index == -1) continue;
await RequestLocationService().deleteKey(
allLocationNotifications[_index].locationNotificationModel!);
}
}
}