refactor: Move TwitchBadges to Application (#5096)

* refactor: Move TwitchBadges to Application

* refactor: Use named initializers

* refactor: Use `empty()` instead of `size() > 0`

* refactor: use emplace instead of push into the callback queue
This commit is contained in:
pajlada
2024-01-17 23:53:10 +01:00
committed by GitHub
parent 7d5967c248
commit 11838c8e16
9 changed files with 52 additions and 44 deletions
+10
View File
@@ -12,6 +12,7 @@
#include "controllers/notifications/NotificationController.hpp"
#include "controllers/sound/ISoundController.hpp"
#include "providers/seventv/SeventvAPI.hpp"
#include "providers/twitch/TwitchBadges.hpp"
#include "singletons/ImageUploader.hpp"
#ifdef CHATTERINO_HAVE_PLUGINS
# include "controllers/plugins/PluginController.hpp"
@@ -133,6 +134,7 @@ Application::Application(Settings &_settings, const Paths &paths,
, sound(&this->emplace<ISoundController>(makeSoundController(_settings)))
, twitchLiveController(&this->emplace<TwitchLiveController>())
, twitchPubSub(new PubSub(TWITCH_PUBSUB_URL))
, twitchBadges(new TwitchBadges)
, logging(new Logging(_settings))
#ifdef CHATTERINO_HAVE_PLUGINS
, plugins(&this->emplace(new PluginController(paths)))
@@ -153,6 +155,7 @@ Application::~Application() = default;
void Application::fakeDtor()
{
this->twitchPubSub.reset();
this->twitchBadges.reset();
}
void Application::initialize(Settings &settings, const Paths &paths)
@@ -320,6 +323,13 @@ ITwitchLiveController *Application::getTwitchLiveController()
return this->twitchLiveController;
}
TwitchBadges *Application::getTwitchBadges()
{
assert(this->twitchBadges);
return this->twitchBadges.get();
}
ITwitchIrcServer *Application::getTwitch()
{
return this->twitch;