refactor: Twitch PubSub client (#5059)

* Remove unused `setAccountData` function

* Move PubSub out of TwitchIrcServer and into Application

* Add changelog entry

* fix: assert feedback

* Add PubSub::unlistenPrefix as per review suggestion

* Fix tests

* quit pubsub on exit

might conflict with exit removal, so can be reverted but this shows it's possible

* Don't manually call stop on clients, it's called when the connection is closed

* nit: rename `mainThread` to `thread`

* Join in a thread!!!!!!!!
This commit is contained in:
pajlada
2024-01-06 13:18:37 +01:00
committed by GitHub
parent e48d868e8c
commit 416806bb0a
14 changed files with 458 additions and 484 deletions
+9
View File
@@ -68,6 +68,7 @@ public:
virtual HighlightController *getHighlights() = 0;
virtual NotificationController *getNotifications() = 0;
virtual ITwitchIrcServer *getTwitch() = 0;
virtual PubSub *getTwitchPubSub() = 0;
virtual Logging *getChatLogger() = 0;
virtual ChatterinoBadges *getChatterinoBadges() = 0;
virtual FfzBadges *getFfzBadges() = 0;
@@ -97,6 +98,12 @@ public:
Application &operator=(const Application &) = delete;
Application &operator=(Application &&) = delete;
/**
* In the interim, before we remove _exit(0); from RunGui.cpp,
* this will destroy things we know can be destroyed
*/
void fakeDtor();
void initialize(Settings &settings, Paths &paths);
void load();
void save();
@@ -128,6 +135,7 @@ public:
private:
TwitchLiveController *const twitchLiveController{};
std::unique_ptr<PubSub> twitchPubSub;
const std::unique_ptr<Logging> logging;
public:
@@ -181,6 +189,7 @@ public:
return this->highlights;
}
ITwitchIrcServer *getTwitch() override;
PubSub *getTwitchPubSub() override;
Logging *getChatLogger() override;
ChatterinoBadges *getChatterinoBadges() override
{