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