chore: refactor TwitchIrcServer (#5421)
This commit is contained in:
@@ -236,14 +236,13 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
||||
}
|
||||
|
||||
postToThread([=] {
|
||||
auto *app = getApp();
|
||||
|
||||
if (!name.isEmpty())
|
||||
{
|
||||
auto channel = app->twitch->getOrAddChannel(name);
|
||||
if (app->twitch->watchingChannel.get() != channel)
|
||||
auto channel =
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name);
|
||||
if (getIApp()->getTwitch()->getWatchingChannel().get() != channel)
|
||||
{
|
||||
app->twitch->watchingChannel.reset(channel);
|
||||
getIApp()->getTwitch()->setWatchingChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +252,8 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
||||
auto *window = AttachedWindow::getForeground(args);
|
||||
if (!name.isEmpty())
|
||||
{
|
||||
window->setChannel(app->twitch->getOrAddChannel(name));
|
||||
window->setChannel(
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -294,8 +294,6 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
auto *app = getApp();
|
||||
|
||||
std::vector<ChannelPtr> updated;
|
||||
updated.reserve(twitchChannels.size());
|
||||
for (const auto &value : twitchChannels)
|
||||
@@ -306,7 +304,8 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
|
||||
continue;
|
||||
}
|
||||
// the deduping is done on the extension side
|
||||
updated.emplace_back(app->twitch->getOrAddChannel(name));
|
||||
updated.emplace_back(
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
}
|
||||
|
||||
// This will destroy channels that aren't used anymore.
|
||||
|
||||
@@ -74,7 +74,7 @@ bool isBroadcasterSoftwareActive()
|
||||
shouldShowTimeoutWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->twitch->addGlobalSystemMessage(
|
||||
getIApp()->getTwitchAbstract()->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep timed "
|
||||
"out. This can happen if your system lagged at the "
|
||||
"wrong moment. If Streamer Mode continues to not work, "
|
||||
@@ -94,7 +94,7 @@ bool isBroadcasterSoftwareActive()
|
||||
shouldShowWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->twitch->addGlobalSystemMessage(
|
||||
getIApp()->getTwitchAbstract()->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep is "
|
||||
"missing. "
|
||||
"Install it to fix the issue or set Streamer Mode to "
|
||||
|
||||
@@ -688,27 +688,28 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
|
||||
|
||||
if (descriptor.type_ == "twitch")
|
||||
{
|
||||
return app->twitch->getOrAddChannel(descriptor.channelName_);
|
||||
return getIApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
descriptor.channelName_);
|
||||
}
|
||||
else if (descriptor.type_ == "mentions")
|
||||
{
|
||||
return app->twitch->mentionsChannel;
|
||||
return getIApp()->getTwitch()->getMentionsChannel();
|
||||
}
|
||||
else if (descriptor.type_ == "watching")
|
||||
{
|
||||
return app->twitch->watchingChannel;
|
||||
return getIApp()->getTwitch()->getWatchingChannel();
|
||||
}
|
||||
else if (descriptor.type_ == "whispers")
|
||||
{
|
||||
return app->twitch->whispersChannel;
|
||||
return getIApp()->getTwitch()->getWhispersChannel();
|
||||
}
|
||||
else if (descriptor.type_ == "live")
|
||||
{
|
||||
return app->twitch->liveChannel;
|
||||
return getIApp()->getTwitch()->getLiveChannel();
|
||||
}
|
||||
else if (descriptor.type_ == "automod")
|
||||
{
|
||||
return app->twitch->automodChannel;
|
||||
return getIApp()->getTwitch()->getAutomodChannel();
|
||||
}
|
||||
else if (descriptor.type_ == "irc")
|
||||
{
|
||||
@@ -717,7 +718,8 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
|
||||
}
|
||||
else if (descriptor.type_ == "misc")
|
||||
{
|
||||
return app->twitch->getChannelOrEmpty(descriptor.channelName_);
|
||||
return getIApp()->getTwitchAbstract()->getChannelOrEmpty(
|
||||
descriptor.channelName_);
|
||||
}
|
||||
|
||||
return Channel::getEmpty();
|
||||
|
||||
Reference in New Issue
Block a user