mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix[vanilla-manifest]: Broken cache file will get redownloaded
This commit is contained in:
parent
09be377919
commit
458331fd7c
@ -165,7 +165,7 @@ public class LauncherActivity extends BaseActivity {
|
||||
|
||||
ExtraCore.addExtraListener(ExtraConstants.LAUNCH_GAME, mLaunchGameListener);
|
||||
|
||||
new AsyncVersionList().getVersionList(versions -> ExtraCore.setValue(ExtraConstants.RELEASE_TABLE, versions));
|
||||
new AsyncVersionList().getVersionList(versions -> ExtraCore.setValue(ExtraConstants.RELEASE_TABLE, versions), false);
|
||||
|
||||
mProgressLayout.observe(ProgressLayout.DOWNLOAD_MINECRAFT);
|
||||
mProgressLayout.observe(ProgressLayout.UNPACK_RUNTIME);
|
||||
|
@ -7,6 +7,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.JsonIOException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import net.kdt.pojavlaunch.JMinecraftVersionList;
|
||||
@ -22,7 +24,7 @@ import java.io.IOException;
|
||||
/** Class getting the version list, and that's all really */
|
||||
public class AsyncVersionList {
|
||||
|
||||
public void getVersionList(@Nullable VersionDoneListener listener){
|
||||
public void getVersionList(@Nullable VersionDoneListener listener, boolean secondPass){
|
||||
sExecutorService.execute(() -> {
|
||||
File versionFile = new File(Tools.DIR_DATA + "/version_list.json");
|
||||
JMinecraftVersionList versionList = null;
|
||||
@ -41,6 +43,11 @@ public class AsyncVersionList {
|
||||
versionList = Tools.GLOBAL_GSON.fromJson(new JsonReader(new FileReader(versionFile)), JMinecraftVersionList.class);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JsonIOException | JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
versionFile.delete();
|
||||
if(!secondPass)
|
||||
getVersionList(listener, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user