Show login screen with error message if automatic login did not work.
If user has left main menu screen, an error notification message is displayed. For #1778.
This commit is contained in:
parent
2c1b80b939
commit
e56b4e33bc
src
@ -52,6 +52,8 @@ public:
|
|||||||
m_message = message;
|
m_message = message;
|
||||||
if(mt==MessageQueue::MT_ACHIEVEMENT)
|
if(mt==MessageQueue::MT_ACHIEVEMENT)
|
||||||
m_render_type = "achievement-message::neutral";
|
m_render_type = "achievement-message::neutral";
|
||||||
|
else if (mt==MessageQueue::MT_ERROR)
|
||||||
|
m_render_type = "achievement-message::neutral";
|
||||||
else
|
else
|
||||||
m_render_type = "friend-message::neutral";
|
m_render_type = "friend-message::neutral";
|
||||||
} // Message
|
} // Message
|
||||||
@ -77,7 +79,7 @@ class CompareMessages
|
|||||||
public:
|
public:
|
||||||
/** Used to sort messages by priority in the priority queue. Achievement
|
/** Used to sort messages by priority in the priority queue. Achievement
|
||||||
* messages (1) need to have a higher priority than friend messages
|
* messages (1) need to have a higher priority than friend messages
|
||||||
* (value 0). */
|
* (value 0), and errors (3) the highest priority. */
|
||||||
bool operator() (const Message *a, const Message *b) const
|
bool operator() (const Message *a, const Message *b) const
|
||||||
{
|
{
|
||||||
return a->getMessageType() < b->getMessageType();
|
return a->getMessageType() < b->getMessageType();
|
||||||
|
@ -34,7 +34,7 @@ namespace MessageQueue
|
|||||||
* different look. This type is used to sort the messages, so it is
|
* different look. This type is used to sort the messages, so it is
|
||||||
* important that messages that need to be shown as early as possible
|
* important that messages that need to be shown as early as possible
|
||||||
* will be listed last (i.e. have highest priority). */
|
* will be listed last (i.e. have highest priority). */
|
||||||
enum MessageType {MT_FRIEND, MT_ACHIEVEMENT};
|
enum MessageType { MT_FRIEND, MT_ACHIEVEMENT, MT_ERROR};
|
||||||
|
|
||||||
void add(MessageType mt, const core::stringw &message);
|
void add(MessageType mt, const core::stringw &message);
|
||||||
void updatePosition();
|
void updatePosition();
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "online/online_profile.hpp"
|
#include "online/online_profile.hpp"
|
||||||
#include "online/profile_manager.hpp"
|
#include "online/profile_manager.hpp"
|
||||||
#include "online/servers_manager.hpp"
|
#include "online/servers_manager.hpp"
|
||||||
|
#include "states_screens/main_menu_screen.hpp"
|
||||||
#include "states_screens/online_profile_friends.hpp"
|
#include "states_screens/online_profile_friends.hpp"
|
||||||
#include "states_screens/user_screen.hpp"
|
#include "states_screens/user_screen.hpp"
|
||||||
#include "states_screens/dialogs/change_password_dialog.hpp"
|
#include "states_screens/dialogs/change_password_dialog.hpp"
|
||||||
@ -141,7 +142,6 @@ namespace Online
|
|||||||
{
|
{
|
||||||
PlayerManager::getCurrentPlayer()->signIn(isSuccess(), getXMLData());
|
PlayerManager::getCurrentPlayer()->signIn(isSuccess(), getXMLData());
|
||||||
GUIEngine::Screen *screen = GUIEngine::getCurrentScreen();
|
GUIEngine::Screen *screen = GUIEngine::getCurrentScreen();
|
||||||
BaseUserScreen *login = dynamic_cast<BaseUserScreen*>(screen);
|
|
||||||
|
|
||||||
// If the login is successful, reset any saved session of other
|
// If the login is successful, reset any saved session of other
|
||||||
// local players using the same online account (which are now invalid)
|
// local players using the same online account (which are now invalid)
|
||||||
@ -160,6 +160,8 @@ namespace Online
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test if failure while showing user login screen
|
||||||
|
BaseUserScreen *login = dynamic_cast<BaseUserScreen*>(screen);
|
||||||
if (login)
|
if (login)
|
||||||
{
|
{
|
||||||
if(isSuccess())
|
if(isSuccess())
|
||||||
@ -167,6 +169,26 @@ namespace Online
|
|||||||
else
|
else
|
||||||
login->loginError(getInfo());
|
login->loginError(getInfo());
|
||||||
} // if dialog
|
} // if dialog
|
||||||
|
|
||||||
|
// Check if failure happened during automatic (saved) signin.
|
||||||
|
else if (!isSuccess())
|
||||||
|
{
|
||||||
|
if (GUIEngine::getCurrentScreen() != MainMenuScreen::getInstance())
|
||||||
|
{
|
||||||
|
// User has already opened another menu, so use message queue
|
||||||
|
// to inform user that login failed.
|
||||||
|
MessageQueue::add(MessageQueue::MT_ERROR, getInfo());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// User still at main menu screen, push user screen. Note that
|
||||||
|
// this function is called from the main thread, so we can
|
||||||
|
// push screens without synchronisations.
|
||||||
|
UserScreen::getInstance()->push();
|
||||||
|
UserScreen::getInstance()->loginError(getInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // SignInRequest::callback
|
} // SignInRequest::callback
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user