Auth abort fixes (#3851)

This commit is contained in:
Alexandru Ionut Tripon 2025-06-09 18:32:38 +03:00 committed by GitHub
commit fbac04c170
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View file

@ -200,7 +200,7 @@ void LaunchController::login()
if ((m_accountToUse->accountType() != AccountType::Offline && m_accountToUse->accountState() == AccountState::Offline) ||
m_accountToUse->shouldRefresh()) {
// Force account refresh on the account used to launch the instance updating the AccountState
// only on first try and if it is not meant to be offline
// only on first try and if it is not meant to be offline
m_accountToUse->refresh();
}
while (tryagain) {
@ -296,11 +296,15 @@ void LaunchController::login()
case AccountState::Working: {
// refresh is in progress, we need to wait for it to finish to proceed.
ProgressDialog progDialog(m_parentWidget);
if (m_online) {
progDialog.setSkipButton(true, tr("Play Offline"));
}
progDialog.setSkipButton(true, tr("Abort"));
auto task = accountToCheck->currentTask();
progDialog.execWithTask(task.get());
// don't retry if aborted
if (task->getState() == Task::State::AbortedByUser)
tryagain = false;
continue;
}
case AccountState::Expired: {

View file

@ -181,8 +181,10 @@ void MinecraftAccount::authFailed(QString reason)
data.validity_ = Validity::None;
emit changed();
} break;
case AccountTaskState::STATE_WORKING: {
data.accountState = AccountState::Unchecked;
} break;
case AccountTaskState::STATE_CREATED:
case AccountTaskState::STATE_WORKING:
case AccountTaskState::STATE_SUCCEEDED: {
// Not reachable here, as they are not failures.
}