mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
refactor(TwitchChannel): remove getGameById call (#3662)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
0b9f62188c
commit
c399d4dbe9
|
@ -6,6 +6,7 @@
|
||||||
- Minor: Adjust large stream thumbnail to 16:9 (#3655)
|
- Minor: Adjust large stream thumbnail to 16:9 (#3655)
|
||||||
- Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623)
|
- Minor: Fixed being unable to load Twitch Usercards from the `/mentions` tab. (#3623)
|
||||||
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
|
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
|
||||||
|
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
||||||
|
|
||||||
## 2.3.5
|
## 2.3.5
|
||||||
|
|
||||||
|
|
|
@ -735,39 +735,8 @@ void TwitchChannel::parseLiveStatus(bool live, const HelixStream &stream)
|
||||||
{
|
{
|
||||||
auto status = this->streamStatus_.access();
|
auto status = this->streamStatus_.access();
|
||||||
status->viewerCount = stream.viewerCount;
|
status->viewerCount = stream.viewerCount;
|
||||||
if (status->gameId != stream.gameId)
|
|
||||||
{
|
|
||||||
status->gameId = stream.gameId;
|
status->gameId = stream.gameId;
|
||||||
|
status->game = stream.gameName;
|
||||||
if (!stream.gameId.isEmpty())
|
|
||||||
{
|
|
||||||
// Resolve game ID to game name
|
|
||||||
getHelix()->getGameById(
|
|
||||||
stream.gameId,
|
|
||||||
[this, weak = weakOf<Channel>(this)](const auto &game) {
|
|
||||||
ChannelPtr shared = weak.lock();
|
|
||||||
if (!shared)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto status = this->streamStatus_.access();
|
|
||||||
status->game = game.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->liveStatusChanged.invoke();
|
|
||||||
},
|
|
||||||
[] {
|
|
||||||
// failure
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Game is nothing and can't be resolved by the API, force empty
|
|
||||||
status->game = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
status->title = stream.title;
|
status->title = stream.title;
|
||||||
QDateTime since = QDateTime::fromString(stream.startedAt, Qt::ISODate);
|
QDateTime since = QDateTime::fromString(stream.startedAt, Qt::ISODate);
|
||||||
auto diff = since.secsTo(QDateTime::currentDateTime());
|
auto diff = since.secsTo(QDateTime::currentDateTime());
|
||||||
|
|
Loading…
Reference in a new issue