mirror-chatterino2/src/controllers/notifications/NotificationController.hpp
pajlada 9a8b85e338
Twitch API: v5 to Helix migration (#1560)
There's a document in src/providers/twitch/api which describes how we interact with the Twitch API.
Keeping this up to date might be a healthy way for us to ensure we keep using the right APIs for the right job.
2020-03-14 12:13:57 +01:00

58 lines
1.5 KiB
C++

#pragma once
#include "common/SignalVector.hpp"
#include "common/Singleton.hpp"
#include "singletons/Settings.hpp"
#include <QTimer>
namespace chatterino {
class Settings;
class Paths;
class NotificationModel;
enum class Platform : uint8_t {
Twitch, // 0
// Mixer, // 1
};
class NotificationController final : public Singleton, private QObject
{
public:
virtual void initialize(Settings &settings, Paths &paths) override;
bool isChannelNotified(const QString &channelName, Platform p);
void updateChannelNotification(const QString &channelName, Platform p);
void addChannelNotification(const QString &channelName, Platform p);
void removeChannelNotification(const QString &channelName, Platform p);
void playSound();
SignalVector<QString> getVector(Platform p);
std::map<Platform, SignalVector<QString>> channelMap;
NotificationModel *createModel(QObject *parent, Platform p);
private:
bool initialized_ = false;
void fetchFakeChannels();
void removeFakeChannel(const QString channelName);
void getFakeTwitchChannelLiveStatus(const QString &channelName);
// fakeTwitchChannels is a list of streams who are live that we have already sent out a notification for
std::vector<QString> fakeTwitchChannels;
QTimer *liveStatusTimer_;
ChatterinoSetting<std::vector<QString>> twitchSetting_ = {
"/notifications/twitch"};
/*
ChatterinoSetting<std::vector<QString>> mixerSetting_ = {
"/notifications/mixer"};
*/
};
} // namespace chatterino