fix: [#865] issue adding a second account
This commit is contained in:
parent
52fabe35ae
commit
3be6adcae0
6 changed files with 13 additions and 16 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -6,7 +6,7 @@
|
||||||
},
|
},
|
||||||
"[java]": {
|
"[java]": {
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.organizeImports": true
|
"source.organizeImports": "explicit"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"[github-actions-workflow]": {
|
"[github-actions-workflow]": {
|
||||||
|
|
|
@ -10,6 +10,7 @@ This changelog only contains the changes that are unreleased. For changes for in
|
||||||
### Fixes
|
### Fixes
|
||||||
- Creating pack not resetting modloader when switched back to none
|
- Creating pack not resetting modloader when switched back to none
|
||||||
- Issue with file downloads for non third party enabled files on CurseForge not working
|
- Issue with file downloads for non third party enabled files on CurseForge not working
|
||||||
|
- Issue adding a second account [#865]
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
- Remove old FTB pack installing code
|
- Remove old FTB pack installing code
|
||||||
|
|
|
@ -228,10 +228,6 @@ public abstract class AbstractAccount implements Serializable {
|
||||||
File file = FileSystem.SKINS.resolve((this.uuid == null ? "default" : this.getUUIDNoDashes()) + ".png")
|
File file = FileSystem.SKINS.resolve((this.uuid == null ? "default" : this.getUUIDNoDashes()) + ".png")
|
||||||
.toFile();
|
.toFile();
|
||||||
|
|
||||||
if (!file.exists()) {
|
|
||||||
this.updateSkin(); // Download/update the users skin
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the file doesn't exist then use the default Minecraft skin.
|
// If the file doesn't exist then use the default Minecraft skin.
|
||||||
if (file == null || !file.exists()) {
|
if (file == null || !file.exists()) {
|
||||||
return SkinUtils.getDefaultHead();
|
return SkinUtils.getDefaultHead();
|
||||||
|
@ -248,10 +244,6 @@ public abstract class AbstractAccount implements Serializable {
|
||||||
public ImageIcon getMinecraftSkin() {
|
public ImageIcon getMinecraftSkin() {
|
||||||
File file = FileSystem.SKINS.resolve(this.getUUIDNoDashes() + ".png").toFile();
|
File file = FileSystem.SKINS.resolve(this.getUUIDNoDashes() + ".png").toFile();
|
||||||
|
|
||||||
if (!file.exists()) {
|
|
||||||
this.updateSkin(); // Download/update the users skin
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the file doesn't exist then use the default Minecraft skin.
|
// If the file doesn't exist then use the default Minecraft skin.
|
||||||
if (file == null || !file.exists()) {
|
if (file == null || !file.exists()) {
|
||||||
return SkinUtils.getDefaultSkin();
|
return SkinUtils.getDefaultSkin();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class LoginWithMicrosoftDialog extends JDialog {
|
||||||
private static final HTTPServer server = new HTTPServer(Constants.MICROSOFT_LOGIN_REDIRECT_PORT);
|
private static final HTTPServer server = new HTTPServer(Constants.MICROSOFT_LOGIN_REDIRECT_PORT);
|
||||||
private static final VirtualHost host = server.getVirtualHost(null);
|
private static final VirtualHost host = server.getVirtualHost(null);
|
||||||
|
|
||||||
private MicrosoftAccount account = null;
|
public MicrosoftAccount account = null;
|
||||||
|
|
||||||
public LoginWithMicrosoftDialog() {
|
public LoginWithMicrosoftDialog() {
|
||||||
this(null);
|
this(null);
|
||||||
|
@ -192,6 +192,7 @@ public final class LoginWithMicrosoftDialog extends JDialog {
|
||||||
profile);
|
profile);
|
||||||
|
|
||||||
AccountManager.addAccount(account);
|
AccountManager.addAccount(account);
|
||||||
|
this.account = account;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,15 +54,15 @@ import com.atlauncher.evnt.manager.RelocalizationManager;
|
||||||
import com.atlauncher.gui.dialogs.LoginWithMicrosoftDialog;
|
import com.atlauncher.gui.dialogs.LoginWithMicrosoftDialog;
|
||||||
import com.atlauncher.gui.dialogs.ProgressDialog;
|
import com.atlauncher.gui.dialogs.ProgressDialog;
|
||||||
import com.atlauncher.gui.tabs.Tab;
|
import com.atlauncher.gui.tabs.Tab;
|
||||||
import com.atlauncher.viewmodel.base.IAccountsViewModel;
|
|
||||||
import com.atlauncher.viewmodel.base.IAccountsViewModel.LoginPostResult;
|
|
||||||
import com.atlauncher.viewmodel.base.IAccountsViewModel.LoginPreCheckResult;
|
|
||||||
import com.atlauncher.managers.AccountManager;
|
import com.atlauncher.managers.AccountManager;
|
||||||
import com.atlauncher.managers.DialogManager;
|
import com.atlauncher.managers.DialogManager;
|
||||||
import com.atlauncher.managers.LogManager;
|
import com.atlauncher.managers.LogManager;
|
||||||
import com.atlauncher.utils.ComboItem;
|
import com.atlauncher.utils.ComboItem;
|
||||||
import com.atlauncher.utils.OS;
|
import com.atlauncher.utils.OS;
|
||||||
import com.atlauncher.utils.SkinUtils;
|
import com.atlauncher.utils.SkinUtils;
|
||||||
|
import com.atlauncher.viewmodel.base.IAccountsViewModel;
|
||||||
|
import com.atlauncher.viewmodel.base.IAccountsViewModel.LoginPostResult;
|
||||||
|
import com.atlauncher.viewmodel.base.IAccountsViewModel.LoginPreCheckResult;
|
||||||
import com.atlauncher.viewmodel.impl.AccountsViewModel;
|
import com.atlauncher.viewmodel.impl.AccountsViewModel;
|
||||||
|
|
||||||
public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
||||||
|
@ -262,9 +262,14 @@ public class AccountsTab extends JPanel implements Tab, RelocalizationListener {
|
||||||
loginWithMicrosoftButton.addActionListener(e -> {
|
loginWithMicrosoftButton.addActionListener(e -> {
|
||||||
// TODO This should be handled by some reaction via listener
|
// TODO This should be handled by some reaction via listener
|
||||||
int numberOfAccountsBefore = viewModel.accountCount();
|
int numberOfAccountsBefore = viewModel.accountCount();
|
||||||
new LoginWithMicrosoftDialog();
|
LoginWithMicrosoftDialog dialog = new LoginWithMicrosoftDialog();
|
||||||
|
|
||||||
if (numberOfAccountsBefore != viewModel.accountCount()) {
|
if (numberOfAccountsBefore != viewModel.accountCount()) {
|
||||||
|
// account was added, so get the skin
|
||||||
|
if (dialog.account != null) {
|
||||||
|
dialog.account.updateSkin();
|
||||||
|
}
|
||||||
|
|
||||||
viewModel.pushNewAccounts();
|
viewModel.pushNewAccounts();
|
||||||
accountsComboBox.setSelectedItem(AccountManager.getSelectedAccount());
|
accountsComboBox.setSelectedItem(AccountManager.getSelectedAccount());
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,8 +226,6 @@ public class AccountManager {
|
||||||
accounts.add(account);
|
accounts.add(account);
|
||||||
ACCOUNTS.onNext(accounts);
|
ACCOUNTS.onNext(accounts);
|
||||||
|
|
||||||
account.updateSkin();
|
|
||||||
|
|
||||||
if (accounts.size() > 1) {
|
if (accounts.size() > 1) {
|
||||||
// not first account? ask if they want to switch to it
|
// not first account? ask if they want to switch to it
|
||||||
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Account Added"))
|
int ret = DialogManager.optionDialog().setTitle(GetText.tr("Account Added"))
|
||||||
|
|
Loading…
Reference in a new issue