From 39f248e0a6b49b4ad4486ac7b4934f7a471367f8 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 11 Jan 2023 17:07:47 +0100 Subject: [PATCH] Fix videos cannot be downloaded --- .../fedilab/android/helper/MediaHelper.java | 18 +----------------- .../metadata/android/en/changelogs/463.txt | 10 ++++++++++ 2 files changed, 11 insertions(+), 17 deletions(-) create mode 100644 src/fdroid/fastlane/metadata/android/en/changelogs/463.txt diff --git a/app/src/main/java/app/fedilab/android/helper/MediaHelper.java b/app/src/main/java/app/fedilab/android/helper/MediaHelper.java index 770436b5f..b6f65f7c7 100644 --- a/app/src/main/java/app/fedilab/android/helper/MediaHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/MediaHelper.java @@ -94,30 +94,14 @@ public class MediaHelper { try { request = new DownloadManager.Request(Uri.parse(url.trim())); } catch (Exception e) { + e.printStackTrace(); Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); return -1; } try { String mime = getMimeType(url); - final String fileName = URLUtil.guessFileName(url, null, null); request.allowScanningByMediaScanner(); - String myDir; - if (mime.toLowerCase().startsWith("video")) { - myDir = Environment.DIRECTORY_MOVIES + "/" + context.getString(R.string.app_name); - } else if (mime.toLowerCase().startsWith("audio")) { - myDir = Environment.DIRECTORY_MUSIC + "/" + context.getString(R.string.app_name); - } else { - myDir = Environment.DIRECTORY_DOWNLOADS; - } - - if (!new File(myDir).exists()) { - boolean created = new File(myDir).mkdir(); - if (!created) { - Toasty.error(context, context.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); - return -1; - } - } if (mime.toLowerCase().startsWith("video")) { request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, context.getString(R.string.app_name) + "/" + fileName); } else if (mime.toLowerCase().startsWith("audio")) { diff --git a/src/fdroid/fastlane/metadata/android/en/changelogs/463.txt b/src/fdroid/fastlane/metadata/android/en/changelogs/463.txt new file mode 100644 index 000000000..7bdeead2a --- /dev/null +++ b/src/fdroid/fastlane/metadata/android/en/changelogs/463.txt @@ -0,0 +1,10 @@ +Added: +- Search bar display suggestions + +Changed: +- Preload media in timelines + +Fixed: +- Fix fetch more jumps +- Fix videos cannot be saved +- Fix crashes \ No newline at end of file