| 380 | } |
| 381 | |
| 382 | bool NetworkService::getUserNamesForResourceAndEmojiType(std::set<std::string>& result, std::string const& simId, int likeType) |
| 383 | { |
| 384 | log(Priority::Important, "network: get user reactions for resource with id=" + simId + " and reaction type=" + std::to_string(likeType)); |
| 385 | |
| 386 | httplib::SSLClient client(_serverAddress); |
| 387 | configureClient(client); |
| 388 | |
| 389 | httplib::Params params; |
| 390 | params.emplace("simId", simId); |
| 391 | params.emplace("likeType", std::to_string(likeType)); |
| 392 | |
| 393 | try { |
| 394 | auto postResult = executeRequest([&] { return client.Post("/alien-server/getuserlikes.php", params); }); |
| 395 | |
| 396 | std::stringstream stream(postResult->body); |
| 397 | boost::property_tree::ptree tree; |
| 398 | boost::property_tree::read_json(stream, tree); |
| 399 | |
| 400 | result.clear(); |
| 401 | for (auto const& [key, subTree] : tree) { |
| 402 | result.insert(subTree.get<std::string>("userName")); |
| 403 | } |
| 404 | return true; |
| 405 | } catch (...) { |
| 406 | logNetworkError(); |
| 407 | return false; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | bool NetworkService::toggleReactionForResource(std::string const& simId, int likeType) |
| 412 | { |
no test coverage detected