sendDeleteAck method

Future<bool> sendDeleteAck(
  1. LocationNotificationModel locationNotificationModel
)

Sends a 'deleterequestacklocation' key to delete the originally created key

Implementation

Future<bool> sendDeleteAck(
    LocationNotificationModel locationNotificationModel) async {
  try {
    var atkeyMicrosecondId = locationNotificationModel.key!
        .split('requestlocation-')[1]
        .split('@')[0];
    AtKey atKey;
    atKey = newAtKey(
      60000,
      'deleterequestacklocation-$atkeyMicrosecondId',
      locationNotificationModel.receiver,
    );

    var result = await NotifyAndPut().notifyAndPut(
      atKey,
      LocationNotificationModel.convertLocationNotificationToJson(
          locationNotificationModel),
    );

    /// Update our location key
    _logger.finer('sendDeleteAck $result');
    if (result) {
      await SendLocationNotification().removeMember(
          trimAtsignsFromKey(locationNotificationModel.key!),
          [locationNotificationModel.receiver!],
          isExited: true,
          isAccepted: false,
          isSharing: false);
    }
    return result;
  } catch (e) {
    _logger.severe('sendDeleteAck error $e');
    return false;
  }
}