Removed debug null check and made minor changes to match existing coding style

This commit is contained in:
david-harley 2020-12-22 15:36:35 +10:30
parent 5767853ef0
commit 7eb0487719
7 changed files with 8 additions and 15 deletions

View file

@ -23,7 +23,7 @@ class JsonDataMessage {
List<JsonAttachment> attachments; List<JsonAttachment> attachments;
JsonGroupInfo groupInfo; JsonGroupInfo groupInfo;
JsonDataMessage(SignalServiceDataMessage dataMessage, final Manager m) { JsonDataMessage(SignalServiceDataMessage dataMessage, Manager m) {
this.timestamp = dataMessage.getTimestamp(); this.timestamp = dataMessage.getTimestamp();
if (dataMessage.getGroupContext().isPresent()) { if (dataMessage.getGroupContext().isPresent()) {
if (dataMessage.getGroupContext().get().getGroupV1().isPresent()) { if (dataMessage.getGroupContext().get().getGroupV1().isPresent()) {
@ -39,17 +39,10 @@ class JsonDataMessage {
} }
this.expiresInSeconds = dataMessage.getExpiresInSeconds(); this.expiresInSeconds = dataMessage.getExpiresInSeconds();
if (dataMessage.getReaction().isPresent()) { if (dataMessage.getReaction().isPresent()) {
if(m == null){ this.reaction = new JsonReaction(dataMessage.getReaction().get(), m);
System.out.println("ERROR, MANAGER NOT SET");
}
else {
this.reaction = new JsonReaction(dataMessage.getReaction().get(), m);
}
} }
if (dataMessage.getQuote().isPresent()) { if (dataMessage.getQuote().isPresent()) {
this.quote = new JsonQuote(dataMessage.getQuote().get()); this.quote = new JsonQuote(dataMessage.getQuote().get());
} else {
this.quote = null;
} }
if (dataMessage.getMentions().isPresent()) { if (dataMessage.getMentions().isPresent()) {
this.mentions = new ArrayList<>(dataMessage.getMentions().get().size()); this.mentions = new ArrayList<>(dataMessage.getMentions().get().size());

View file

@ -9,7 +9,7 @@ public class JsonMention {
int start; int start;
int length; int length;
JsonMention(SignalServiceDataMessage.Mention mention){ JsonMention(SignalServiceDataMessage.Mention mention) {
this.uuid = mention.getUuid(); this.uuid = mention.getUuid();
this.start = mention.getStart(); this.start = mention.getStart();
this.length = mention.getLength(); this.length = mention.getLength();

View file

@ -20,7 +20,7 @@ public class JsonMessageEnvelope {
JsonReceiptMessage receiptMessage; JsonReceiptMessage receiptMessage;
public JsonMessageEnvelope( public JsonMessageEnvelope(
SignalServiceEnvelope envelope, SignalServiceContent content, final Manager m SignalServiceEnvelope envelope, SignalServiceContent content, Manager m
) { ) {
if (!envelope.isUnidentifiedSender() && envelope.hasSource()) { if (!envelope.isUnidentifiedSender() && envelope.hasSource()) {
SignalServiceAddress source = envelope.getSourceAddress(); SignalServiceAddress source = envelope.getSourceAddress();

View file

@ -13,7 +13,7 @@ public class JsonQuote {
String text; String text;
List<JsonAttachment> attachments; List<JsonAttachment> attachments;
JsonQuote(SignalServiceDataMessage.Quote quote){ JsonQuote(SignalServiceDataMessage.Quote quote) {
this.id = quote.getId(); this.id = quote.getId();
this.author = quote.getAuthor().getLegacyIdentifier(); this.author = quote.getAuthor().getLegacyIdentifier();
this.text = quote.getText(); this.text = quote.getText();

View file

@ -10,7 +10,7 @@ public class JsonReaction {
long targetSentTimestamp; long targetSentTimestamp;
boolean isRemove; boolean isRemove;
JsonReaction(Reaction reaction, final Manager m){ JsonReaction(Reaction reaction, Manager m) {
this.emoji = reaction.getEmoji(); this.emoji = reaction.getEmoji();
this.targetAuthor = m.resolveSignalServiceAddress(reaction.getTargetAuthor()).getLegacyIdentifier(); this.targetAuthor = m.resolveSignalServiceAddress(reaction.getTargetAuthor()).getLegacyIdentifier();
this.targetSentTimestamp = reaction.getTargetSentTimestamp(); this.targetSentTimestamp = reaction.getTargetSentTimestamp();

View file

@ -8,7 +8,7 @@ class JsonSyncDataMessage extends JsonDataMessage {
String destination; String destination;
JsonSyncDataMessage(SentTranscriptMessage transcriptMessage, final Manager m) { JsonSyncDataMessage(SentTranscriptMessage transcriptMessage, Manager m) {
super(transcriptMessage.getMessage(), m); super(transcriptMessage.getMessage(), m);
if (transcriptMessage.getDestination().isPresent()) { if (transcriptMessage.getDestination().isPresent()) {
this.destination = transcriptMessage.getDestination().get().getLegacyIdentifier(); this.destination = transcriptMessage.getDestination().get().getLegacyIdentifier();

View file

@ -22,7 +22,7 @@ class JsonSyncMessage {
List<ReadMessage> readMessages; List<ReadMessage> readMessages;
JsonSyncMessageType type; JsonSyncMessageType type;
JsonSyncMessage(SignalServiceSyncMessage syncMessage, final Manager m) { JsonSyncMessage(SignalServiceSyncMessage syncMessage, Manager m) {
if (syncMessage.getSent().isPresent()) { if (syncMessage.getSent().isPresent()) {
this.sentMessage = new JsonSyncDataMessage(syncMessage.getSent().get(), m); this.sentMessage = new JsonSyncDataMessage(syncMessage.getSent().get(), m);
} }