sendReportData method

void sendReportData(
  1. TroubleshootingHit dataReport
)

Implementation

void sendReportData(TroubleshootingHit dataReport) async {
  // Create url string endpoint
  String urlString = Endpoints.EVENT;
  if (dataReport.type == HitCategory.TROUBLESHOOTING) {
    urlString = urlString + Endpoints.Troubleshooting;
  } else if (dataReport.type == HitCategory.USAGE) {
    urlString = urlString + Endpoints.Analytics;
  } else {
    return;
  }
  var response = await this._reportService.sendHttpRequest(
      RequestType.Post,
      urlString,
      Endpoints.getFSHeader(Flagship.sharedInstance().envId ?? ""),
      jsonEncode(dataReport.bodyTrack));

  switch (response.statusCode) {
    case 200:
      Flagship.logger(Level.INFO, "Success to send DUT or TR report");
      break;
    default:
      Flagship.logger(Level.INFO, "Error on sending DUT or TR report");
  }
}