From dc33e904e5b0422d4f7421d49dcf887999b8ce6e Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 25 Nov 2024 17:25:12 +0100 Subject: [PATCH] Store voice messages in cache too when store in cache activated --- .../conversations/ui/ConversationFragment.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index b4295140d..d79030bb6 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -5469,12 +5469,16 @@ public class ConversationFragment extends XmppFragment final String filename = String.format("RECORDING_%s.%s", dateFormat.format(new Date()), extension); final File parentDirectory; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { - parentDirectory = - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RECORDINGS); + if (conversation.storeInCache()) { + parentDirectory = new File(activity.xmppConnectionService.getCacheDir(), "/media"); } else { - parentDirectory = - Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + parentDirectory = + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RECORDINGS); + } else { + parentDirectory = + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + } } final File conversationsDirectory = new File(parentDirectory, getString(R.string.app_name)); return new File(conversationsDirectory, filename);