mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-29 05:04:54 +01:00
Basic support for prekeybundle message delivery and receipt.
This commit is contained in:
@@ -20,6 +20,7 @@ public class IncomingPushMessage implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
private int type;
|
||||
private String source;
|
||||
private List<String> destinations;
|
||||
private String messageText;
|
||||
@@ -27,8 +28,9 @@ public class IncomingPushMessage implements Parcelable {
|
||||
private long timestamp;
|
||||
|
||||
public IncomingPushMessage(String source, List<String> destinations, String messageText,
|
||||
List<PushAttachmentPointer> attachments, long timestamp)
|
||||
int type, List<PushAttachmentPointer> attachments, long timestamp)
|
||||
{
|
||||
this.type = type;
|
||||
this.source = source;
|
||||
this.destinations = destinations;
|
||||
this.messageText = messageText;
|
||||
@@ -84,4 +86,8 @@ public class IncomingPushMessage implements Parcelable {
|
||||
dest.writeList(attachments);
|
||||
dest.writeLong(timestamp);
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,29 +5,36 @@ import java.util.List;
|
||||
|
||||
public class OutgoingPushMessage {
|
||||
|
||||
public static final int TYPE_MESSAGE = 1;
|
||||
public static final int TYPE_PREKEYED_MESSAGE = 2;
|
||||
|
||||
private int type;
|
||||
private List<String> destinations;
|
||||
private String messageText;
|
||||
private List<PushAttachmentPointer> attachments;
|
||||
|
||||
public OutgoingPushMessage(String destination, String messageText) {
|
||||
public OutgoingPushMessage(String destination, String messageText, int type) {
|
||||
this.destinations = new LinkedList<String>();
|
||||
this.attachments = new LinkedList<PushAttachmentPointer>();
|
||||
this.messageText = messageText;
|
||||
this.destinations.add(destination);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public OutgoingPushMessage(List<String> destinations, String messageText) {
|
||||
public OutgoingPushMessage(List<String> destinations, String messageText, int type) {
|
||||
this.destinations = destinations;
|
||||
this.messageText = messageText;
|
||||
this.attachments = new LinkedList<PushAttachmentPointer>();
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public OutgoingPushMessage(List<String> destinations, String messageText,
|
||||
List<PushAttachmentPointer> attachments)
|
||||
List<PushAttachmentPointer> attachments, int type)
|
||||
{
|
||||
this.destinations = destinations;
|
||||
this.messageText = messageText;
|
||||
this.attachments = attachments;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getDestinations() {
|
||||
@@ -42,4 +49,7 @@ public class OutgoingPushMessage {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,26 +78,26 @@ public class PushServiceSocket {
|
||||
makeRequest(REGISTER_GCM_PATH, "DELETE", null);
|
||||
}
|
||||
|
||||
public void sendMessage(String recipient, String messageText)
|
||||
public void sendMessage(String recipient, String messageText, int type)
|
||||
throws IOException
|
||||
{
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipient, messageText);
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipient, messageText, type);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
public void sendMessage(List<String> recipients, String messageText)
|
||||
public void sendMessage(List<String> recipients, String messageText, int type)
|
||||
throws IOException
|
||||
{
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipients, messageText);
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipients, messageText, type);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
public void sendMessage(List<String> recipients, String messageText,
|
||||
List<PushAttachmentData> attachments)
|
||||
List<PushAttachmentData> attachments, int type)
|
||||
throws IOException
|
||||
{
|
||||
List<PushAttachmentPointer> attachmentIds = sendAttachments(attachments);
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipients, messageText, attachmentIds);
|
||||
OutgoingPushMessage message = new OutgoingPushMessage(recipients, messageText, attachmentIds, type);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user