From 0a9bba28616e594279cd659ec2eb57da2074b3cd Mon Sep 17 00:00:00 2001 From: steckbrief Date: Wed, 11 Jan 2017 14:55:53 +0100 Subject: Improved error handling for filetransfer:http:delete, Check for httpupload feature available extended to include filetransfer:http as well, method to check if http upload is available moved from data class 'Account' to 'AccountUtil' --- .../services/filetransfer/http/delete/DeleteTokenReceived.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java index 186454e4..83a250de 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/filetransfer/http/delete/DeleteTokenReceived.java @@ -1,16 +1,21 @@ package de.thedevstack.conversationsplus.services.filetransfer.http.delete; +import android.widget.Toast; + import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; import de.thedevstack.android.logcat.Logging; +import de.thedevstack.conversationsplus.R; import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.enums.FileStatus; import de.thedevstack.conversationsplus.http.HttpClient; import de.thedevstack.conversationsplus.utils.MessageUtil; +import de.thedevstack.conversationsplus.utils.ui.ConversationsPlusToast; import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; +import de.thedevstack.conversationsplus.xmpp.exceptions.ServiceUnavailableException; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; import de.thedevstack.conversationsplus.xmpp.filetransfer.http.delete.DeleteSlotPacketParser; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; @@ -81,6 +86,11 @@ public class DeleteTokenReceived implements OnIqPacketReceived { } catch (XmppException e) { Logging.e("filetransfer.http.delete", "Error while trying to get the delete token: " + e.getMessage()); + int messageResId = R.string.cplus_remote_file_delete_failed; + if (e instanceof ServiceUnavailableException) { + messageResId = R.string.cplus_remote_file_delete_service_unavailable; + } + ConversationsPlusToast.makeErrorToast(messageResId, Toast.LENGTH_LONG); MessageUtil.setAndSaveFileStatus(remoteFile.getMessage(), FileStatus.DELETE_FAILED); } } -- cgit v1.2.3