Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Support for group color sync
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie-signal committed Jun 27, 2018
1 parent c18963a commit 90cbb42
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ public class DeviceGroup {
private final Optional<SignalServiceAttachmentStream> avatar;
private final boolean active;
private final Optional<Integer> expirationTimer;
private final Optional<String> color;

public DeviceGroup(byte[] id, Optional<String> name, List<String> members,
Optional<SignalServiceAttachmentStream> avatar,
boolean active, Optional<Integer> expirationTimer)
boolean active, Optional<Integer> expirationTimer,
Optional<String> color)
{
this.id = id;
this.name = name;
this.members = members;
this.avatar = avatar;
this.active = active;
this.expirationTimer = expirationTimer;
this.color = color;
}

public Optional<SignalServiceAttachmentStream> getAvatar() {
Expand All @@ -55,4 +58,8 @@ public boolean isActive() {
public Optional<Integer> getExpirationTimer() {
return expirationTimer;
}

public Optional<String> getColor() {
return color;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public DeviceGroup read() throws IOException {
Optional<SignalServiceAttachmentStream> avatar = Optional.absent();
boolean active = details.getActive();
Optional<Integer> expirationTimer = Optional.absent();
Optional<String> color = Optional.fromNullable(details.getColor());

if (details.hasAvatar()) {
long avatarLength = details.getAvatar().getLength();
Expand All @@ -51,7 +52,7 @@ public DeviceGroup read() throws IOException {
expirationTimer = Optional.of(details.getExpireTimer());
}

return new DeviceGroup(id, name, members, avatar, active, expirationTimer);
return new DeviceGroup(id, name, members, avatar, active, expirationTimer, color);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ private void writeGroupDetails(DeviceGroup group) throws IOException {
groupDetails.setExpireTimer(group.getExpirationTimer().get());
}

if (group.getColor().isPresent()) {
groupDetails.setColor(group.getColor().get());
}

groupDetails.addAllMembers(group.getMembers());
groupDetails.setActive(group.isActive());

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions protobuf/SignalService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,5 @@ message GroupDetails {
optional Avatar avatar = 4;
optional bool active = 5 [default = true];
optional uint32 expireTimer = 6;
optional string color = 7;
}

0 comments on commit 90cbb42

Please sign in to comment.