| 387 | delete m_pluginsThread; |
| 388 | } |
| 389 | void WebAPI::FetchTips(std::function<void(int, int, const std::string&, const std::string&)> onFetch) |
| 390 | { |
| 391 | Logger::Get().Log("Fetching tips with WebAPI"); |
| 392 | |
| 393 | std::string currentVersionPath = Settings::Instance().ConvertPath("info.dat"); |
| 394 | |
| 395 | std::ifstream verReader(currentVersionPath); |
| 396 | int curVer = 0; |
| 397 | if (verReader.is_open()) { |
| 398 | verReader >> curVer; |
| 399 | verReader.close(); |
| 400 | } |
| 401 | |
| 402 | if (curVer < WebAPI::InternalVersion) |
| 403 | return; |
| 404 | |
| 405 | if (m_tipsThread != nullptr && m_tipsThread->joinable()) |
| 406 | m_tipsThread->join(); |
| 407 | delete m_tipsThread; |
| 408 | m_tipsThread = new std::thread(getTips, onFetch); |
| 409 | } |
| 410 | void WebAPI::FetchChangelog(std::function<void(const std::string&)> onFetch) |
| 411 | { |
| 412 | Logger::Get().Log("Fetching changelog with WebAPI"); |
no test coverage detected