aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java b/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
index 0462defd..e7fbb5cd 100644
--- a/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
+++ b/src/main/java/de/thedevstack/conversationsplus/http/HttpDownloadConnection.java
@@ -3,13 +3,17 @@ package de.thedevstack.conversationsplus.http;
import android.content.Intent;
import android.net.Uri;
import android.os.PowerManager;
+import android.util.Log;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.net.MalformedURLException;
+import java.net.Proxy;
import java.net.URL;
import java.util.Arrays;
import java.util.concurrent.CancellationException;
@@ -88,7 +92,7 @@ public class HttpDownloadConnection implements Transferable {
this.message.setEncryption(Message.ENCRYPTION_NONE);
}
String extension;
- if (Arrays.asList(VALID_CRYPTO_EXTENSIONS).contains(lastPart)) {
+ if (VALID_CRYPTO_EXTENSIONS.contains(lastPart)) {
extension = secondToLast;
} else {
extension = lastPart;
@@ -115,6 +119,7 @@ public class HttpDownloadConnection implements Transferable {
new Thread(new FileSizeChecker(interactive)).start();
}
+ @Override
public void cancel() {
this.canceled = true;
mHttpConnectionManager.finishConnection(this);
@@ -176,7 +181,7 @@ public class HttpDownloadConnection implements Transferable {
HttpDownloadConnection.this.mXmppConnectionService.getNotificationService().push(message);
return;
} catch (IOException e) {
- Logging.d(Config.LOGTAG, "io exception in http file size checker: " + e.getMessage());
+ Log.d(Config.LOGTAG, "io exception in http file size checker: " + e.getMessage());
if (interactive) {
showToastForException(e);
}
@@ -184,7 +189,8 @@ public class HttpDownloadConnection implements Transferable {
return;
}
file.setExpectedSize(size);
- if (size != -1
+ if (mHttpConnectionManager.hasStoragePermission()
+ && size != -1
&& size <= ConversationsPlusPreferences.autoAcceptFileSize()
&& mXmppConnectionService.isDownloadAllowedInConnection()) {
HttpDownloadConnection.this.acceptedAutomatically = true;
@@ -221,6 +227,7 @@ public class HttpDownloadConnection implements Transferable {
return -1;
}
}
+
}
private class FileDownloader implements Runnable {
@@ -312,6 +319,7 @@ public class HttpDownloadConnection implements Transferable {
MessageUtil.updateFileParams(message, mUrl);
mXmppConnectionService.updateMessage(message);
}
+
}
public void updateProgress(int i) {