proper error state for images
This commit is contained in:
parent
64209829f7
commit
03593ba56f
|
@ -281,5 +281,6 @@
|
||||||
<string name="message_text">Message text</string>
|
<string name="message_text">Message text</string>
|
||||||
<string name="url_copied_to_clipboard">URL copied to clipboard</string>
|
<string name="url_copied_to_clipboard">URL copied to clipboard</string>
|
||||||
<string name="message_copied_to_clipboard">Message copied to clipboard</string>
|
<string name="message_copied_to_clipboard">Message copied to clipboard</string>
|
||||||
|
<string name="image_transmission_failed">Image transmission failed</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -16,7 +16,6 @@ public class Message extends AbstractEntity {
|
||||||
public static final int STATUS_UNSEND = 1;
|
public static final int STATUS_UNSEND = 1;
|
||||||
public static final int STATUS_SEND = 2;
|
public static final int STATUS_SEND = 2;
|
||||||
public static final int STATUS_SEND_FAILED = 3;
|
public static final int STATUS_SEND_FAILED = 3;
|
||||||
public static final int STATUS_SEND_REJECTED = 4;
|
|
||||||
public static final int STATUS_WAITING = 5;
|
public static final int STATUS_WAITING = 5;
|
||||||
public static final int STATUS_OFFERED = 6;
|
public static final int STATUS_OFFERED = 6;
|
||||||
public static final int STATUS_SEND_RECEIVED = 7;
|
public static final int STATUS_SEND_RECEIVED = 7;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import eu.siacs.conversations.crypto.PgpEngine;
|
||||||
import eu.siacs.conversations.entities.Account;
|
import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Downloadable;
|
|
||||||
import eu.siacs.conversations.entities.Message;
|
import eu.siacs.conversations.entities.Message;
|
||||||
import eu.siacs.conversations.entities.MucOptions;
|
import eu.siacs.conversations.entities.MucOptions;
|
||||||
import eu.siacs.conversations.entities.Presences;
|
import eu.siacs.conversations.entities.Presences;
|
||||||
|
|
|
@ -100,6 +100,9 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
if (params.size != 0) {
|
if (params.size != 0) {
|
||||||
filesize = params.size / 1024 + " KB";
|
filesize = params.size / 1024 + " KB";
|
||||||
}
|
}
|
||||||
|
if (message.getDownloadable() != null && message.getDownloadable().getStatus() == Downloadable.STATUS_FAILED) {
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch (message.getMergedStatus()) {
|
switch (message.getMergedStatus()) {
|
||||||
case Message.STATUS_WAITING:
|
case Message.STATUS_WAITING:
|
||||||
|
@ -125,10 +128,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
info = getContext().getString(R.string.send_failed);
|
info = getContext().getString(R.string.send_failed);
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
case Message.STATUS_SEND_REJECTED:
|
|
||||||
info = getContext().getString(R.string.send_rejected);
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (multiReceived) {
|
if (multiReceived) {
|
||||||
Contact contact = message.getContact();
|
Contact contact = message.getContact();
|
||||||
|
@ -484,6 +483,8 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
&& d.getStatus() == Downloadable.STATUS_OFFER_CHECK_FILESIZE) {
|
&& d.getStatus() == Downloadable.STATUS_OFFER_CHECK_FILESIZE) {
|
||||||
displayDownloadableMessage(viewHolder, item,
|
displayDownloadableMessage(viewHolder, item,
|
||||||
R.string.check_image_filesize);
|
R.string.check_image_filesize);
|
||||||
|
} else if (d != null && d.getStatus() == Downloadable.STATUS_FAILED) {
|
||||||
|
displayInfoMessage(viewHolder, R.string.image_transmission_failed);
|
||||||
} else if ((item.getEncryption() == Message.ENCRYPTION_DECRYPTED)
|
} else if ((item.getEncryption() == Message.ENCRYPTION_DECRYPTED)
|
||||||
|| (item.getEncryption() == Message.ENCRYPTION_NONE)
|
|| (item.getEncryption() == Message.ENCRYPTION_NONE)
|
||||||
|| (item.getEncryption() == Message.ENCRYPTION_OTR)) {
|
|| (item.getEncryption() == Message.ENCRYPTION_OTR)) {
|
||||||
|
|
|
@ -73,11 +73,7 @@ public class JingleConnection implements Downloadable {
|
||||||
@Override
|
@Override
|
||||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||||
if (packet.getType() == IqPacket.TYPE_ERROR) {
|
if (packet.getType() == IqPacket.TYPE_ERROR) {
|
||||||
if (initiator.equals(account.getFullJid())) {
|
cancel();
|
||||||
mXmppConnectionService.markMessage(message,
|
|
||||||
Message.STATUS_SEND_FAILED);
|
|
||||||
}
|
|
||||||
mJingleStatus = JINGLE_STATUS_FAILED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -354,6 +350,7 @@ public class JingleConnection implements Downloadable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInitRequest() {
|
private void sendInitRequest() {
|
||||||
|
this.mXmppConnectionService.markMessage(this.message, Message.STATUS_OFFERED);
|
||||||
JinglePacket packet = this.bootstrapPacket("session-initiate");
|
JinglePacket packet = this.bootstrapPacket("session-initiate");
|
||||||
Content content = new Content(this.contentCreator, this.contentName);
|
Content content = new Content(this.contentCreator, this.contentName);
|
||||||
if (message.getType() == Message.TYPE_IMAGE) {
|
if (message.getType() == Message.TYPE_IMAGE) {
|
||||||
|
@ -716,13 +713,8 @@ public class JingleConnection implements Downloadable {
|
||||||
this.mStatus = Downloadable.STATUS_FAILED;
|
this.mStatus = Downloadable.STATUS_FAILED;
|
||||||
this.mXmppConnectionService.updateConversationUi();
|
this.mXmppConnectionService.updateConversationUi();
|
||||||
} else {
|
} else {
|
||||||
if (this.mJingleStatus == JINGLE_STATUS_INITIATED) {
|
this.mXmppConnectionService.markMessage(this.message,
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
Message.STATUS_SEND_FAILED);
|
||||||
Message.STATUS_SEND_REJECTED);
|
|
||||||
} else {
|
|
||||||
this.mXmppConnectionService.markMessage(this.message,
|
|
||||||
Message.STATUS_SEND_FAILED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mJingleConnectionManager.finishConnection(this);
|
this.mJingleConnectionManager.finishConnection(this);
|
||||||
|
|
|
@ -44,8 +44,13 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
account.getXmppConnection().sendIqPacket(
|
IqPacket response = packet.generateRespone(IqPacket.TYPE_ERROR);
|
||||||
packet.generateRespone(IqPacket.TYPE_ERROR), null);
|
Element error = response.addChild("error");
|
||||||
|
error.setAttribute("type", "cancel");
|
||||||
|
error.addChild("item-not-found",
|
||||||
|
"urn:ietf:params:xml:ns:xmpp-stanzas");
|
||||||
|
error.addChild("unknown-session", "urn:xmpp:jingle:errors:1");
|
||||||
|
account.getXmppConnection().sendIqPacket(response, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue