| 379 | } |
| 380 | |
| 381 | void UpdateManager::SendOptOutRequest() const { |
| 382 | using namespace rapidjson; |
| 383 | using namespace audacity::network_manager; |
| 384 | |
| 385 | std::string uuid = InstanceId->Read().ToStdString(); |
| 386 | |
| 387 | Document document; |
| 388 | document.SetObject().AddMember("uuid", |
| 389 | Value(uuid.c_str(), document.GetAllocator()), |
| 390 | document.GetAllocator()); |
| 391 | |
| 392 | StringBuffer buffer; |
| 393 | Writer<StringBuffer> writer(buffer); |
| 394 | document.Accept(writer); |
| 395 | |
| 396 | Request request(GetOptOutUrl()); |
| 397 | |
| 398 | request.setHeader(common_headers::ContentType, common_content_types::ApplicationJson); |
| 399 | request.setHeader(common_headers::Accept, common_content_types::ApplicationJson); |
| 400 | |
| 401 | auto response = NetworkManager::GetInstance().doPost(request, buffer.GetString(), buffer.GetSize()); |
| 402 | |
| 403 | response->setRequestFinishedCallback([response](auto) { |
| 404 | if (response->getHTTPCode() != HttpCode::OK) { |
| 405 | wxLogWarning(wxT("Failed to communicate with Audio.com. Error code: %d."), response->getHTTPCode()); |
| 406 | wxLogWarning(wxT("Server response: %s"), response->readAll<std::string>()); |
| 407 | } |
| 408 | }); |
| 409 | } |
| 410 | |
| 411 | void UpdateManager::UpdatePrefs() |
| 412 | { |
nothing calls this directly
no test coverage detected