qol[mcAccountSpinner]: Make pickaccount() workaround more explicit to the user

This commit is contained in:
alexytomi 2025-06-30 18:53:04 +08:00
parent 8b6fef135e
commit 791afe14c9
2 changed files with 18 additions and 5 deletions

View File

@ -48,6 +48,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import fr.spse.extended_view.ExtendedTextView;
@ -301,14 +302,23 @@ public class mcAccountSpinner extends AppCompatSpinner implements AdapterView.On
PojavProfile.setCurrentProfile(getContext(), mAccountList.get(position));
selectedAccount = PojavProfile.getCurrentProfileContent(getContext(), mAccountList.get(position));
// WORKAROUND
// Account file corrupted due to previous versions having improper encoding
if (selectedAccount == null){
removeCurrentAccount();
pickAccount(-1);
setSelection(0);
return;
Context ctx = Objects.requireNonNull(getContext());
new AlertDialog.Builder(ctx)
.setCancelable(false)
.setTitle(R.string.account_corrupted)
.setMessage(R.string.login_again)
.setPositiveButton(R.string.delete_account_and_login, (dialog, which) -> {
removeCurrentAccount();
pickAccount(-1);
setSelection(0);
})
.show();
}
setSelection(position);
}else {

View File

@ -450,4 +450,7 @@
<string name="change_account">Please change accounts to use this function</string>
<string name="no_minecraft_account_found">No Minecraft Account Found</string>
<string name="feature_requires_java_account">This feature requires a Microsoft account that owns Minecraft Java Edition.</string>
<string name="delete_account_and_login">Delete account and log in</string>
<string name="login_again">Please log in again</string>
<string name="account_corrupted">Selected account is corrupted</string>
</resources>