aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/global/AccountListPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-12-04 01:18:05 +0100
committerPetr Mrázek <peterix@gmail.com>2021-12-04 01:18:05 +0100
commit3c46d8a412956a759f61ae802c540ef72d00b35d (patch)
treef16564ba6be96b68ba5257a982c144320fff7911 /launcher/ui/pages/global/AccountListPage.cpp
parentffcef673de9fe848a92d23e02a2abed8df16eb9f (diff)
downloadPrismLauncher-3c46d8a412956a759f61ae802c540ef72d00b35d.tar.gz
PrismLauncher-3c46d8a412956a759f61ae802c540ef72d00b35d.tar.bz2
PrismLauncher-3c46d8a412956a759f61ae802c540ef72d00b35d.zip
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.
Diffstat (limited to 'launcher/ui/pages/global/AccountListPage.cpp')
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index 816dce47..d3eb2655 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -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;