diff --git a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroup.java b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroup.java index 94f32a56c0..e97267d187 100644 --- a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroup.java +++ b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroup.java @@ -19,10 +19,12 @@ public class DeviceGroup { private final Optional avatar; private final boolean active; private final Optional expirationTimer; + private final Optional color; public DeviceGroup(byte[] id, Optional name, List members, Optional avatar, - boolean active, Optional expirationTimer) + boolean active, Optional expirationTimer, + Optional color) { this.id = id; this.name = name; @@ -30,6 +32,7 @@ public DeviceGroup(byte[] id, Optional name, List members, this.avatar = avatar; this.active = active; this.expirationTimer = expirationTimer; + this.color = color; } public Optional getAvatar() { @@ -55,4 +58,8 @@ public boolean isActive() { public Optional getExpirationTimer() { return expirationTimer; } + + public Optional getColor() { + return color; + } } diff --git a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsInputStream.java b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsInputStream.java index 0fcac4370c..6474251834 100644 --- a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsInputStream.java +++ b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsInputStream.java @@ -38,6 +38,7 @@ public DeviceGroup read() throws IOException { Optional avatar = Optional.absent(); boolean active = details.getActive(); Optional expirationTimer = Optional.absent(); + Optional color = Optional.fromNullable(details.getColor()); if (details.hasAvatar()) { long avatarLength = details.getAvatar().getLength(); @@ -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); } } diff --git a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsOutputStream.java b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsOutputStream.java index c2b860fce7..b23de615bd 100644 --- a/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsOutputStream.java +++ b/java/src/main/java/org/whispersystems/signalservice/api/messages/multidevice/DeviceGroupsOutputStream.java @@ -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()); diff --git a/java/src/main/java/org/whispersystems/signalservice/internal/push/SignalServiceProtos.java b/java/src/main/java/org/whispersystems/signalservice/internal/push/SignalServiceProtos.java index 8142d56383..9347f46853 100644 --- a/java/src/main/java/org/whispersystems/signalservice/internal/push/SignalServiceProtos.java +++ b/java/src/main/java/org/whispersystems/signalservice/internal/push/SignalServiceProtos.java @@ -30058,6 +30058,21 @@ public interface GroupDetailsOrBuilder * optional uint32 expireTimer = 6; */ int getExpireTimer(); + + // optional string color = 7; + /** + * optional string color = 7; + */ + boolean hasColor(); + /** + * optional string color = 7; + */ + java.lang.String getColor(); + /** + * optional string color = 7; + */ + com.google.protobuf.ByteString + getColorBytes(); } /** * Protobuf type {@code signalservice.GroupDetails} @@ -30151,6 +30166,11 @@ private GroupDetails( expireTimer_ = input.readUInt32(); break; } + case 58: { + bitField0_ |= 0x00000020; + color_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -30889,6 +30909,49 @@ public int getExpireTimer() { return expireTimer_; } + // optional string color = 7; + public static final int COLOR_FIELD_NUMBER = 7; + private java.lang.Object color_; + /** + * optional string color = 7; + */ + public boolean hasColor() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + /** + * optional string color = 7; + */ + public java.lang.String getColor() { + java.lang.Object ref = color_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + color_ = s; + } + return s; + } + } + /** + * optional string color = 7; + */ + public com.google.protobuf.ByteString + getColorBytes() { + java.lang.Object ref = color_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + color_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { id_ = com.google.protobuf.ByteString.EMPTY; name_ = ""; @@ -30896,6 +30959,7 @@ private void initFields() { avatar_ = org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupDetails.Avatar.getDefaultInstance(); active_ = true; expireTimer_ = 0; + color_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -30927,6 +30991,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeUInt32(6, expireTimer_); } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeBytes(7, getColorBytes()); + } getUnknownFields().writeTo(output); } @@ -30965,6 +31032,10 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(6, expireTimer_); } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(7, getColorBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -31098,6 +31169,8 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00000010); expireTimer_ = 0; bitField0_ = (bitField0_ & ~0x00000020); + color_ = ""; + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -31156,6 +31229,10 @@ public org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupD to_bitField0_ |= 0x00000010; } result.expireTimer_ = expireTimer_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000020; + } + result.color_ = color_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -31199,6 +31276,11 @@ public Builder mergeFrom(org.whispersystems.signalservice.internal.push.SignalSe if (other.hasExpireTimer()) { setExpireTimer(other.getExpireTimer()); } + if (other.hasColor()) { + bitField0_ |= 0x00000040; + color_ = other.color_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -31612,6 +31694,80 @@ public Builder clearExpireTimer() { return this; } + // optional string color = 7; + private java.lang.Object color_ = ""; + /** + * optional string color = 7; + */ + public boolean hasColor() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional string color = 7; + */ + public java.lang.String getColor() { + java.lang.Object ref = color_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + color_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string color = 7; + */ + public com.google.protobuf.ByteString + getColorBytes() { + java.lang.Object ref = color_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + color_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string color = 7; + */ + public Builder setColor( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + color_ = value; + onChanged(); + return this; + } + /** + * optional string color = 7; + */ + public Builder clearColor() { + bitField0_ = (bitField0_ & ~0x00000040); + color_ = getDefaultInstance().getColor(); + onChanged(); + return this; + } + /** + * optional string color = 7; + */ + public Builder setColorBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000040; + color_ = value; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:signalservice.GroupDetails) } @@ -31920,14 +32076,14 @@ public Builder clearExpireTimer() { "\001(\t\022)\n\010verified\030\005 \001(\0132\027.signalservice.Ve" + "rified\022\022\n\nprofileKey\030\006 \001(\014\022\017\n\007blocked\030\007 " + "\001(\010\022\023\n\013expireTimer\030\010 \001(\r\032-\n\006Avatar\022\023\n\013co" + - "ntentType\030\001 \001(\t\022\016\n\006length\030\002 \001(\r\"\307\001\n\014Grou" + + "ntentType\030\001 \001(\t\022\016\n\006length\030\002 \001(\r\"\326\001\n\014Grou" + "pDetails\022\n\n\002id\030\001 \001(\014\022\014\n\004name\030\002 \001(\t\022\017\n\007me", "mbers\030\003 \003(\t\0222\n\006avatar\030\004 \001(\0132\".signalserv" + "ice.GroupDetails.Avatar\022\024\n\006active\030\005 \001(\010:" + - "\004true\022\023\n\013expireTimer\030\006 \001(\r\032-\n\006Avatar\022\023\n\013" + - "contentType\030\001 \001(\t\022\016\n\006length\030\002 \001(\rBE\n.org" + - ".whispersystems.signalservice.internal.p" + - "ushB\023SignalServiceProtos" + "\004true\022\023\n\013expireTimer\030\006 \001(\r\022\r\n\005color\030\007 \001(" + + "\t\032-\n\006Avatar\022\023\n\013contentType\030\001 \001(\t\022\016\n\006leng" + + "th\030\002 \001(\rBE\n.org.whispersystems.signalser" + + "vice.internal.pushB\023SignalServiceProtos" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -32131,7 +32287,7 @@ public com.google.protobuf.ExtensionRegistry assignDescriptors( internal_static_signalservice_GroupDetails_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_signalservice_GroupDetails_descriptor, - new java.lang.String[] { "Id", "Name", "Members", "Avatar", "Active", "ExpireTimer", }); + new java.lang.String[] { "Id", "Name", "Members", "Avatar", "Active", "ExpireTimer", "Color", }); internal_static_signalservice_GroupDetails_Avatar_descriptor = internal_static_signalservice_GroupDetails_descriptor.getNestedTypes().get(0); internal_static_signalservice_GroupDetails_Avatar_fieldAccessorTable = new diff --git a/protobuf/SignalService.proto b/protobuf/SignalService.proto index 75c87552d2..768bd97658 100644 --- a/protobuf/SignalService.proto +++ b/protobuf/SignalService.proto @@ -307,4 +307,5 @@ message GroupDetails { optional Avatar avatar = 4; optional bool active = 5 [default = true]; optional uint32 expireTimer = 6; + optional string color = 7; }