Skip to content

Commit 791afe1

Browse files
committed
qol[mcAccountSpinner]: Make pickaccount() workaround more explicit to the user
1 parent 8b6fef1 commit 791afe1

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

app_pojavlauncher/src/main/java/com/kdt/mcgui/mcAccountSpinner.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.ArrayList;
4949
import java.util.HashMap;
5050
import java.util.List;
51+
import java.util.Objects;
5152

5253
import fr.spse.extended_view.ExtendedTextView;
5354

@@ -301,14 +302,23 @@ private void pickAccount(int position){
301302
PojavProfile.setCurrentProfile(getContext(), mAccountList.get(position));
302303
selectedAccount = PojavProfile.getCurrentProfileContent(getContext(), mAccountList.get(position));
303304

304-
305305
// WORKAROUND
306306
// Account file corrupted due to previous versions having improper encoding
307307
if (selectedAccount == null){
308-
removeCurrentAccount();
309-
pickAccount(-1);
310-
setSelection(0);
311-
return;
308+
Context ctx = Objects.requireNonNull(getContext());
309+
310+
new AlertDialog.Builder(ctx)
311+
.setCancelable(false)
312+
.setTitle(R.string.account_corrupted)
313+
.setMessage(R.string.login_again)
314+
.setPositiveButton(R.string.delete_account_and_login, (dialog, which) -> {
315+
removeCurrentAccount();
316+
pickAccount(-1);
317+
setSelection(0);
318+
})
319+
.show();
320+
321+
312322
}
313323
setSelection(position);
314324
}else {

app_pojavlauncher/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,4 +450,7 @@
450450
<string name="change_account">Please change accounts to use this function</string>
451451
<string name="no_minecraft_account_found">No Minecraft Account Found</string>
452452
<string name="feature_requires_java_account">This feature requires a Microsoft account that owns Minecraft Java Edition.</string>
453+
<string name="delete_account_and_login">Delete account and log in</string>
454+
<string name="login_again">Please log in again</string>
455+
<string name="account_corrupted">Selected account is corrupted</string>
453456
</resources>

0 commit comments

Comments
 (0)