diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-05 22:01:37 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-05 22:01:37 +0100 |
commit | 0eaa0bf5c593f82fcdbae74f341d78c9f1721c93 (patch) | |
tree | f459b636dc2df9b5ed9ef148dd2cfcd34e99609b /src/main/java/de/pixart/messenger/services | |
parent | aebd53cd23616582bfee79ce498a03a5429445bf (diff) |
Do not compress GIFs, allow GBoard to send GIFs
Diffstat (limited to 'src/main/java/de/pixart/messenger/services')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index a15640462..5a76d3f88 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -112,6 +112,7 @@ import de.pixart.messenger.utils.CryptoHelper; import de.pixart.messenger.utils.ExceptionHelper; import de.pixart.messenger.utils.FileUtils; import de.pixart.messenger.utils.FileWriterException; +import de.pixart.messenger.utils.MimeUtils; import de.pixart.messenger.utils.OnPhoneContactsLoadedListener; import de.pixart.messenger.utils.PRNGFixes; import de.pixart.messenger.utils.PhoneHelper; @@ -146,7 +147,6 @@ import de.pixart.messenger.xmpp.stanzas.PresencePacket; import me.leolin.shortcutbadger.ShortcutBadger; import static de.pixart.messenger.persistance.FileBackend.close; -import static de.pixart.messenger.services.NotificationService.NOTIFICATION_ID; public class XmppConnectionService extends Service { @@ -513,9 +513,11 @@ public class XmppConnectionService extends Service { callback.error(R.string.security_error_invalid_file_access, null); return; } + final String mimeType = MimeUtils.guessMimeTypeFromUri(this, uri); final String compressPictures = getCompressPicturesPreference(); if ("never".equals(compressPictures) - || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri))) { + || ("auto".equals(compressPictures) && getFileBackend().useImageAsIs(uri)) + || (mimeType != null && mimeType.endsWith("/gif"))) { Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": not compressing picture. sending as file"); attachFileToConversation(conversation, uri, callback); return; |