GH-4071 Heavily refactor and rearchitect account system
This makes the account system much more modular and makes it treat errors as something recoverable, unless they come directly from the MSA refresh token becoming invalid.
This commit is contained in:
@ -170,13 +170,7 @@ void AccountListPage::on_actionRefresh_triggered() {
|
||||
if (selection.size() > 0) {
|
||||
QModelIndex selected = selection.first();
|
||||
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
|
||||
AuthSessionPtr session = std::make_shared<AuthSession>();
|
||||
auto task = account->refresh(session);
|
||||
if (task) {
|
||||
ProgressDialog progDialog(this);
|
||||
progDialog.execWithTask(task.get());
|
||||
// TODO: respond to results of the task
|
||||
}
|
||||
m_accounts->requestRefresh(account->internalId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,15 +238,9 @@ void AccountListPage::on_actionDeleteSkin_triggered()
|
||||
return;
|
||||
|
||||
QModelIndex selected = selection.first();
|
||||
AuthSessionPtr session = std::make_shared<AuthSession>();
|
||||
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
|
||||
auto login = account->refresh(session);
|
||||
ProgressDialog prog(this);
|
||||
if (prog.execWithTask((Task*)login.get()) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to login!"), QMessageBox::Warning)->exec();
|
||||
return;
|
||||
}
|
||||
auto deleteSkinTask = std::make_shared<SkinDelete>(this, session);
|
||||
auto deleteSkinTask = std::make_shared<SkinDelete>(this, account->accessToken());
|
||||
if (prog.execWithTask((Task*)deleteSkinTask.get()) != QDialog::Accepted) {
|
||||
CustomMessageBox::selectable(this, tr("Skin Delete"), tr("Failed to delete current skin!"), QMessageBox::Warning)->exec();
|
||||
return;
|
||||
|
Reference in New Issue
Block a user