@Test public void getInvalidEntries_selfIsInvalid() { SignalContactRecord a = new SignalContactRecord.Builder(byteArray(1), new SignalServiceAddress(UUID_A, E164_A)).build(); SignalContactRecord b = new SignalContactRecord.Builder(byteArray(2), new SignalServiceAddress(UUID_B, E164_B)).build(); SignalContactRecord self = new SignalContactRecord.Builder(byteArray(3), new SignalServiceAddress(UUID_SELF, E164_SELF)).build(); Collection<SignalContactRecord> invalid = new ContactConflictMerger(Collections.emptyList(), SELF).getInvalidEntries(setOf(a, b, self)); assertContentsEqual(setOf(self), invalid); }
@Override public @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords) { List<SignalContactRecord> invalid = Stream.of(remoteRecords) .filter(r -> r.getAddress().getUuid().equals(self.getUuid()) || r.getAddress().getNumber().equals(self.getE164())) .toList(); if (invalid.size() > 0) { Log.w(TAG, "Found invalid contact entries! Count: " + invalid.size()); } return invalid; }
ContactConflictMerger implements StorageSyncHelper.ConflictMerger<SignalContactRecord> { @Override public @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords) { List<SignalContactRecord> invalid = Stream.of(remoteRecords) .filter(r -> r.getAddress().getUuid().equals(self.getUuid()) || r.getAddress().getNumber().equals(self.getE164())) .toList(); if (invalid.size() > 0) { Log.w(TAG, "Found invalid contact entries! Count: " + invalid.size()); } return invalid; } }
ContactConflictMerger implements StorageSyncHelper.ConflictMerger<SignalContactRecord> { @Override public @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords) { List<SignalContactRecord> invalid = Stream.of(remoteRecords) .filter(r -> r.getAddress().getUuid().equals(self.getUuid()) || r.getAddress().getNumber().equals(self.getE164())) .toList(); if (invalid.size() > 0) { Log.w(TAG, "Found invalid contact entries! Count: " + invalid.size()); } return invalid; } ContactConflictMerger(@NonNull Collection<SignalContactRecord> localOnly, @NonNull Recipient self); }
ContactConflictMerger implements StorageSyncHelper.ConflictMerger<SignalContactRecord> { @Override public @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords) { List<SignalContactRecord> invalid = Stream.of(remoteRecords) .filter(r -> r.getAddress().getUuid().equals(self.getUuid()) || r.getAddress().getNumber().equals(self.getE164())) .toList(); if (invalid.size() > 0) { Log.w(TAG, "Found invalid contact entries! Count: " + invalid.size()); } return invalid; } ContactConflictMerger(@NonNull Collection<SignalContactRecord> localOnly, @NonNull Recipient self); @Override @NonNull Optional<SignalContactRecord> getMatching(@NonNull SignalContactRecord record); @Override @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords); @Override @NonNull SignalContactRecord merge(@NonNull SignalContactRecord remote, @NonNull SignalContactRecord local, @NonNull StorageSyncHelper.KeyGenerator keyGenerator); }
ContactConflictMerger implements StorageSyncHelper.ConflictMerger<SignalContactRecord> { @Override public @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords) { List<SignalContactRecord> invalid = Stream.of(remoteRecords) .filter(r -> r.getAddress().getUuid().equals(self.getUuid()) || r.getAddress().getNumber().equals(self.getE164())) .toList(); if (invalid.size() > 0) { Log.w(TAG, "Found invalid contact entries! Count: " + invalid.size()); } return invalid; } ContactConflictMerger(@NonNull Collection<SignalContactRecord> localOnly, @NonNull Recipient self); @Override @NonNull Optional<SignalContactRecord> getMatching(@NonNull SignalContactRecord record); @Override @NonNull Collection<SignalContactRecord> getInvalidEntries(@NonNull Collection<SignalContactRecord> remoteRecords); @Override @NonNull SignalContactRecord merge(@NonNull SignalContactRecord remote, @NonNull SignalContactRecord local, @NonNull StorageSyncHelper.KeyGenerator keyGenerator);  }