mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Fix issues with StorageSyncV2 bookkeeping.
1. I screwed up the comparators in the record processor. Pretty bad, glad this was caught. 2. Previously I was sort of keeping track of which local-only records were accounted for while I was merging, and then hoping everything worked out in the end. Now I just very directly take some set differences and retrieve the appropriate records, so it's clear that we should never fail certain validations. 3. Rev's the feature flag so we don't turn on something broken.
This commit is contained in:
@@ -12,6 +12,7 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.AccountRecord;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -64,6 +65,10 @@ public final class SignalAccountRecord implements SignalRecord {
|
||||
SignalAccountRecord that = (SignalAccountRecord) other;
|
||||
List<String> diff = new LinkedList<>();
|
||||
|
||||
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
|
||||
diff.add("ID");
|
||||
}
|
||||
|
||||
if (!Objects.equals(this.givenName, that.givenName)) {
|
||||
diff.add("GivenName");
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord.IdentityState;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -56,6 +57,10 @@ public final class SignalContactRecord implements SignalRecord {
|
||||
SignalContactRecord that = (SignalContactRecord) other;
|
||||
List<String> diff = new LinkedList<>();
|
||||
|
||||
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
|
||||
diff.add("ID");
|
||||
}
|
||||
|
||||
if (!Objects.equals(this.getAddress().getNumber(), that.getAddress().getNumber())) {
|
||||
diff.add("E164");
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ public final class SignalGroupV1Record implements SignalRecord {
|
||||
SignalGroupV1Record that = (SignalGroupV1Record) other;
|
||||
List<String> diff = new LinkedList<>();
|
||||
|
||||
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
|
||||
diff.add("ID");
|
||||
}
|
||||
|
||||
if (!Arrays.equals(this.groupId, that.groupId)) {
|
||||
diff.add("MasterKey");
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@ public final class SignalGroupV2Record implements SignalRecord {
|
||||
SignalGroupV2Record that = (SignalGroupV2Record) other;
|
||||
List<String> diff = new LinkedList<>();
|
||||
|
||||
if (!Arrays.equals(this.id.getRaw(), that.id.getRaw())) {
|
||||
diff.add("ID");
|
||||
}
|
||||
|
||||
if (!Arrays.equals(this.getMasterKeyBytes(), that.getMasterKeyBytes())) {
|
||||
diff.add("MasterKey");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user