mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 19:10:38 +00:00
Remove dead code and fix inspection issues
This commit is contained in:
parent
6ffeb7c431
commit
e83f43065e
13 changed files with 10 additions and 82 deletions
|
@ -10,8 +10,4 @@ record JsonAttachment(String contentType, String filename, String id, Long size)
|
|||
final var size = attachment.size().orElse(null);
|
||||
return new JsonAttachment(attachment.contentType(), filename, id, size);
|
||||
}
|
||||
|
||||
static JsonAttachment from(String filename) {
|
||||
return new JsonAttachment(filename, null, null, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.asamk.signal.json;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import org.asamk.Signal;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -65,38 +64,4 @@ record JsonDataMessage(
|
|||
contacts,
|
||||
groupInfo);
|
||||
}
|
||||
|
||||
static JsonDataMessage from(Signal.MessageReceived messageReceived) {
|
||||
return new JsonDataMessage(messageReceived.getTimestamp(),
|
||||
messageReceived.getMessage(),
|
||||
// TODO Replace these with the proper commands
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getGroupId().length > 0 ? JsonGroupInfo.from(messageReceived.getGroupId()) : null);
|
||||
}
|
||||
|
||||
static JsonDataMessage from(Signal.SyncMessageReceived messageReceived) {
|
||||
return new JsonDataMessage(messageReceived.getTimestamp(),
|
||||
messageReceived.getMessage(),
|
||||
// TODO Replace these with the proper commands
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getGroupId().length > 0 ? JsonGroupInfo.from(messageReceived.getGroupId()) : null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,10 @@ package org.asamk.signal.json;
|
|||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
record JsonGroupInfo(String groupId, String type) {
|
||||
|
||||
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext) {
|
||||
return new JsonGroupInfo(groupContext.groupId().toBase64(),
|
||||
groupContext.isGroupUpdate() ? "UPDATE" : "DELIVER");
|
||||
}
|
||||
|
||||
static JsonGroupInfo from(byte[] groupId) {
|
||||
return new JsonGroupInfo(Base64.getEncoder().encodeToString(groupId), "DELIVER");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue