Skip to content

Commit

Permalink
Merge branch 'PojavLauncherTeam:v3_openjdk' into v3_zink_freedreno
Browse files Browse the repository at this point in the history
  • Loading branch information
SolDev69 authored Aug 19, 2023
2 parents 2bc32ff + c2c57ca commit 432c6ea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app_pojavlauncher/src/main/assets/launcher_profiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"(Default)": {
"name": "(Default)",
"lastVersionId": "Unknown"
"lastVersionId": "1.7.10"
}
},
"selectedProfile": "(Default)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
});

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());
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ else if(LauncherProfiles.normalizeProfileIds(mainProfileJson)){
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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public static MinecraftProfile createTemplate(){
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){
Expand Down

0 comments on commit 432c6ea

Please sign in to comment.