mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-28 18:10:38 +00:00
parent
b8d8413a22
commit
47d65586cd
1 changed files with 21 additions and 9 deletions
|
@ -210,12 +210,6 @@ public class StorageHelper {
|
|||
remoteOnlyRecords.size());
|
||||
}
|
||||
|
||||
final var unknownInserts = processKnownRecords(connection, remoteOnlyRecords);
|
||||
final var unknownDeletes = idDifference.localOnlyIds()
|
||||
.stream()
|
||||
.filter(id -> !KNOWN_TYPES.contains(id.getType()))
|
||||
.toList();
|
||||
|
||||
if (!idDifference.localOnlyIds().isEmpty()) {
|
||||
final var updated = account.getRecipientStore()
|
||||
.removeStorageIdsFromLocalOnlyUnregisteredRecipients(connection,
|
||||
|
@ -228,6 +222,12 @@ public class StorageHelper {
|
|||
}
|
||||
}
|
||||
|
||||
final var unknownInserts = processKnownRecords(connection, remoteOnlyRecords);
|
||||
final var unknownDeletes = idDifference.localOnlyIds()
|
||||
.stream()
|
||||
.filter(id -> !KNOWN_TYPES.contains(id.getType()))
|
||||
.toList();
|
||||
|
||||
logger.debug("Storage ids with unknown type: {} inserts, {} deletes",
|
||||
unknownInserts.size(),
|
||||
unknownDeletes.size());
|
||||
|
@ -279,10 +279,22 @@ public class StorageHelper {
|
|||
try (final var connection = account.getAccountDatabase().getConnection()) {
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
final var localStorageIds = getAllLocalStorageIds(connection);
|
||||
final var idDifference = findIdDifference(remoteManifest.storageIds, localStorageIds);
|
||||
var localStorageIds = getAllLocalStorageIds(connection);
|
||||
var idDifference = findIdDifference(remoteManifest.storageIds, localStorageIds);
|
||||
logger.debug("ID Difference :: {}", idDifference);
|
||||
|
||||
final var unknownOnlyLocal = idDifference.localOnlyIds()
|
||||
.stream()
|
||||
.filter(id -> !KNOWN_TYPES.contains(id.getType()))
|
||||
.toList();
|
||||
|
||||
if (!unknownOnlyLocal.isEmpty()) {
|
||||
logger.debug("Storage ids with unknown type: {} to delete", unknownOnlyLocal.size());
|
||||
account.getUnknownStorageIdStore().deleteUnknownStorageIds(connection, unknownOnlyLocal);
|
||||
localStorageIds = getAllLocalStorageIds(connection);
|
||||
idDifference = findIdDifference(remoteManifest.storageIds, localStorageIds);
|
||||
}
|
||||
|
||||
final var remoteDeletes = idDifference.remoteOnlyIds().stream().map(StorageId::getRaw).toList();
|
||||
final var remoteInserts = buildLocalStorageRecords(connection, idDifference.localOnlyIds());
|
||||
// TODO check if local storage record proto matches remote, then reset to remote storage_id
|
||||
|
@ -595,7 +607,7 @@ public class StorageHelper {
|
|||
final var remote = remoteByRawId.get(rawId);
|
||||
final var local = localByRawId.get(rawId);
|
||||
|
||||
if (remote.getType() != local.getType() && local.getType() != 0) {
|
||||
if (remote.getType() != local.getType() && KNOWN_TYPES.contains(local.getType())) {
|
||||
remoteOnlyRawIds.remove(rawId);
|
||||
localOnlyRawIds.remove(rawId);
|
||||
hasTypeMismatch = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue