From 47ec6c5fdd2cbf28bac0433dfc5198f06d20747e Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 19 Jan 2018 23:35:29 +0100 Subject: rewrite isVideoMessage logic and add some more logging --- src/main/java/de/pixart/messenger/persistance/FileBackend.java | 4 +++- .../messenger/services/AttachFileToConversationRunnable.java | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/de/pixart/messenger') diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index b71c10cf5..21fa21b46 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -286,12 +286,14 @@ public class FileBackend { public boolean useFileAsIs(Uri uri) { String path = getOriginalPath(uri); if (path == null) { + Log.d(Config.LOGTAG, "File path = null"); return false; } if (path.contains(getDirectoryName("null", true))) { - Log.d(Config.LOGTAG, "File " + path + " is in our directory, sending as is"); + Log.d(Config.LOGTAG, "File " + path + " is in our directory"); return true; } + Log.d(Config.LOGTAG, "File " + path + " is not in our directory"); return false; } diff --git a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java index 3f15fb883..4ad16838c 100644 --- a/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java +++ b/src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java @@ -44,10 +44,11 @@ public class AttachFileToConversationRunnable implements Runnable, MediaTranscod final String mimeType = MimeUtils.guessMimeTypeFromUri(mXmppConnectionService, uri); final int autoAcceptFileSize = Config.FILE_SIZE; this.originalFileSize = FileBackend.getFileSize(mXmppConnectionService, uri); - this.isVideoMessage = (mimeType != null && mimeType.startsWith("video/") + this.isVideoMessage = !getFileBackend().useFileAsIs(uri) + && (mimeType != null && mimeType.startsWith("video/") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) - && originalFileSize > autoAcceptFileSize - && !getFileBackend().useFileAsIs(uri); + && originalFileSize > autoAcceptFileSize; + } public boolean isVideoMessage() { -- cgit v1.2.3