mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 07:01:05 +01:00
Sync thread order and archive status with linked devices.
This commit is contained in:
committed by
Alan Evans
parent
848101a783
commit
fe5fca8eaf
@@ -20,14 +20,19 @@ public class DeviceContact {
|
||||
private final Optional<byte[]> profileKey;
|
||||
private final boolean blocked;
|
||||
private final Optional<Integer> expirationTimer;
|
||||
private final Optional<Integer> inboxPosition;
|
||||
private final boolean archived;
|
||||
|
||||
public DeviceContact(SignalServiceAddress address, Optional<String> name,
|
||||
public DeviceContact(SignalServiceAddress address,
|
||||
Optional<String> name,
|
||||
Optional<SignalServiceAttachmentStream> avatar,
|
||||
Optional<String> color,
|
||||
Optional<VerifiedMessage> verified,
|
||||
Optional<byte[]> profileKey,
|
||||
boolean blocked,
|
||||
Optional<Integer> expirationTimer)
|
||||
Optional<Integer> expirationTimer,
|
||||
Optional<Integer> inboxPosition,
|
||||
boolean archived)
|
||||
{
|
||||
this.address = address;
|
||||
this.name = name;
|
||||
@@ -37,6 +42,8 @@ public class DeviceContact {
|
||||
this.profileKey = profileKey;
|
||||
this.blocked = blocked;
|
||||
this.expirationTimer = expirationTimer;
|
||||
this.inboxPosition = inboxPosition;
|
||||
this.archived = archived;
|
||||
}
|
||||
|
||||
public Optional<SignalServiceAttachmentStream> getAvatar() {
|
||||
@@ -70,4 +77,12 @@ public class DeviceContact {
|
||||
public Optional<Integer> getExpirationTimer() {
|
||||
return expirationTimer;
|
||||
}
|
||||
|
||||
public Optional<Integer> getInboxPosition() {
|
||||
return inboxPosition;
|
||||
}
|
||||
|
||||
public boolean isArchived() {
|
||||
return archived;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,14 +39,16 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
|
||||
throw new IOException("Missing contact address!");
|
||||
}
|
||||
|
||||
SignalServiceAddress address = new SignalServiceAddress(UuidUtil.parseOrNull(details.getUuid()), details.getNumber());
|
||||
Optional<String> name = Optional.fromNullable(details.getName());
|
||||
Optional<SignalServiceAttachmentStream> avatar = Optional.absent();
|
||||
Optional<String> color = details.hasColor() ? Optional.of(details.getColor()) : Optional.<String>absent();
|
||||
Optional<VerifiedMessage> verified = Optional.absent();
|
||||
Optional<byte[]> profileKey = Optional.absent();
|
||||
boolean blocked = false;
|
||||
Optional<Integer> expireTimer = Optional.absent();
|
||||
SignalServiceAddress address = new SignalServiceAddress(UuidUtil.parseOrNull(details.getUuid()), details.getNumber());
|
||||
Optional<String> name = Optional.fromNullable(details.getName());
|
||||
Optional<SignalServiceAttachmentStream> avatar = Optional.absent();
|
||||
Optional<String> color = details.hasColor() ? Optional.of(details.getColor()) : Optional.<String>absent();
|
||||
Optional<VerifiedMessage> verified = Optional.absent();
|
||||
Optional<byte[]> profileKey = Optional.absent();
|
||||
boolean blocked = false;
|
||||
Optional<Integer> expireTimer = Optional.absent();
|
||||
Optional<Integer> inboxPosition = Optional.absent();
|
||||
boolean archived = false;
|
||||
|
||||
if (details.hasAvatar()) {
|
||||
long avatarLength = details.getAvatar().getLength();
|
||||
@@ -89,9 +91,14 @@ public class DeviceContactsInputStream extends ChunkedInputStream {
|
||||
expireTimer = Optional.of(details.getExpireTimer());
|
||||
}
|
||||
|
||||
blocked = details.getBlocked();
|
||||
if (details.hasInboxPosition()) {
|
||||
inboxPosition = Optional.of(details.getInboxPosition());
|
||||
}
|
||||
|
||||
return new DeviceContact(address, name, avatar, color, verified, profileKey, blocked, expireTimer);
|
||||
blocked = details.getBlocked();
|
||||
archived = details.getArchived();
|
||||
|
||||
return new DeviceContact(address, name, avatar, color, verified, profileKey, blocked, expireTimer, inboxPosition, archived);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,7 +92,12 @@ public class DeviceContactsOutputStream extends ChunkedOutputStream {
|
||||
contactDetails.setExpireTimer(contact.getExpirationTimer().get());
|
||||
}
|
||||
|
||||
if (contact.getInboxPosition().isPresent()) {
|
||||
contactDetails.setInboxPosition(contact.getInboxPosition().get());
|
||||
}
|
||||
|
||||
contactDetails.setBlocked(contact.isBlocked());
|
||||
contactDetails.setArchived(contact.isArchived());
|
||||
|
||||
byte[] serializedContactDetails = contactDetails.build().toByteArray();
|
||||
|
||||
|
||||
@@ -22,11 +22,19 @@ public class DeviceGroup {
|
||||
private final Optional<Integer> expirationTimer;
|
||||
private final Optional<String> color;
|
||||
private final boolean blocked;
|
||||
private final Optional<Integer> inboxPosition;
|
||||
private final boolean archived;
|
||||
|
||||
public DeviceGroup(byte[] id, Optional<String> name, List<SignalServiceAddress> members,
|
||||
public DeviceGroup(byte[] id,
|
||||
Optional<String> name,
|
||||
List<SignalServiceAddress> members,
|
||||
Optional<SignalServiceAttachmentStream> avatar,
|
||||
boolean active, Optional<Integer> expirationTimer,
|
||||
Optional<String> color, boolean blocked)
|
||||
boolean active,
|
||||
Optional<Integer> expirationTimer,
|
||||
Optional<String> color,
|
||||
boolean blocked,
|
||||
Optional<Integer> inboxPosition,
|
||||
boolean archived)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@@ -36,6 +44,8 @@ public class DeviceGroup {
|
||||
this.expirationTimer = expirationTimer;
|
||||
this.color = color;
|
||||
this.blocked = blocked;
|
||||
this.inboxPosition = inboxPosition;
|
||||
this.archived = archived;
|
||||
}
|
||||
|
||||
public Optional<SignalServiceAttachmentStream> getAvatar() {
|
||||
@@ -69,4 +79,12 @@ public class DeviceGroup {
|
||||
public boolean isBlocked() {
|
||||
return blocked;
|
||||
}
|
||||
|
||||
public Optional<Integer> getInboxPosition() {
|
||||
return inboxPosition;
|
||||
}
|
||||
|
||||
public boolean isArchived() {
|
||||
return archived;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ public class DeviceGroupsInputStream extends ChunkedInputStream{
|
||||
Optional<Integer> expirationTimer = Optional.absent();
|
||||
Optional<String> color = Optional.fromNullable(details.getColor());
|
||||
boolean blocked = details.getBlocked();
|
||||
Optional<Integer> inboxPosition = Optional.absent();
|
||||
boolean archived = false;
|
||||
|
||||
if (details.hasAvatar()) {
|
||||
long avatarLength = details.getAvatar().getLength();
|
||||
@@ -66,7 +68,15 @@ public class DeviceGroupsInputStream extends ChunkedInputStream{
|
||||
}
|
||||
}
|
||||
|
||||
return new DeviceGroup(id, name, addressMembers, avatar, active, expirationTimer, color, blocked);
|
||||
if (details.hasInboxPosition()) {
|
||||
inboxPosition = Optional.of(details.getInboxPosition());
|
||||
}
|
||||
|
||||
if (details.hasArchived()) {
|
||||
archived = details.getArchived();
|
||||
}
|
||||
|
||||
return new DeviceGroup(id, name, addressMembers, avatar, active, expirationTimer, color, blocked, inboxPosition, archived);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -83,6 +83,11 @@ public class DeviceGroupsOutputStream extends ChunkedOutputStream {
|
||||
groupDetails.addAllMembersE164(membersE164);
|
||||
groupDetails.setActive(group.isActive());
|
||||
groupDetails.setBlocked(group.isBlocked());
|
||||
groupDetails.setArchived(group.isArchived());
|
||||
|
||||
if (group.getInboxPosition().isPresent()) {
|
||||
groupDetails.setInboxPosition(group.getInboxPosition().get());
|
||||
}
|
||||
|
||||
byte[] serializedContactDetails = groupDetails.build().toByteArray();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user