Refactor NetworkRequest class
Add followUser and unfollowUser methods to TwitchAccount
This commit is contained in:
@@ -451,18 +451,25 @@ void Split::doOpenViewerList()
|
||||
}
|
||||
auto loadingLabel = new QLabel("Loading...");
|
||||
|
||||
twitchApiGet("https://tmi.twitch.tv/group/user/" + this->getChannel()->name + "/chatters", this,
|
||||
[=](QJsonObject obj) {
|
||||
QJsonObject chattersObj = obj.value("chatters").toObject();
|
||||
auto request = NetworkRequest::twitchRequest("https://tmi.twitch.tv/group/user/" +
|
||||
this->getChannel()->name + "/chatters");
|
||||
|
||||
loadingLabel->hide();
|
||||
for (int i = 0; i < jsonLabels.size(); i++) {
|
||||
chattersList->addItem(labelList.at(i));
|
||||
foreach (const QJsonValue &v,
|
||||
chattersObj.value(jsonLabels.at(i)).toArray())
|
||||
chattersList->addItem(v.toString());
|
||||
}
|
||||
});
|
||||
request.setCaller(this);
|
||||
request.onSuccess([=](auto result) {
|
||||
auto obj = result.parseJson();
|
||||
QJsonObject chattersObj = obj.value("chatters").toObject();
|
||||
|
||||
loadingLabel->hide();
|
||||
for (int i = 0; i < jsonLabels.size(); i++) {
|
||||
chattersList->addItem(labelList.at(i));
|
||||
foreach (const QJsonValue &v, chattersObj.value(jsonLabels.at(i)).toArray())
|
||||
chattersList->addItem(v.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
request.execute();
|
||||
|
||||
searchBar->setPlaceholderText("Search User...");
|
||||
QObject::connect(searchBar, &QLineEdit::textEdited, this, [=]() {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/UrlFetch.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
@@ -323,13 +324,13 @@ void SplitHeader::updateChannelText()
|
||||
if (streamStatus.live) {
|
||||
this->isLive_ = true;
|
||||
this->tooltip_ = "<style>.center { text-align: center; }</style>"
|
||||
"<p class = \"center\">" +
|
||||
streamStatus.title + "<br><br>" + streamStatus.game + "<br>" +
|
||||
(streamStatus.rerun ? "Vod-casting" : "Live") + " for " +
|
||||
streamStatus.uptime + " with " +
|
||||
QString::number(streamStatus.viewerCount) +
|
||||
" viewers"
|
||||
"</p>";
|
||||
"<p class = \"center\">" +
|
||||
streamStatus.title + "<br><br>" + streamStatus.game + "<br>" +
|
||||
(streamStatus.rerun ? "Vod-casting" : "Live") + " for " +
|
||||
streamStatus.uptime + " with " +
|
||||
QString::number(streamStatus.viewerCount) +
|
||||
" viewers"
|
||||
"</p>";
|
||||
if (streamStatus.rerun) {
|
||||
title += " (rerun)";
|
||||
} else if (streamStatus.streamType.isEmpty()) {
|
||||
@@ -355,8 +356,8 @@ void SplitHeader::updateModerationModeIcon()
|
||||
auto app = getApp();
|
||||
|
||||
this->moderationButton_->setPixmap(this->split_->getModerationMode()
|
||||
? *app->resources->moderationmode_enabled->getPixmap()
|
||||
: *app->resources->moderationmode_disabled->getPixmap());
|
||||
? *app->resources->moderationmode_enabled->getPixmap()
|
||||
: *app->resources->moderationmode_disabled->getPixmap());
|
||||
|
||||
bool modButtonVisible = false;
|
||||
ChannelPtr channel = this->split_->getChannel();
|
||||
|
||||
Reference in New Issue
Block a user