56d09ac198
Upon joining a channel or pressing F5, BTTV and FFZ emotes are (re)loaded. This change adds visual feedback of the network requests and their outcome, in the form of a system message in the associated channel's chat window. Non-error messages are suppressed when joining a channel (which automatically loads emotes).
37 lines
916 B
C++
37 lines
916 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include "boost/optional.hpp"
|
|
#include "common/Aliases.hpp"
|
|
#include "common/Atomic.hpp"
|
|
#include "providers/twitch/TwitchChannel.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
struct Emote;
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
class EmoteMap;
|
|
|
|
class FfzEmotes final
|
|
{
|
|
static constexpr const char *globalEmoteApiUrl =
|
|
"https://api.frankerfacez.com/v1/set/global";
|
|
|
|
public:
|
|
FfzEmotes();
|
|
|
|
std::shared_ptr<const EmoteMap> emotes() const;
|
|
boost::optional<EmotePtr> emote(const EmoteName &name) const;
|
|
void loadEmotes();
|
|
static void loadChannel(
|
|
std::weak_ptr<Channel> channel, const QString &channelId,
|
|
std::function<void(EmoteMap &&)> emoteCallback,
|
|
std::function<void(boost::optional<EmotePtr>)> modBadgeCallback,
|
|
bool manualRefresh);
|
|
|
|
private:
|
|
Atomic<std::shared_ptr<const EmoteMap>> global_;
|
|
};
|
|
|
|
} // namespace chatterino
|