2018-06-05 17:39:49 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
#include <memory>
|
2018-06-05 17:39:49 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
#include "common/UniqueAccess.hpp"
|
|
|
|
#include "messages/Emote.hpp"
|
|
|
|
#include "messages/EmoteCache.hpp"
|
2018-06-05 17:39:49 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
class BttvEmotes final : std::enable_shared_from_this<BttvEmotes>
|
2018-06-05 17:39:49 +02:00
|
|
|
{
|
2018-08-02 14:23:27 +02:00
|
|
|
static constexpr const char *globalEmoteApiUrl = "https://api.betterttv.net/2/emotes";
|
|
|
|
|
2018-06-05 17:39:49 +02:00
|
|
|
public:
|
2018-08-02 14:23:27 +02:00
|
|
|
// BttvEmotes();
|
2018-06-05 17:39:49 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
AccessGuard<const EmoteMap> accessGlobalEmotes() const;
|
|
|
|
boost::optional<EmotePtr> getGlobalEmote(const EmoteName &name);
|
|
|
|
boost::optional<EmotePtr> getEmote(const EmoteId &id);
|
2018-06-05 17:39:49 +02:00
|
|
|
|
|
|
|
void loadGlobalEmotes();
|
|
|
|
|
2018-06-07 12:22:28 +02:00
|
|
|
private:
|
2018-08-02 14:23:27 +02:00
|
|
|
std::pair<Outcome, EmoteMap> parseGlobalEmotes(const QJsonObject &jsonRoot,
|
|
|
|
const EmoteMap ¤tEmotes);
|
|
|
|
|
|
|
|
UniqueAccess<EmoteMap> globalEmotes_;
|
|
|
|
// UniqueAccess<WeakEmoteIdMap> channelEmoteCache_;
|
2018-06-05 17:39:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|