Show system message when reloading subscriber emotes (#3135)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
James Upjohn
2021-08-08 22:59:28 +12:00
committed by GitHub
parent d0d32583a2
commit 6151cd5b05
6 changed files with 12 additions and 10 deletions
+7 -2
View File
@@ -198,7 +198,7 @@ SharedAccessGuard<const std::set<QString>> TwitchAccount::accessBlockedUserIds()
return this->ignoresUserIds_.accessConst();
}
void TwitchAccount::loadEmotes()
void TwitchAccount::loadEmotes(std::weak_ptr<Channel> weakChannel)
{
qCDebug(chatterinoTwitch)
<< "Loading Twitch emotes for user" << this->getUserName();
@@ -220,9 +220,14 @@ void TwitchAccount::loadEmotes()
// TODO(zneix): Once Helix adds Get User Emotes we could remove this hacky solution
// For now, this is necessary as Kraken's equivalent doesn't return all emotes
// See: https://twitch.uservoice.com/forums/310213-developers/suggestions/43599900
this->loadUserstateEmotes([=] {
this->loadUserstateEmotes([this, weakChannel] {
// Fill up emoteData with emote sets that were returned in a Kraken call, but aren't present in emoteData.
this->loadKrakenEmotes();
if (auto channel = weakChannel.lock(); channel != nullptr)
{
channel->addMessage(
makeSystemMessage("Twitch subscriber emotes reloaded."));
}
});
}
+1 -1
View File
@@ -111,7 +111,7 @@ public:
SharedAccessGuard<const std::set<QString>> accessBlockedUserIds() const;
SharedAccessGuard<const std::set<TwitchUser>> accessBlocks() const;
void loadEmotes();
void loadEmotes(std::weak_ptr<Channel> weakChannel = {});
// loadUserstateEmotes loads emote sets that are part of the USERSTATE emote-sets key
// this function makes sure not to load emote sets that have already been loaded
void loadUserstateEmotes(std::function<void()> callback);