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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 10 deletions

View file

@ -3,6 +3,7 @@
## Unversioned ## Unversioned
- Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136) - Minor: Remove TwitchEmotes.com attribution and the open/copy options when right-clicking a Twitch Emote. (#2214, #3136)
- Minor: Display a system message when reloading subscription emotes to match BTTV/FFZ behavior (#3135)
- Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130) - Bugfix: Moderation mode and active filters are now preserved when opening a split as a popup. (#3113, #3130)
- Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134) - Bugfix: Fixed a bug that caused all badge highlights to use the same color. (#3132, #3134)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)

View file

@ -198,7 +198,7 @@ SharedAccessGuard<const std::set<QString>> TwitchAccount::accessBlockedUserIds()
return this->ignoresUserIds_.accessConst(); return this->ignoresUserIds_.accessConst();
} }
void TwitchAccount::loadEmotes() void TwitchAccount::loadEmotes(std::weak_ptr<Channel> weakChannel)
{ {
qCDebug(chatterinoTwitch) qCDebug(chatterinoTwitch)
<< "Loading Twitch emotes for user" << this->getUserName(); << "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 // 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 // For now, this is necessary as Kraken's equivalent doesn't return all emotes
// See: https://twitch.uservoice.com/forums/310213-developers/suggestions/43599900 // 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. // Fill up emoteData with emote sets that were returned in a Kraken call, but aren't present in emoteData.
this->loadKrakenEmotes(); this->loadKrakenEmotes();
if (auto channel = weakChannel.lock(); channel != nullptr)
{
channel->addMessage(
makeSystemMessage("Twitch subscriber emotes reloaded."));
}
}); });
} }

View file

@ -111,7 +111,7 @@ public:
SharedAccessGuard<const std::set<QString>> accessBlockedUserIds() const; SharedAccessGuard<const std::set<QString>> accessBlockedUserIds() const;
SharedAccessGuard<const std::set<TwitchUser>> accessBlocks() 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 // 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 // this function makes sure not to load emote sets that have already been loaded
void loadUserstateEmotes(std::function<void()> callback); void loadUserstateEmotes(std::function<void()> callback);

View file

@ -870,8 +870,8 @@ void Split::showSearch()
void Split::reloadChannelAndSubscriberEmotes() void Split::reloadChannelAndSubscriberEmotes()
{ {
getApp()->accounts->twitch.getCurrent()->loadEmotes();
auto channel = this->getChannel(); auto channel = this->getChannel();
getApp()->accounts->twitch.getCurrent()->loadEmotes(channel);
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get())) if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
{ {

View file

@ -916,10 +916,6 @@ void SplitHeader::themeChangedEvent()
} }
} }
void SplitHeader::moveSplit()
{
}
void SplitHeader::reloadChannelEmotes() void SplitHeader::reloadChannelEmotes()
{ {
auto channel = this->split_->getChannel(); auto channel = this->split_->getChannel();
@ -933,7 +929,8 @@ void SplitHeader::reloadChannelEmotes()
void SplitHeader::reloadSubscriberEmotes() void SplitHeader::reloadSubscriberEmotes()
{ {
getApp()->accounts->twitch.getCurrent()->loadEmotes(); auto channel = this->split_->getChannel();
getApp()->accounts->twitch.getCurrent()->loadEmotes(channel);
} }
void SplitHeader::reconnect() void SplitHeader::reconnect()

View file

@ -85,7 +85,6 @@ private:
std::vector<pajlada::Signals::ScopedConnection> channelConnections_; std::vector<pajlada::Signals::ScopedConnection> channelConnections_;
public slots: public slots:
void moveSplit();
void reloadChannelEmotes(); void reloadChannelEmotes();
void reloadSubscriberEmotes(); void reloadSubscriberEmotes();
void reconnect(); void reconnect();