GV2 storage service syncing.

This commit is contained in:
Alan Evans
2020-05-19 18:48:26 -03:00
committed by Greyson Parrelli
parent 36df3f234f
commit 11d17f7496
9 changed files with 291 additions and 83 deletions

View File

@@ -69,7 +69,7 @@ public final class SignalGroupV2Record implements SignalRecord {
private final GroupV2Record.Builder builder;
public Builder(byte[] rawId, GroupMasterKey masterKey) {
this.id = StorageId.forGroupV1(rawId);
this.id = StorageId.forGroupV2(rawId);
this.builder = GroupV2Record.newBuilder();
builder.setMasterKey(ByteString.copyFrom(masterKey.serialize()));

View File

@@ -7,7 +7,7 @@ import java.util.Objects;
public class SignalStorageRecord implements SignalRecord {
private final StorageId id;
private final StorageId id;
private final Optional<SignalContactRecord> contact;
private final Optional<SignalGroupV1Record> groupV1;
private final Optional<SignalGroupV2Record> groupV2;
@@ -88,7 +88,7 @@ public class SignalStorageRecord implements SignalRecord {
}
public boolean isUnknown() {
return !contact.isPresent() && !groupV1.isPresent() && !account.isPresent();
return !contact.isPresent() && !groupV1.isPresent() && !groupV2.isPresent() && !account.isPresent();
}
@Override
@@ -97,12 +97,13 @@ public class SignalStorageRecord implements SignalRecord {
if (o == null || getClass() != o.getClass()) return false;
SignalStorageRecord that = (SignalStorageRecord) o;
return Objects.equals(id, that.id) &&
Objects.equals(contact, that.contact) &&
Objects.equals(groupV1, that.groupV1);
Objects.equals(contact, that.contact) &&
Objects.equals(groupV1, that.groupV1) &&
Objects.equals(groupV2, that.groupV2);
}
@Override
public int hashCode() {
return Objects.hash(id, contact, groupV1);
return Objects.hash(id, contact, groupV1, groupV2);
}
}