refactor: move seventv/bttv event apis to application (#5532)

This commit is contained in:
pajlada
2024-08-08 15:08:31 +02:00
committed by GitHub
parent 3257da1855
commit f0802af055
12 changed files with 133 additions and 97 deletions
+10 -13
View File
@@ -146,15 +146,14 @@ TwitchChannel::~TwitchChannel()
getApp()->getTwitch()->dropSeventvChannel(this->seventvUserID_,
this->seventvEmoteSetID_);
if (getApp()->getTwitch()->getBTTVLiveUpdates())
if (getApp()->getBttvLiveUpdates())
{
getApp()->getTwitch()->getBTTVLiveUpdates()->partChannel(
this->roomId());
getApp()->getBttvLiveUpdates()->partChannel(this->roomId());
}
if (getApp()->getTwitch()->getSeventvEventAPI())
if (getApp()->getSeventvEventAPI())
{
getApp()->getTwitch()->getSeventvEventAPI()->unsubscribeTwitchChannel(
getApp()->getSeventvEventAPI()->unsubscribeTwitchChannel(
this->roomId());
}
}
@@ -854,7 +853,7 @@ const QString &TwitchChannel::seventvEmoteSetID() const
void TwitchChannel::joinBttvChannel() const
{
if (getApp()->getTwitch()->getBTTVLiveUpdates())
if (getApp()->getBttvLiveUpdates())
{
const auto currentAccount =
getApp()->getAccounts()->twitch.getCurrent();
@@ -863,8 +862,7 @@ void TwitchChannel::joinBttvChannel() const
{
userName = currentAccount->getUserName();
}
getApp()->getTwitch()->getBTTVLiveUpdates()->joinChannel(this->roomId(),
userName);
getApp()->getBttvLiveUpdates()->joinChannel(this->roomId(), userName);
}
}
@@ -1012,9 +1010,9 @@ void TwitchChannel::updateSeventvData(const QString &newUserID,
this->seventvUserID_ = newUserID;
this->seventvEmoteSetID_ = newEmoteSetID;
runInGuiThread([this, oldUserID, oldEmoteSetID]() {
if (getApp()->getTwitch()->getSeventvEventAPI())
if (getApp()->getSeventvEventAPI())
{
getApp()->getTwitch()->getSeventvEventAPI()->subscribeUser(
getApp()->getSeventvEventAPI()->subscribeUser(
this->seventvUserID_, this->seventvEmoteSetID_);
if (oldUserID || oldEmoteSetID)
@@ -1811,10 +1809,9 @@ void TwitchChannel::updateSevenTVActivity()
void TwitchChannel::listenSevenTVCosmetics() const
{
if (getApp()->getTwitch()->getSeventvEventAPI())
if (getApp()->getSeventvEventAPI())
{
getApp()->getTwitch()->getSeventvEventAPI()->subscribeTwitchChannel(
this->roomId());
getApp()->getSeventvEventAPI()->subscribeTwitchChannel(this->roomId());
}
}