Gray out "Manage Skins" button for authlib-injector accounts

Support for this is blocked by
https://github.com/unmojang/FjordLauncher/issues/37, which we can get to
after the 9.0 release.
This commit is contained in:
Evan Goode 2024-10-27 13:19:33 -04:00
parent fab399c094
commit 5c8bdf99cd
5 changed files with 12 additions and 1 deletions

View File

@ -398,6 +398,11 @@ bool AccountData::usesCustomApiServers() const
return type == AccountType::AuthlibInjector;
}
bool AccountData::supportsSkinManagement() const
{
return type == AccountType::MSA;
}
QString AccountData::authServerUrl() const
{
if (usesCustomApiServers()) {

View File

@ -96,6 +96,7 @@ struct AccountData {
QJsonObject saveState() const;
bool resumeStateFromV3(QJsonObject data);
bool supportsSkinManagement() const;
bool usesCustomApiServers() const;
QString authServerUrl() const;
QString accountServerUrl() const;

View File

@ -119,6 +119,8 @@ class MinecraftAccount : public QObject, public Usable {
bool usesCustomApiServers() const { return data.usesCustomApiServers(); }
bool supportsSkinManagement() const { return data.supportsSkinManagement(); }
QString accountDisplayString() const { return data.accountDisplayString(); }
QString accessToken() const { return data.accessToken(); }

View File

@ -379,6 +379,7 @@ bool parseMinecraftProfileMojang(QByteArray& data, MinecraftProfile& output)
// we don't know the cape ID as it is not returned from the session server
// so just fake it - changing capes is probably locked anyway :(
capeOut.alias = "cape";
capeOut.id = "00000000-0000-0000-0000-000000000000";
}
}
}

View File

@ -238,15 +238,17 @@ void AccountListPage::updateButtonStates()
bool hasSelection = !selection.empty();
bool accountIsReady = false;
bool accountIsOnline = false;
bool accountSupportsSkinManagement = false;
if (hasSelection) {
QModelIndex selected = selection.first();
MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value<MinecraftAccountPtr>();
accountIsReady = !account->isActive();
accountIsOnline = account->accountType() != AccountType::Offline;
accountSupportsSkinManagement = account->supportsSkinManagement();
}
ui->actionRemove->setEnabled(accountIsReady);
ui->actionSetDefault->setEnabled(accountIsReady);
ui->actionManageSkins->setEnabled(accountIsReady && accountIsOnline);
ui->actionManageSkins->setEnabled(accountIsReady && accountIsOnline && accountSupportsSkinManagement);
ui->actionRefresh->setEnabled(accountIsReady && accountIsOnline);
if (m_accounts->defaultAccount().get() == nullptr) {