[android] Create attachments before showing previews

This commit is contained in:
Torsten Grote
2019-02-15 09:13:36 -02:00
parent 249e1e28fe
commit 55f4600a69
19 changed files with 291 additions and 112 deletions

View File

@@ -25,4 +25,15 @@ public class AttachmentHeader {
return contentType;
}
@Override
public boolean equals(Object o) {
return o instanceof AttachmentHeader &&
messageId.equals(((AttachmentHeader) o).messageId);
}
@Override
public int hashCode() {
return messageId.hashCode();
}
}

View File

@@ -8,4 +8,19 @@ public interface MessagingConstants {
* The maximum length of a private message's text in UTF-8 bytes.
*/
int MAX_PRIVATE_MESSAGE_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
/**
* The supported mime types for image attachments.
*/
String[] IMAGE_MIME_TYPES = {
"image/jpeg",
"image/png",
"image/gif",
};
/**
* The maximum allowed size of image attachments.
*/
int MAX_IMAGE_SIZE = 6 * 1024 * 1024;
}

View File

@@ -41,6 +41,11 @@ public interface MessagingManager extends ConversationClient {
AttachmentHeader addLocalAttachment(GroupId groupId, long timestamp,
String contentType, InputStream is) throws DbException, IOException;
/**
* Removes an unsent attachment.
*/
void removeAttachment(AttachmentHeader header) throws DbException;
/**
* Returns the ID of the contact with the given private conversation.
*/