Use New 7TV Cosmetics System (#4512)

* feat(seventv): use new cosmetics system

* chore: add changelog entry

* fix: old `clang-format`

* fix: small suggestions pt1

* refactor: add 7tv api wrapper

* fix: small clang-tidy things

* fix: remove unused constants

* fix: old clangtidy

* refactor: rename

* fix: increase interval to 60s

* fix: newline

* fix: Twitch

* docs: add comment

* fix: remove v2 badges endpoint

* fix: deadlock

This is actually really sad.

* fix: remove api entry

* fix: old clang-format

* Sort functions in SeventvBadges.hpp/cpp

* Remove unused vector include

* Add comments to SeventvBadges.hpp functions

* Rename `addBadge` to `registerBadge`

* fix: cleanup eventloop

* ci(test): add timeout

---------

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-07-29 11:49:44 +02:00
committed by GitHub
parent 8cfa5e866e
commit 33fa3e0a97
25 changed files with 828 additions and 189 deletions
+24 -1
View File
@@ -5,12 +5,14 @@
#include "common/Atomic.hpp"
#include "common/FlagsEnum.hpp"
#include <QJsonObject>
#include <memory>
namespace chatterino {
class ImageSet;
class Channel;
namespace seventv::eventapi {
struct EmoteAddDispatch;
struct EmoteUpdateDispatch;
@@ -61,6 +63,20 @@ struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class EmoteMap;
enum class SeventvEmoteSetKind : uint8_t {
Global,
Personal,
Channel,
};
enum class SeventvEmoteSetFlag : uint32_t {
Immutable = (1 << 0),
Privileged = (1 << 1),
Personal = (1 << 2),
Commercial = (1 << 3),
};
using SeventvEmoteSetFlags = FlagsEnum<SeventvEmoteSetFlag>;
class SeventvEmotes final
{
public:
@@ -120,6 +136,13 @@ public:
std::function<void(EmoteMap &&, QString)> successCallback,
std::function<void(QString)> errorCallback);
/**
* Creates an image set from a 7TV emote or badge.
*
* @param emoteData { host: { files: [], url } }
*/
static ImageSet createImageSet(const QJsonObject &emoteData);
private:
Atomic<std::shared_ptr<const EmoteMap>> global_;
};