refactor: Remove Outcome from network requests (#4959)

This commit is contained in:
nerix
2023-11-12 14:51:51 +01:00
committed by GitHub
parent 95620e6e10
commit 6faf63c5c4
22 changed files with 122 additions and 228 deletions
+1 -4
View File
@@ -2,7 +2,6 @@
#include "common/NetworkRequest.hpp"
#include "common/NetworkResult.hpp"
#include "common/Outcome.hpp"
#include "messages/Emote.hpp"
#include "providers/ffz/FfzUtil.hpp"
@@ -59,7 +58,7 @@ void FfzBadges::load()
static QUrl url("https://api.frankerfacez.com/v1/badges/ids");
NetworkRequest(url)
.onSuccess([this](auto result) -> Outcome {
.onSuccess([this](auto result) {
std::unique_lock lock(this->mutex_);
auto jsonRoot = result.parseJson();
@@ -103,8 +102,6 @@ void FfzBadges::load()
}
}
}
return Success;
})
.execute();
}
+2 -7
View File
@@ -2,7 +2,6 @@
#include "common/NetworkRequest.hpp"
#include "common/NetworkResult.hpp"
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "messages/Emote.hpp"
#include "messages/Image.hpp"
@@ -197,11 +196,9 @@ void FfzEmotes::loadEmotes()
NetworkRequest(url)
.timeout(30000)
.onSuccess([this](auto result) -> Outcome {
.onSuccess([this](auto result) {
auto parsedSet = parseGlobalEmotes(result.parseJson());
this->setEmotes(std::make_shared<EmoteMap>(std::move(parsedSet)));
return Success;
})
.execute();
}
@@ -227,7 +224,7 @@ void FfzEmotes::loadChannel(
.onSuccess([emoteCallback = std::move(emoteCallback),
modBadgeCallback = std::move(modBadgeCallback),
vipBadgeCallback = std::move(vipBadgeCallback), channel,
manualRefresh](const auto &result) -> Outcome {
manualRefresh](const auto &result) {
const auto json = result.parseJson();
auto emoteMap = parseChannelEmotes(json);
@@ -254,8 +251,6 @@ void FfzEmotes::loadChannel(
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
}
}
return Success;
})
.onError([channelID, channel, manualRefresh](const auto &result) {
auto shared = channel.lock();