mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
added sync type to sync messages json
This commit is contained in:
parent
faae998a7e
commit
717120aed1
1 changed files with 25 additions and 10 deletions
|
@ -5,21 +5,36 @@ import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSy
|
|||
|
||||
import java.util.List;
|
||||
|
||||
enum JsonSyncMessageType {
|
||||
CONTACTS_SYNC,
|
||||
GROUPS_SYNC,
|
||||
REQUEST_SYNC
|
||||
}
|
||||
|
||||
class JsonSyncMessage {
|
||||
|
||||
JsonSyncDataMessage sentMessage;
|
||||
List<String> blockedNumbers;
|
||||
List<ReadMessage> readMessages;
|
||||
JsonSyncMessageType type;
|
||||
|
||||
JsonSyncMessage(SignalServiceSyncMessage syncMessage) {
|
||||
if (syncMessage.getSent().isPresent()) {
|
||||
this.sentMessage = new JsonSyncDataMessage(syncMessage.getSent().get());
|
||||
}
|
||||
if (syncMessage.getBlockedList().isPresent()) {
|
||||
this.blockedNumbers = syncMessage.getBlockedList().get().getNumbers();
|
||||
}
|
||||
if (syncMessage.getRead().isPresent()) {
|
||||
this.readMessages = syncMessage.getRead().get();
|
||||
}
|
||||
}
|
||||
if (syncMessage.getSent().isPresent()) {
|
||||
this.sentMessage = new JsonSyncDataMessage(syncMessage.getSent().get());
|
||||
}
|
||||
if (syncMessage.getBlockedList().isPresent()) {
|
||||
this.blockedNumbers = syncMessage.getBlockedList().get().getNumbers();
|
||||
}
|
||||
if (syncMessage.getRead().isPresent()) {
|
||||
this.readMessages = syncMessage.getRead().get();
|
||||
}
|
||||
|
||||
if (syncMessage.getContacts().isPresent()) {
|
||||
this.type = JsonSyncMessageType.CONTACTS_SYNC;
|
||||
} else if (syncMessage.getGroups().isPresent()) {
|
||||
this.type = JsonSyncMessageType.GROUPS_SYNC;
|
||||
} else if (syncMessage.getRequest().isPresent()) {
|
||||
this.type = JsonSyncMessageType.REQUEST_SYNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue