1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-08 07:57:28 +00:00

Fix checkDownloaded to check for both with and without username

This commit is contained in:
junhuicoding 2021-04-03 04:05:00 +08:00
parent f0167f2d93
commit f9816ec335

View File

@ -212,14 +212,13 @@ public final class DownloadUtils {
username = user.getUsername();
}
final File downloadDir = getDownloadDir(null, "@" + username, true);
final String usernamePrepend = Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME)
&& user != null ? username : "";
switch (media.getMediaType()) {
case MEDIA_TYPE_IMAGE:
case MEDIA_TYPE_VIDEO: {
final String url = ResponseBodyUtils.getImageUrl(media);
final File file = getDownloadSaveFile(downloadDir, media.getCode(), url, usernamePrepend);
checkList.add(file.exists());
final File file = getDownloadSaveFile(downloadDir, media.getCode(), url, "");
final File usernamePrependedFile = getDownloadSaveFile(downloadDir, media.getCode(), url, username);
checkList.add(file.exists() || usernamePrependedFile.exists());
break;
}
case MEDIA_TYPE_SLIDER:
@ -228,8 +227,9 @@ public final class DownloadUtils {
final Media child = sliderItems.get(i);
if (child == null) continue;
final String url = ResponseBodyUtils.getImageUrl(child);
final File file = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, usernamePrepend);
checkList.add(file.exists());
final File file = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, "");
final File usernamePrependedFile = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, username);
checkList.add(file.exists() || usernamePrependedFile.exists());
}
break;
default: