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 9bd3387b0f..80021a01c1 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 void start(Context context) { 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 c9a6e323e4..5d33855611 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 @@ private void processSelectedOption(int option) { 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 @@ private void processSelectedOption(int option) { 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;