refactor: Un-singletonize Paths & Updates (#5092)
This commit is contained in:
@@ -8,13 +8,12 @@ namespace {
|
||||
|
||||
using namespace chatterino;
|
||||
|
||||
std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance()
|
||||
std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance(
|
||||
const Paths &paths)
|
||||
{
|
||||
auto sm = std::make_shared<pajlada::Settings::SettingManager>();
|
||||
|
||||
auto *paths = getPaths();
|
||||
|
||||
auto path = combinePath(paths->settingsDirectory, "user-data.json");
|
||||
auto path = combinePath(paths.settingsDirectory, "user-data.json");
|
||||
|
||||
sm->setPath(path.toUtf8().toStdString());
|
||||
|
||||
@@ -30,8 +29,8 @@ std::shared_ptr<pajlada::Settings::SettingManager> initSettingsInstance()
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
UserDataController::UserDataController()
|
||||
: sm(initSettingsInstance())
|
||||
UserDataController::UserDataController(const Paths &paths)
|
||||
: sm(initSettingsInstance(paths))
|
||||
, setting("/users", this->sm)
|
||||
{
|
||||
this->sm->load();
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class Paths;
|
||||
|
||||
class IUserDataController
|
||||
{
|
||||
public:
|
||||
@@ -31,7 +33,7 @@ public:
|
||||
class UserDataController : public IUserDataController, public Singleton
|
||||
{
|
||||
public:
|
||||
UserDataController();
|
||||
explicit UserDataController(const Paths &paths);
|
||||
|
||||
// Get extra data about a user
|
||||
// If the user does not have any extra data, return none
|
||||
|
||||
Reference in New Issue
Block a user