From bed2005e2eb17588a2f0fb8fd2595e123e151427 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 29 Oct 2023 23:05:28 +0800 Subject: [PATCH] fix: save to download --- .../src/main/java/org/telegram/messenger/MediaController.java | 2 +- TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 9bd3387b0..80021a01c 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -4150,7 +4150,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener, TLRPC.Document document = message.getDocument(); if (!TextUtils.isEmpty(FileLoader.getDocumentFileName(document)) && FileLoader.canSaveAsFile(message)) { String filename = FileLoader.getDocumentFileName(document); - File newDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_FILES); + File newDir = FileLoader.getDirectory(FileLoader.MEDIA_DIR_DOCUMENT); if (newDir != null) { path = new File(newDir, filename).getAbsolutePath(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index c9a6e323e..5d3385561 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -27963,7 +27963,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not messageObjects.add(selectedObject); } MediaController.saveFilesFromMessages(getParentActivity(), getAccountInstance(), messageObjects, (count) -> { - if (getParentActivity() == null || fragmentView == null) { + if (getParentActivity() == null) { return; } if (count > 0) { @@ -27989,7 +27989,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not path = getFileLoader().getPathToMessage(selectedObject.messageOwner).toString(); } MediaController.saveFile(path, getParentActivity(), 2, fileName, selectedObject.getDocument() != null ? selectedObject.getDocument().mime_type : "", uri -> { - if (getParentActivity() == null || fragmentView == null) { + if (getParentActivity() == null) { return; } final BulletinFactory.FileType fileType;