feat: add option to suppress live notifications on startup (#5388)
This commit is contained in:
@@ -56,7 +56,7 @@ void TwitchLiveController::add(const std::shared_ptr<TwitchChannel> &newChannel)
|
||||
|
||||
{
|
||||
std::unique_lock lock(this->channelsMutex);
|
||||
this->channels[channelID] = newChannel;
|
||||
this->channels[channelID] = {.ptr = newChannel, .wasChecked = false};
|
||||
}
|
||||
|
||||
{
|
||||
@@ -120,9 +120,11 @@ void TwitchLiveController::request(std::optional<QStringList> optChannelIDs)
|
||||
auto it = this->channels.find(result.first);
|
||||
if (it != channels.end())
|
||||
{
|
||||
if (auto channel = it->second.lock(); channel)
|
||||
if (auto channel = it->second.ptr.lock(); channel)
|
||||
{
|
||||
channel->updateStreamStatus(result.second);
|
||||
channel->updateStreamStatus(
|
||||
result.second, !it->second.wasChecked);
|
||||
it->second.wasChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -159,7 +161,7 @@ void TwitchLiveController::request(std::optional<QStringList> optChannelIDs)
|
||||
auto it = this->channels.find(helixChannel.userId);
|
||||
if (it != this->channels.end())
|
||||
{
|
||||
if (auto channel = it->second.lock(); channel)
|
||||
if (auto channel = it->second.ptr.lock(); channel)
|
||||
{
|
||||
channel->updateStreamTitle(helixChannel.title);
|
||||
channel->updateDisplayName(helixChannel.name);
|
||||
|
||||
@@ -49,6 +49,11 @@ public:
|
||||
void add(const std::shared_ptr<TwitchChannel> &newChannel) override;
|
||||
|
||||
private:
|
||||
struct ChannelEntry {
|
||||
std::weak_ptr<TwitchChannel> ptr;
|
||||
bool wasChecked = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Run batched Helix Channels & Stream requests for channels
|
||||
*
|
||||
@@ -64,7 +69,7 @@ private:
|
||||
*
|
||||
* These channels will have their stream status updated every REFRESH_INTERVAL seconds
|
||||
**/
|
||||
std::unordered_map<QString, std::weak_ptr<TwitchChannel>> channels;
|
||||
std::unordered_map<QString, ChannelEntry> channels;
|
||||
std::shared_mutex channelsMutex;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user