Don't show login page when starting NeoChat
This was caused by us calling initiated to early. Only do it when no accounts exists or that at least one account fails to login. Fix #248
This commit is contained in:
committed by
Nicolas Fella
parent
10054bf879
commit
6dcfad1f8d
@@ -251,6 +251,9 @@ Kirigami.ApplicationWindow {
|
||||
target: Controller
|
||||
|
||||
function onInitiated() {
|
||||
if (roomManager.hasOpenRoom) {
|
||||
return;
|
||||
}
|
||||
if (Controller.accountCount === 0) {
|
||||
pageStack.replace("qrc:/imports/NeoChat/Page/LoginPage.qml", {});
|
||||
} else {
|
||||
|
||||
@@ -282,6 +282,7 @@ void Controller::invokeLogin()
|
||||
Q_EMIT errorOccured(i18n("Login Failed"), error);
|
||||
logout(connection, true);
|
||||
}
|
||||
Q_EMIT initiated();
|
||||
});
|
||||
connect(connection, &Connection::networkError, this, [=](const QString &error, const QString &, int, int) {
|
||||
Q_EMIT errorOccured("Network Error", error);
|
||||
@@ -289,7 +290,7 @@ void Controller::invokeLogin()
|
||||
connection->connectWithToken(account.userId(), accessToken, account.deviceId());
|
||||
}
|
||||
}
|
||||
if (m_connections.isEmpty()) {
|
||||
if (accounts.isEmpty()) {
|
||||
Q_EMIT initiated();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user