mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Show a warning message on login failure
This commit is contained in:
parent
af92430b18
commit
943bfb7329
@ -388,6 +388,7 @@ void Initialize() {
|
||||
}
|
||||
|
||||
static void login_password_callback(int result, const char *error_message, rc_client_t *client, void *userdata) {
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
switch (result) {
|
||||
case RC_OK:
|
||||
{
|
||||
@ -396,16 +397,20 @@ static void login_password_callback(int result, const char *error_message, rc_cl
|
||||
g_Config.sAchievementsUserName = user->username;
|
||||
NativeSaveSecret(RA_TOKEN_SECRET_NAME, std::string(user->token));
|
||||
OnAchievementsLoginStateChange();
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, di->T("Logged in!"));
|
||||
break;
|
||||
}
|
||||
case RC_INVALID_STATE:
|
||||
case RC_API_FAILURE:
|
||||
case RC_MISSING_VALUE:
|
||||
case RC_INVALID_JSON:
|
||||
ERROR_LOG(ACHIEVEMENTS, "Failure logging in via token: %d, %s", result, error_message);
|
||||
{
|
||||
ERROR_LOG(ACHIEVEMENTS, "Failure logging in via password: %d, %s", result, error_message);
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, di->T("Failed to log in, check your username and password."));
|
||||
OnAchievementsLoginStateChange();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OSDCloseBackgroundProgressDialog("cheevos_async_login");
|
||||
}
|
||||
|
@ -227,7 +227,6 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup)
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
} else {
|
||||
// TODO: Add UI for platforms that don't support System_AskUsernamePassword.
|
||||
if (System_GetPropertyBool(SYSPROP_HAS_LOGIN_DIALOG)) {
|
||||
viewGroup->Add(new Choice(ac->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
|
||||
System_AskUsernamePassword(ac->T("Log in"), [](const std::string &value, int) {
|
||||
@ -242,13 +241,18 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup)
|
||||
} else {
|
||||
// Hack up a temporary quick login-form-ish-thing
|
||||
viewGroup->Add(new PopupTextInputChoice(&username_, di->T("Username"), "", 128, screenManager()));
|
||||
viewGroup->Add(new PopupTextInputChoice(&password_, di->T("Password"), "", 128, screenManager()));
|
||||
viewGroup->Add(new Choice(di->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
|
||||
viewGroup->Add(new PopupTextInputChoice(&password_, di->T("Password"), "", 128, screenManager()))->SetPasswordDisplay();
|
||||
Choice *loginButton = viewGroup->Add(new Choice(di->T("Log in")));
|
||||
loginButton->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
|
||||
if (!username_.empty() && !password_.empty()) {
|
||||
Achievements::LoginAsync(username_.c_str(), password_.c_str());
|
||||
password_.clear();
|
||||
}
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
loginButton->SetEnabledFunc([&]() {
|
||||
return !username_.empty() && !password_.empty();
|
||||
});
|
||||
}
|
||||
viewGroup->Add(new Choice(ac->T("Register on www.retroachievements.org")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
|
||||
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://retroachievements.org/createaccount.php");
|
||||
@ -358,6 +362,7 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement
|
||||
float iconSpace = bounds.h - padding * 2.0f;
|
||||
dc.Flush();
|
||||
dc.RebindTexture();
|
||||
dc.PushScissor(bounds);
|
||||
|
||||
dc.Begin();
|
||||
|
||||
@ -423,6 +428,9 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement
|
||||
dc.Flush();
|
||||
dc.RebindTexture();
|
||||
}
|
||||
|
||||
dc.Flush();
|
||||
dc.PopScissor();
|
||||
}
|
||||
|
||||
void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, float alpha) {
|
||||
|
@ -360,6 +360,7 @@ Edit = Edit
|
||||
Enable All = Enable all
|
||||
Enabled = Enabled
|
||||
Enter = Enter
|
||||
Failed to log in, check your username and password. = Failed to log in, check your username and password.
|
||||
Filter = Filter
|
||||
Finish = Finish
|
||||
GE Frame Dumps = GE Frame Dumps
|
||||
@ -372,6 +373,7 @@ Loading = Loading\nPlease Wait...
|
||||
LoadingFailed = Unable to load data.
|
||||
Log in = Log in
|
||||
Log out = Log out
|
||||
Logged in! = Logged in!
|
||||
Move = Move
|
||||
Move Up = Move Up
|
||||
Move Down = Move Down
|
||||
|
@ -8,6 +8,7 @@ Achievements = Achievements
|
||||
Challenge Mode = Utmanings-läge
|
||||
Challenge Mode (no savestates) = Utmanings-läge (inga sparade state)
|
||||
Earned = Du har tjänat %d av %d achievements, och %d of %d poäng
|
||||
Failed to log in, check your username and password. = Misslyckades att logga in, kontrollera ditt användarnamn och lösenord.
|
||||
How to use RetroAchievements = Hur man använder RetroAchievements
|
||||
Leaderboard submission is enabled = Skickar in poäng till ledartabeller
|
||||
Leaderboards = Leaderboards
|
||||
|
Loading…
Reference in New Issue
Block a user