mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-11-26 11:22:36 +00:00
Merge pull request #14082 from Simonx22/analytics/reload-on-setting-change
DolphinAnalytics: Reload backend when config changes
This commit is contained in:
commit
a459dc0d25
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@ -17,7 +18,7 @@ namespace Config
|
|||||||
{
|
{
|
||||||
struct ConfigChangedCallbackID
|
struct ConfigChangedCallbackID
|
||||||
{
|
{
|
||||||
size_t id = -1;
|
size_t id = std::numeric_limits<size_t>::max();
|
||||||
|
|
||||||
bool operator==(const ConfigChangedCallbackID&) const = default;
|
bool operator==(const ConfigChangedCallbackID&) const = default;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -58,6 +58,13 @@ DolphinAnalytics::DolphinAnalytics()
|
|||||||
{
|
{
|
||||||
ReloadConfig();
|
ReloadConfig();
|
||||||
MakeBaseBuilder();
|
MakeBaseBuilder();
|
||||||
|
|
||||||
|
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { ReloadConfig(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
DolphinAnalytics::~DolphinAnalytics()
|
||||||
|
{
|
||||||
|
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
DolphinAnalytics& DolphinAnalytics::Instance()
|
DolphinAnalytics& DolphinAnalytics::Instance()
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "Common/Analytics.h"
|
#include "Common/Analytics.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/Config/Config.h"
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -108,6 +109,9 @@ class DolphinAnalytics
|
|||||||
public:
|
public:
|
||||||
// Performs lazy-initialization of a singleton and returns the instance.
|
// Performs lazy-initialization of a singleton and returns the instance.
|
||||||
static DolphinAnalytics& Instance();
|
static DolphinAnalytics& Instance();
|
||||||
|
DolphinAnalytics(const DolphinAnalytics&) = delete;
|
||||||
|
DolphinAnalytics& operator=(const DolphinAnalytics&) = delete;
|
||||||
|
~DolphinAnalytics();
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
// Get value from java.
|
// Get value from java.
|
||||||
@ -198,4 +202,5 @@ private:
|
|||||||
|
|
||||||
std::mutex m_reporter_mutex;
|
std::mutex m_reporter_mutex;
|
||||||
Common::AnalyticsReporter m_reporter;
|
Common::AnalyticsReporter m_reporter;
|
||||||
|
Config::ConfigChangedCallbackID m_config_changed_callback_id{};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user