Update libsignal-service

This commit is contained in:
AsamK 2022-10-06 17:36:09 +02:00
parent 76c400d2c3
commit 1dd22132ff
3 changed files with 36 additions and 13 deletions

View file

@ -14,7 +14,7 @@ repositories {
} }
dependencies { dependencies {
implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_58") implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_59")
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.4") implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.4")
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4") implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70") implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")

View file

@ -134,7 +134,8 @@ public class SignalDependencies {
serviceEnvironmentConfig.getSignalServiceConfiguration(), serviceEnvironmentConfig.getSignalServiceConfiguration(),
Optional.of(credentialsProvider), Optional.of(credentialsProvider),
userAgent, userAgent,
healthMonitor); healthMonitor,
true);
} }
@Override @Override
@ -143,7 +144,8 @@ public class SignalDependencies {
serviceEnvironmentConfig.getSignalServiceConfiguration(), serviceEnvironmentConfig.getSignalServiceConfiguration(),
Optional.empty(), Optional.empty(),
userAgent, userAgent,
healthMonitor); healthMonitor,
true);
} }
}; };
signalWebSocket = new SignalWebSocket(webSocketFactory); signalWebSocket = new SignalWebSocket(webSocketFactory);

View file

@ -109,27 +109,48 @@ public class StorageHelper {
final var blocked = contact != null && contact.isBlocked(); final var blocked = contact != null && contact.isBlocked();
final var profileShared = contact != null && contact.isProfileSharingEnabled(); final var profileShared = contact != null && contact.isProfileSharingEnabled();
final var archived = contact != null && contact.isArchived(); final var archived = contact != null && contact.isArchived();
final var contactGivenName = contact == null ? null : contact.getGivenName();
final var contactFamilyName = contact == null ? null : contact.getFamilyName();
if (blocked != contactRecord.isBlocked() if (blocked != contactRecord.isBlocked()
|| profileShared != contactRecord.isProfileSharingEnabled() || profileShared != contactRecord.isProfileSharingEnabled()
|| archived != contactRecord.isArchived()) { || archived != contactRecord.isArchived()
|| (
contactRecord.getSystemGivenName().isPresent() && !contactRecord.getSystemGivenName()
.get()
.equals(contactGivenName)
)
|| (
contactRecord.getSystemFamilyName().isPresent() && !contactRecord.getSystemFamilyName()
.get()
.equals(contactFamilyName)
)) {
logger.debug("Storing new or updated contact {}", recipientId); logger.debug("Storing new or updated contact {}", recipientId);
final var contactBuilder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact); final var contactBuilder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
final var newContact = contactBuilder.withBlocked(contactRecord.isBlocked()) final var newContact = contactBuilder.withBlocked(contactRecord.isBlocked())
.withProfileSharingEnabled(contactRecord.isProfileSharingEnabled()) .withProfileSharingEnabled(contactRecord.isProfileSharingEnabled())
.withArchived(contactRecord.isArchived()) .withArchived(contactRecord.isArchived());
.build(); if (contactRecord.getSystemGivenName().isPresent() || contactRecord.getSystemFamilyName().isPresent()) {
account.getContactStore().storeContact(recipientId, newContact); newContact.withGivenName(contactRecord.getSystemGivenName().orElse(null))
.withFamilyName(contactRecord.getSystemFamilyName().orElse(null));
}
account.getContactStore().storeContact(recipientId, newContact.build());
} }
final var profile = account.getProfileStore().getProfile(recipientId); final var profile = account.getProfileStore().getProfile(recipientId);
final var givenName = profile == null ? null : profile.getGivenName(); final var profileGivenName = profile == null ? null : profile.getGivenName();
final var familyName = profile == null ? null : profile.getFamilyName(); final var profileFamilyName = profile == null ? null : profile.getFamilyName();
if ((contactRecord.getGivenName().isPresent() && !contactRecord.getGivenName().get().equals(givenName)) || ( if ((
contactRecord.getFamilyName().isPresent() && !contactRecord.getFamilyName().get().equals(familyName) contactRecord.getProfileGivenName().isPresent() && !contactRecord.getProfileGivenName()
.get()
.equals(profileGivenName)
) || (
contactRecord.getProfileFamilyName().isPresent() && !contactRecord.getProfileFamilyName()
.get()
.equals(profileFamilyName)
)) { )) {
final var profileBuilder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile); final var profileBuilder = profile == null ? Profile.newBuilder() : Profile.newBuilder(profile);
final var newProfile = profileBuilder.withGivenName(contactRecord.getGivenName().orElse(null)) final var newProfile = profileBuilder.withGivenName(contactRecord.getProfileGivenName().orElse(null))
.withFamilyName(contactRecord.getFamilyName().orElse(null)) .withFamilyName(contactRecord.getProfileFamilyName().orElse(null))
.build(); .build();
account.getProfileStore().storeProfile(recipientId, newProfile); account.getProfileStore().storeProfile(recipientId, newProfile);
} }