mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Remove synchronous achievement login
Deletes AchievementManager::Login, renames LoginAsync to Login, and replaces the one synchronous call in the AchievementSettingsWidget with the async call. There is a minor usability regression in that the UI currently does not notify the user when a login has failed; this will be addressed in a later change (possibly in a different PR).
This commit is contained in:
parent
ba519e4670
commit
7b3fac18cd
@ -49,7 +49,7 @@ void AchievementManager::Init()
|
||||
m_image_queue.Reset("AchievementManagerImageQueue",
|
||||
[](const std::function<void()>& func) { func(); });
|
||||
if (IsLoggedIn())
|
||||
LoginAsync("", [](ResponseType r_type) {});
|
||||
Login("", [](ResponseType r_type) {});
|
||||
INFO_LOG_FMT(ACHIEVEMENTS, "Achievement Manager Initialized");
|
||||
}
|
||||
}
|
||||
@ -64,23 +64,7 @@ void AchievementManager::SetUpdateCallback(UpdateCallback callback)
|
||||
m_update_callback();
|
||||
}
|
||||
|
||||
AchievementManager::ResponseType AchievementManager::Login(const std::string& password)
|
||||
{
|
||||
if (!m_is_runtime_initialized)
|
||||
{
|
||||
ERROR_LOG_FMT(ACHIEVEMENTS, "Attempted login (sync) to RetroAchievements server without "
|
||||
"Achievement Manager initialized.");
|
||||
return ResponseType::MANAGER_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
const ResponseType r_type = VerifyCredentials(password);
|
||||
FetchBadges();
|
||||
|
||||
m_update_callback();
|
||||
return r_type;
|
||||
}
|
||||
|
||||
void AchievementManager::LoginAsync(const std::string& password, const ResponseCallback& callback)
|
||||
void AchievementManager::Login(const std::string& password, const ResponseCallback& callback)
|
||||
{
|
||||
if (!m_is_runtime_initialized)
|
||||
{
|
||||
|
@ -117,8 +117,7 @@ public:
|
||||
static AchievementManager& GetInstance();
|
||||
void Init();
|
||||
void SetUpdateCallback(UpdateCallback callback);
|
||||
ResponseType Login(const std::string& password);
|
||||
void LoginAsync(const std::string& password, const ResponseCallback& callback);
|
||||
void Login(const std::string& password, const ResponseCallback& callback);
|
||||
bool IsLoggedIn() const;
|
||||
void HashGame(const std::string& file_path, const ResponseCallback& callback);
|
||||
void HashGame(const DiscIO::Volume* volume, const ResponseCallback& callback);
|
||||
|
@ -254,9 +254,9 @@ void AchievementSettingsWidget::ToggleRAIntegration()
|
||||
void AchievementSettingsWidget::Login()
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::RA_USERNAME, m_common_username_input->text().toStdString());
|
||||
AchievementManager::GetInstance().Login(m_common_password_input->text().toStdString());
|
||||
AchievementManager::GetInstance().Login(m_common_password_input->text().toStdString(),
|
||||
[](AchievementManager::ResponseType r_type) {});
|
||||
m_common_password_input->setText(QString());
|
||||
m_common_login_failed->setVisible(Config::Get(Config::RA_API_TOKEN).empty());
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user