mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Treat relogin failed messages from spotify differently, and only show the error dialog once.
This commit is contained in:
parent
e16f1d8bdd
commit
89e8634928
@ -317,7 +317,7 @@ void SpotifyClient::Login(const spotify_pb::LoginRequest& req) {
|
||||
if (error != SP_ERROR_OK) {
|
||||
qLog(Warning) << "Tried to relogin but no stored credentials";
|
||||
SendLoginCompleted(false, sp_error_message(error),
|
||||
spotify_pb::LoginResponse_Error_BadUsernameOrPassword);
|
||||
spotify_pb::LoginResponse_Error_ReloginFailed);
|
||||
}
|
||||
} else {
|
||||
sp_session_login(session_,
|
||||
|
@ -37,6 +37,7 @@ message LoginResponse {
|
||||
UserBanned = 2;
|
||||
UserNeedsPremium = 3;
|
||||
Other = 4;
|
||||
ReloginFailed = 5;
|
||||
}
|
||||
|
||||
required bool success = 1;
|
||||
|
@ -140,10 +140,9 @@ void SpotifyService::LoginCompleted(bool success, const QString& error,
|
||||
login_task_id_ = 0;
|
||||
}
|
||||
|
||||
login_state_ = LoginState_LoggedIn;
|
||||
|
||||
if (!success) {
|
||||
QMessageBox::warning(NULL, tr("Spotify login error"), error, QMessageBox::Close);
|
||||
bool show_error_dialog = true;
|
||||
QString error_copy(error);
|
||||
|
||||
switch (error_code) {
|
||||
case spotify_pb::LoginResponse_Error_BadUsernameOrPassword:
|
||||
@ -158,9 +157,28 @@ void SpotifyService::LoginCompleted(bool success, const QString& error,
|
||||
login_state_ = LoginState_NoPremium;
|
||||
break;
|
||||
|
||||
case spotify_pb::LoginResponse_Error_ReloginFailed:
|
||||
if (login_state_ == LoginState_LoggedIn) {
|
||||
// This is the first time the relogin has failed - show a message this
|
||||
// time only.
|
||||
error_copy = tr("You have been logged out of Spotify, please re-enter your password in the Settings dialog.");
|
||||
} else {
|
||||
show_error_dialog = false;
|
||||
}
|
||||
|
||||
login_state_ = LoginState_ReloginFailed;
|
||||
break;
|
||||
|
||||
default:
|
||||
login_state_ = LoginState_OtherError;
|
||||
break;
|
||||
}
|
||||
|
||||
if (show_error_dialog) {
|
||||
QMessageBox::warning(NULL, tr("Spotify login error"), error_copy, QMessageBox::Close);
|
||||
}
|
||||
} else {
|
||||
login_state_ = LoginState_LoggedIn;
|
||||
}
|
||||
|
||||
QSettings s;
|
||||
|
@ -39,7 +39,8 @@ public:
|
||||
LoginState_Banned = 2,
|
||||
LoginState_BadCredentials = 3,
|
||||
LoginState_NoPremium = 4,
|
||||
LoginState_OtherError = 5
|
||||
LoginState_OtherError = 5,
|
||||
LoginState_ReloginFailed = 6
|
||||
};
|
||||
|
||||
static const char* kServiceName;
|
||||
|
@ -154,6 +154,10 @@ void SpotifySettingsPage::UpdateLoginState() {
|
||||
ui_->login_state->SetAccountTypeText(tr("Your username or password was incorrect."));
|
||||
break;
|
||||
|
||||
case SpotifyService::LoginState_ReloginFailed:
|
||||
ui_->login_state->SetAccountTypeText(tr("You have been logged out of Spotify, please re-enter your password."));
|
||||
break;
|
||||
|
||||
default:
|
||||
ui_->login_state->SetAccountTypeText(tr("A Spotify Premium account is required."));
|
||||
break;
|
||||
|
@ -244,7 +244,7 @@ msgstr ""
|
||||
msgid "A Grooveshark Anywhere account is required."
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifysettingspage.cpp:158
|
||||
#: internet/spotifysettingspage.cpp:162
|
||||
msgid "A Spotify Premium account is required."
|
||||
msgstr ""
|
||||
|
||||
@ -1008,7 +1008,7 @@ msgstr ""
|
||||
msgid "Configure Shortcuts"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:472
|
||||
#: internet/spotifyservice.cpp:490
|
||||
msgid "Configure Spotify..."
|
||||
msgstr ""
|
||||
|
||||
@ -1029,7 +1029,7 @@ msgstr ""
|
||||
msgid "Connect device"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:227
|
||||
#: internet/spotifyservice.cpp:245
|
||||
msgid "Connecting to Spotify"
|
||||
msgstr ""
|
||||
|
||||
@ -2057,7 +2057,7 @@ msgid ""
|
||||
"time a song finishes."
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:328
|
||||
#: internet/spotifyservice.cpp:346
|
||||
msgid "Inbox"
|
||||
msgstr ""
|
||||
|
||||
@ -2466,7 +2466,7 @@ msgstr ""
|
||||
msgid "Main profile (MAIN)"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:477
|
||||
#: internet/spotifyservice.cpp:495
|
||||
msgid "Make playlist available offline"
|
||||
msgstr ""
|
||||
|
||||
@ -3403,15 +3403,15 @@ msgstr ""
|
||||
msgid "Search Magnatune"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifysearchplaylisttype.cpp:32 internet/spotifyservice.cpp:585
|
||||
#: internet/spotifysearchplaylisttype.cpp:32 internet/spotifyservice.cpp:603
|
||||
msgid "Search Spotify"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:319
|
||||
#: internet/spotifyservice.cpp:337
|
||||
msgid "Search Spotify (opens a new tab)"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:470
|
||||
#: internet/spotifyservice.cpp:488
|
||||
msgid "Search Spotify (opens a new tab)..."
|
||||
msgstr ""
|
||||
|
||||
@ -3743,7 +3743,7 @@ msgstr ""
|
||||
msgid "Spotify"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:146
|
||||
#: internet/spotifyservice.cpp:178
|
||||
msgid "Spotify login error"
|
||||
msgstr ""
|
||||
|
||||
@ -3759,7 +3759,7 @@ msgstr ""
|
||||
msgid "Standard"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:324
|
||||
#: internet/spotifyservice.cpp:342
|
||||
msgid "Starred"
|
||||
msgstr ""
|
||||
|
||||
@ -3854,15 +3854,15 @@ msgstr ""
|
||||
msgid "Switch provider"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:496
|
||||
#: internet/spotifyservice.cpp:514
|
||||
msgid "Syncing Spotify inbox"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:491
|
||||
#: internet/spotifyservice.cpp:509
|
||||
msgid "Syncing Spotify playlist"
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:500
|
||||
#: internet/spotifyservice.cpp:518
|
||||
msgid "Syncing Spotify starred tracks"
|
||||
msgstr ""
|
||||
|
||||
@ -4464,6 +4464,16 @@ msgstr ""
|
||||
msgid "You do not have a Spotify Premium account."
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifyservice.cpp:164
|
||||
msgid ""
|
||||
"You have been logged out of Spotify, please re-enter your password in the "
|
||||
"Settings dialog."
|
||||
msgstr ""
|
||||
|
||||
#: internet/spotifysettingspage.cpp:158
|
||||
msgid "You have been logged out of Spotify, please re-enter your password."
|
||||
msgstr ""
|
||||
|
||||
#: songinfo/lastfmtrackinfoprovider.cpp:95
|
||||
msgid "You love this track"
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user