mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix: default profile deletion
This commit is contained in:
parent
ebbbba0680
commit
c2c57ca837
@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"(Default)": {
|
||||
"name": "(Default)",
|
||||
"lastVersionId": "Unknown"
|
||||
"lastVersionId": "1.7.10"
|
||||
}
|
||||
},
|
||||
"selectedProfile": "(Default)"
|
||||
|
@ -84,9 +84,12 @@ public class ProfileEditorFragment extends Fragment {
|
||||
});
|
||||
|
||||
mDeleteButton.setOnClickListener(v -> {
|
||||
LauncherProfiles.mainProfileJson.profiles.remove(mProfileKey);
|
||||
LauncherProfiles.update();
|
||||
ExtraCore.setValue(ExtraConstants.REFRESH_VERSION_SPINNER, DELETED_PROFILE);
|
||||
if(LauncherProfiles.mainProfileJson.profiles.size() > 1){
|
||||
LauncherProfiles.mainProfileJson.profiles.remove(mProfileKey);
|
||||
LauncherProfiles.update();
|
||||
ExtraCore.setValue(ExtraConstants.REFRESH_VERSION_SPINNER, DELETED_PROFILE);
|
||||
}
|
||||
|
||||
Tools.removeCurrentFragment(requireActivity());
|
||||
});
|
||||
|
||||
|
@ -28,6 +28,12 @@ public class LauncherProfiles {
|
||||
mainProfileJson = new MinecraftLauncherProfiles();
|
||||
mainProfileJson.profiles = new HashMap<>();
|
||||
}
|
||||
|
||||
// Make sure we have a default profile on start
|
||||
if (mainProfileJson.profiles.size() == 0){
|
||||
mainProfileJson.profiles.put("(Default)", MinecraftProfile.getDefaultProfile());
|
||||
LauncherProfiles.update();
|
||||
}
|
||||
} else {
|
||||
Tools.write(launcherProfilesFile.getAbsolutePath(), mainProfileJson.toJson());
|
||||
}
|
||||
|
@ -28,6 +28,13 @@ public class MinecraftProfile {
|
||||
return TEMPLATE;
|
||||
}
|
||||
|
||||
public static MinecraftProfile getDefaultProfile(){
|
||||
MinecraftProfile defaultProfile = new MinecraftProfile();
|
||||
defaultProfile.name = "Default";
|
||||
defaultProfile.lastVersionId = "1.7.10";
|
||||
return defaultProfile;
|
||||
}
|
||||
|
||||
public MinecraftProfile(){}
|
||||
|
||||
public MinecraftProfile(MinecraftProfile profile){
|
||||
|
Loading…
x
Reference in New Issue
Block a user