diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-01-19 23:35:29 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-01-19 23:35:29 +0100 |
commit | 47ec6c5fdd2cbf28bac0433dfc5198f06d20747e (patch) | |
tree | 3bdf506d4af0ffa7ddc869d628c0ec8e52ca97e2 /src/main/java/de/pixart/messenger | |
parent | 26320c785a09c66329cb54b07f0dde791059efac (diff) |
rewrite isVideoMessage logic and add some more logging
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r-- | src/main/java/de/pixart/messenger/persistance/FileBackend.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AttachFileToConversationRunnable.java | 7 |
2 files changed, 7 insertions, 4 deletions
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() { |