Skip to content

Commit

Permalink
Refactor: rename ensureSha1 function
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Dec 9, 2023
1 parent 3635f53 commit 3a078e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public DownloadTask(String[] downloadurls,
public void run() {
for(String sourceUrl : mDownloadUrls) {
try {
DownloadUtils.downloadFileEnsureSha1(mDestination, mSha1, (Callable<Void>) () -> {
DownloadUtils.ensureSha1(mDestination, mSha1, (Callable<Void>) () -> {
IOException exception = tryDownload(sourceUrl);

if(exception != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import net.kdt.pojavlaunch.R;
import net.kdt.pojavlaunch.Tools;
import net.kdt.pojavlaunch.modloaders.ModloaderDownloadListener;
import net.kdt.pojavlaunch.modloaders.modpacks.imagecache.ModIconCache;
import net.kdt.pojavlaunch.modloaders.modpacks.models.ModDetail;
import net.kdt.pojavlaunch.progresskeeper.DownloaderProgressWrapper;
Expand All @@ -31,7 +30,7 @@ public static ModLoader installModpack(ModDetail modDetail, int selectedVersion,
ModLoader modLoaderInfo;
try {
byte[] downloadBuffer = new byte[8192];
DownloadUtils.downloadFileEnsureSha1(modpackFile, versionHash, (Callable<Void>) () -> {
DownloadUtils.ensureSha1(modpackFile, versionHash, (Callable<Void>) () -> {
DownloadUtils.downloadFileMonitored(versionUrl, modpackFile, downloadBuffer,
new DownloaderProgressWrapper(R.string.modpack_download_downloading_metadata,
ProgressLayout.INSTALL_MODPACK));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static void downloadFileMonitoredWithHeaders(String urlInput,File outputF
conn.disconnect();
}

public static <T> T downloadFileEnsureSha1(File outputFile, @Nullable String sha1, Callable<T> downloadFunction) throws IOException {
public static <T> T ensureSha1(File outputFile, @Nullable String sha1, Callable<T> downloadFunction) throws IOException {
// Skip if needed
if(sha1 == null){
try {
Expand Down

0 comments on commit 3a078e7

Please sign in to comment.