From 6bf7ba1ebebddb0d97a919eefd04e390dc06ec13 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sat, 7 Jul 2018 12:03:37 +0200 Subject: [PATCH] fixed compilation --- src/common/NetworkRequest.cpp | 2 +- src/singletons/Updates.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/common/NetworkRequest.cpp b/src/common/NetworkRequest.cpp index 74aac0931..52edbf1ea 100644 --- a/src/common/NetworkRequest.cpp +++ b/src/common/NetworkRequest.cpp @@ -27,7 +27,7 @@ NetworkRequest::NetworkRequest(QUrl url, NetworkRequestType requestType) NetworkRequest::~NetworkRequest() { - assert(this->executed_); + // assert(this->executed_); } void NetworkRequest::setRequestType(NetworkRequestType newRequestType) diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 7de502c38..2a525106f 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -2,6 +2,7 @@ #include "common/NetworkRequest.hpp" #include "common/Version.hpp" +#include "singletons/Paths.hpp" #include "util/CombinePath.hpp" #include "util/PostToThread.hpp" @@ -65,8 +66,10 @@ void Updates::installUpdates() return true; }); - req.get([this](QByteArray &object) { - auto filename = combinePath(getApp()->paths->miscDirectory, "update.zip"); + + req.onSuccess([this](auto result) -> bool { + QByteArray object = result.getData(); + auto filename = combinePath(getPaths()->miscDirectory, "update.zip"); QFile file(filename); file.open(QIODevice::Truncate | QIODevice::WriteOnly); @@ -95,7 +98,7 @@ void Updates::checkForUpdates() NetworkRequest req(url); req.setTimeout(30000); - req.onSuccess([this](auto result) { + req.onSuccess([this](auto result) -> bool { auto object = result.parseJson(); QJsonValue version_val = object.value("version"); QJsonValue update_val = object.value("update"); @@ -113,7 +116,7 @@ void Updates::checkForUpdates() box->show(); box->raise(); }); - return; + return false; } this->onlineVersion_ = version_val.toString(); @@ -137,6 +140,7 @@ void Updates::checkForUpdates() } else { this->setStatus_(NoUpdateAvailable); } + return false; }); this->setStatus_(Searching); req.execute();