Improve initial active connection handling
If the last active connection is not reachable (server down, keychain problems, token revoked, etc.), NeoChat currently fails to load at all, with the only fix being to delete a line from the config file. This is surprisingly hard to fix with a nice UX as long as we stick to the principle of loading the user's last active connection automatically. This patch thus drops that principle; instead, the user is always asked to choose the connection to continue with.
This commit is contained in:
@@ -167,6 +167,8 @@ void Controller::invokeLogin()
|
||||
QString id = NeoChatConfig::self()->activeConnection();
|
||||
for (const auto &accountId : accounts) {
|
||||
AccountSettings account{accountId};
|
||||
m_accountsLoading += accountId;
|
||||
Q_EMIT accountsLoadingChanged();
|
||||
if (id.isEmpty()) {
|
||||
// handle case where the account config is empty
|
||||
id = accountId;
|
||||
@@ -186,6 +188,8 @@ void Controller::invokeLogin()
|
||||
connect(connection, &NeoChatConnection::connected, this, [this, connection, id] {
|
||||
connection->loadState();
|
||||
addConnection(connection);
|
||||
m_accountsLoading.removeAll(connection->userId());
|
||||
Q_EMIT accountsLoadingChanged();
|
||||
if (connection->userId() == id) {
|
||||
setActiveConnection(connection);
|
||||
connectSingleShot(connection, &NeoChatConnection::syncDone, this, &Controller::initiated);
|
||||
|
||||
Reference in New Issue
Block a user