1
0
Fork 1

Store voice messages in cache too when store in cache activated

This commit is contained in:
Arne 2024-11-25 17:25:12 +01:00
parent bfbaf3278a
commit dc33e904e5

View file

@ -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);