mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-11-29 08:55:48 +00:00
Update libsignal-service
This commit is contained in:
1 parent
7d31b3309e
commit
49aaef000f
8 files changed
+50
-49
No files matched your search
@@ -492,7 +492,7 @@ public class StorageHelper {
|
||||
final var storageId = newStickerPackStorageIds.get(stickerPack.packId());
|
||||
final var record = StorageSyncModels.localToRemoteRecord(stickerPack);
|
||||
newStorageRecords.add(new SignalStorageRecord(storageId,
|
||||
new StorageRecord.Builder().stickerPack(record).build()));
|
||||
new StorageRecord.Builder().installedStickerPack(record).build()));
|
||||
}
|
||||
|
||||
connection.commit();
|
||||
@@ -680,7 +680,8 @@ public class StorageHelper {
|
||||
throw new AssertionError("Missing local sticker pack model for storage id: " + storageId);
|
||||
}
|
||||
final var record = StorageSyncModels.localToRemoteRecord(stickerPack);
|
||||
yield new SignalStorageRecord(storageId, new StorageRecord.Builder().stickerPack(record).build());
|
||||
yield new SignalStorageRecord(storageId,
|
||||
new StorageRecord.Builder().installedStickerPack(record).build());
|
||||
}
|
||||
case null, default -> {
|
||||
throw new AssertionError("Got unknown local storage record type: " + storageId);
|
||||
@@ -777,9 +778,9 @@ public class StorageHelper {
|
||||
logger.debug("Reading record {} of type contact", record.getId());
|
||||
contactRecordProcessor.process(StorageRecordConvertersKt.toSignalContactRecord(record.getProto().contact,
|
||||
record.getId()));
|
||||
} else if (record.getProto().stickerPack != null) {
|
||||
} else if (record.getProto().installedStickerPack != null) {
|
||||
logger.debug("Reading record {} of type stickerPack", record.getId());
|
||||
stickerPackRecordProcessor.process(StorageRecordConvertersKt.toSignalStickerPackRecord(record.getProto().stickerPack,
|
||||
stickerPackRecordProcessor.process(StorageRecordConvertersKt.toSignalInstalledStickerPackRecord(record.getProto().installedStickerPack,
|
||||
record.getId()));
|
||||
} else {
|
||||
unknownRecords.add(record.getId());
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.asamk.signal.manager.storage.Utils;
|
||||
import org.asamk.signal.manager.util.KeyUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.storage.SignalStickerPackRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalInstalledStickerPackRecord;
|
||||
import org.whispersystems.signalservice.api.storage.StorageId;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -351,7 +351,7 @@ public class StickerStore {
|
||||
|
||||
public void upsertFromStorageSync(
|
||||
final Connection connection,
|
||||
final SignalStickerPackRecord record
|
||||
final SignalInstalledStickerPackRecord record
|
||||
) throws SQLException {
|
||||
final var remote = record.getProto();
|
||||
final var packId = StickerPackId.deserialize(remote.packId.toByteArray());
|
||||
|
||||
+11
-11
@@ -3,14 +3,14 @@ package org.asamk.signal.manager.syncStorage;
|
||||
import org.asamk.signal.manager.api.StickerPackId;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.util.KeyUtils;
|
||||
import org.whispersystems.signalservice.api.storage.SignalStickerPackRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalInstalledStickerPackRecord;
|
||||
import org.whispersystems.signalservice.api.storage.StorageId;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Optional;
|
||||
|
||||
public class StickerPackRecordProcessor extends DefaultStorageRecordProcessor<SignalStickerPackRecord> {
|
||||
public class StickerPackRecordProcessor extends DefaultStorageRecordProcessor<SignalInstalledStickerPackRecord> {
|
||||
|
||||
private static final int PACK_ID_LENGTH = 16;
|
||||
private static final int PACK_KEY_LENGTH = 32;
|
||||
@@ -24,19 +24,19 @@ public class StickerPackRecordProcessor extends DefaultStorageRecordProcessor<Si
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(final SignalStickerPackRecord lhs, final SignalStickerPackRecord rhs) {
|
||||
public int compare(final SignalInstalledStickerPackRecord lhs, final SignalInstalledStickerPackRecord rhs) {
|
||||
return lhs.getProto().packId.equals(rhs.getProto().packId) ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInvalid(final SignalStickerPackRecord remote) {
|
||||
protected boolean isInvalid(final SignalInstalledStickerPackRecord remote) {
|
||||
return remote.getProto().packId.size() != PACK_ID_LENGTH || (
|
||||
remote.getProto().deletedAtTimestamp == 0 && remote.getProto().packKey.size() != PACK_KEY_LENGTH
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<SignalStickerPackRecord> getMatching(final SignalStickerPackRecord remote) throws SQLException {
|
||||
protected Optional<SignalInstalledStickerPackRecord> getMatching(final SignalInstalledStickerPackRecord remote) throws SQLException {
|
||||
final var packId = StickerPackId.deserialize(remote.getProto().packId.toByteArray());
|
||||
final var local = account.getStickerStore().getStickerPack(connection, packId);
|
||||
|
||||
@@ -52,13 +52,13 @@ public class StickerPackRecordProcessor extends DefaultStorageRecordProcessor<Si
|
||||
account.getStickerStore().updateStorageId(connection, packId, storageId);
|
||||
}
|
||||
|
||||
return Optional.of(new SignalStickerPackRecord(storageId, StorageSyncModels.localToRemoteRecord(local)));
|
||||
return Optional.of(new SignalInstalledStickerPackRecord(storageId, StorageSyncModels.localToRemoteRecord(local)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SignalStickerPackRecord merge(
|
||||
final SignalStickerPackRecord remoteRecord,
|
||||
final SignalStickerPackRecord localRecord
|
||||
protected SignalInstalledStickerPackRecord merge(
|
||||
final SignalInstalledStickerPackRecord remoteRecord,
|
||||
final SignalInstalledStickerPackRecord localRecord
|
||||
) {
|
||||
final var remote = remoteRecord.getProto();
|
||||
final var local = localRecord.getProto();
|
||||
@@ -75,12 +75,12 @@ public class StickerPackRecordProcessor extends DefaultStorageRecordProcessor<Si
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertLocal(final SignalStickerPackRecord record) throws SQLException {
|
||||
protected void insertLocal(final SignalInstalledStickerPackRecord record) throws SQLException {
|
||||
account.getStickerStore().upsertFromStorageSync(connection, record);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateLocal(final StorageRecordUpdate<SignalStickerPackRecord> update) throws SQLException {
|
||||
protected void updateLocal(final StorageRecordUpdate<SignalInstalledStickerPackRecord> update) throws SQLException {
|
||||
account.getStickerStore().upsertFromStorageSync(connection, update.newRecord());
|
||||
}
|
||||
}
|
||||
@@ -17,14 +17,14 @@ import org.whispersystems.signalservice.api.storage.SignalAccountRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalContactRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalGroupV1Record;
|
||||
import org.whispersystems.signalservice.api.storage.SignalGroupV2Record;
|
||||
import org.whispersystems.signalservice.api.storage.SignalStickerPackRecord;
|
||||
import org.whispersystems.signalservice.api.storage.SignalInstalledStickerPackRecord;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.AccountRecord;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.AccountRecord.UsernameLink;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.ContactRecord.IdentityState;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.GroupV1Record;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.GroupV2Record;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.StickerPackRecord;
|
||||
import org.whispersystems.signalservice.internal.storage.protos.InstalledStickerPackRecord;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -168,8 +168,8 @@ public final class StorageSyncModels {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static StickerPackRecord localToRemoteRecord(StickerPack stickerPack) {
|
||||
final var builder = SignalStickerPackRecord.Companion.newBuilder(stickerPack.storageRecord());
|
||||
public static InstalledStickerPackRecord localToRemoteRecord(StickerPack stickerPack) {
|
||||
final var builder = SignalInstalledStickerPackRecord.Companion.newBuilder(stickerPack.storageRecord());
|
||||
builder.packId(ByteString.of(stickerPack.packId().serialize()));
|
||||
|
||||
if (stickerPack.deletedTimestamp() > 0) {
|
||||
|
||||
Reference in new issue
Block a user