this commit is too big
This commit is contained in:
@@ -1,27 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/Emotemap.hpp"
|
||||
#include "common/SimpleSignalVector.hpp"
|
||||
#include "util/ConcurrentMap.hpp"
|
||||
#include <memory>
|
||||
|
||||
#include <map>
|
||||
#include "common/UniqueAccess.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
#include "messages/EmoteCache.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class FFZEmotes
|
||||
class FfzEmotes final : std::enable_shared_from_this<FfzEmotes>
|
||||
{
|
||||
public:
|
||||
EmoteMap globalEmotes;
|
||||
SimpleSignalVector<QString> globalEmoteCodes;
|
||||
static constexpr const char *globalEmoteApiUrl = "https://api.frankerfacez.com/v1/set/global";
|
||||
static constexpr const char *channelEmoteApiUrl = "https://api.betterttv.net/2/channels/";
|
||||
|
||||
EmoteMap channelEmotes;
|
||||
std::map<QString, SimpleSignalVector<QString>> channelEmoteCodes;
|
||||
public:
|
||||
// FfzEmotes();
|
||||
|
||||
static std::shared_ptr<FfzEmotes> create();
|
||||
|
||||
AccessGuard<const EmoteCache<EmoteName>> accessGlobalEmotes() const;
|
||||
boost::optional<EmotePtr> getGlobalEmote(const EmoteName &name);
|
||||
boost::optional<EmotePtr> getEmote(const EmoteId &id);
|
||||
|
||||
void loadGlobalEmotes();
|
||||
void loadChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> channelEmoteMap);
|
||||
void loadChannelEmotes(const QString &channelName, std::function<void(EmoteMap &&)> callback);
|
||||
|
||||
private:
|
||||
ConcurrentMap<int, EmoteData> channelEmoteCache_;
|
||||
protected:
|
||||
Outcome parseGlobalEmotes(const QJsonObject &jsonRoot);
|
||||
Outcome parseChannelEmotes(const QJsonObject &jsonRoot);
|
||||
|
||||
UniqueAccess<EmoteCache<EmoteName>> globalEmotes_;
|
||||
UniqueAccess<WeakEmoteIdMap> channelEmoteCache_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user