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:
Carl Schwan
2021-02-05 23:49:02 +01:00
committed by Nicolas Fella
parent 10054bf879
commit 6dcfad1f8d
2 changed files with 5 additions and 1 deletions

View File

@@ -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 {

View File

@@ -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();
}
}