diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download')
2 files changed, 4 insertions, 12 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java index 5885e2e1..4401fb06 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/AutomaticFileDownload.java @@ -12,20 +12,12 @@ import de.thedevstack.conversationsplus.utils.XmppConnectionServiceAccessor; * */ public class AutomaticFileDownload implements HttpHeadRetrievedListener { - private boolean notify; - - public AutomaticFileDownload(boolean notify) { - this.notify = notify; - } @Override public void onFileSizeRetrieved(long size, Message message) { if (!this.transferFile(message)) { } - if (this.notify) { - XmppConnectionServiceAccessor.xmppConnectionService.getNotificationService().push(message); - } } /** diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/HttpRetrieveHead.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/HttpRetrieveHead.java index 1313bcca..62c1af59 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/HttpRetrieveHead.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/download/HttpRetrieveHead.java @@ -10,6 +10,7 @@ import de.thedevstack.conversationsplus.http.Http; import de.thedevstack.conversationsplus.http.HttpClient; import de.thedevstack.conversationsplus.http.HttpHeadRetrievedListener; import de.thedevstack.conversationsplus.persistance.DatabaseBackend; +import de.thedevstack.conversationsplus.utils.MessageParserUtil; import de.thedevstack.conversationsplus.utils.MessageUtil; import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import okhttp3.Call; @@ -36,12 +37,11 @@ public class HttpRetrieveHead implements Http, Callback { * If this code is reached and the URL is null something went wrong. * Try again to extract the file parameters from the message. */ - MessageUtil.extractFileParamsFromBody(message); + MessageParserUtil.extractFileParamsFromBody(message); this.url = (null != message.getFileParams()) ? message.getFileParams().getUrl() : null; if (null == this.url) { - message.setTreatAsDownloadable(Message.Decision.NEVER); // TODO find sth better if (null != message.getFileParams()) { - MessageUtil.setAndSaveFileStatus(message, FileStatus.UNDEFINED); + MessageUtil.setAndSaveFileStatus(message, FileStatus.NOT_FOUND); } } } @@ -89,7 +89,7 @@ public class HttpRetrieveHead implements Http, Callback { fileParams.setSize(size); fileParams.setMimeType(contentType); if (0 < size) { - fileParams.setFileStatus(FileStatus.NEEDS_DOWNLOAD); + MessageUtil.setFileStatus(message, FileStatus.NEEDS_DOWNLOAD); } DatabaseBackend.getInstance().updateMessage(message); UiUpdateHelper.updateConversationUi(); |