]> nmode's Git Repositories - signal-cli/commitdiff
Update libsignal-service
authorAsamK <asamk@gmx.de>
Thu, 6 Oct 2022 15:36:09 +0000 (17:36 +0200)
committerAsamK <asamk@gmx.de>
Thu, 6 Oct 2022 15:55:16 +0000 (17:55 +0200)
lib/build.gradle.kts
lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java
lib/src/main/java/org/asamk/signal/manager/helper/StorageHelper.java

index 9674f296228e0fb0f4ab2dcc834f321d573cb59a..2dde3b3967bc9793734aa9910c24accd1ead5481 100644 (file)
@@ -14,7 +14,7 @@ repositories {
 }
 
 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.google.protobuf", "protobuf-javalite", "3.11.4")
     implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
index b892e935940b779cbcfd5446ab53bcaeba0212db..6450f1f8f883f167b8da9fae97929105968eec2c 100644 (file)
@@ -134,7 +134,8 @@ public class SignalDependencies {
                             serviceEnvironmentConfig.getSignalServiceConfiguration(),
                             Optional.of(credentialsProvider),
                             userAgent,
-                            healthMonitor);
+                            healthMonitor,
+                            true);
                 }
 
                 @Override
@@ -143,7 +144,8 @@ public class SignalDependencies {
                             serviceEnvironmentConfig.getSignalServiceConfiguration(),
                             Optional.empty(),
                             userAgent,
-                            healthMonitor);
+                            healthMonitor,
+                            true);
                 }
             };
             signalWebSocket = new SignalWebSocket(webSocketFactory);
index f3c3a09122b1548f8b83ec59b8789631d25dd544..15684da54b03a91e6e21b36fa429d1eb48093e0d 100644 (file)
@@ -109,27 +109,48 @@ public class StorageHelper {
         final var blocked = contact != null && contact.isBlocked();
         final var profileShared = contact != null && contact.isProfileSharingEnabled();
         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()
                 || 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);
             final var contactBuilder = contact == null ? Contact.newBuilder() : Contact.newBuilder(contact);
             final var newContact = contactBuilder.withBlocked(contactRecord.isBlocked())
                     .withProfileSharingEnabled(contactRecord.isProfileSharingEnabled())
-                    .withArchived(contactRecord.isArchived())
-                    .build();
-            account.getContactStore().storeContact(recipientId, newContact);
+                    .withArchived(contactRecord.isArchived());
+            if (contactRecord.getSystemGivenName().isPresent() || contactRecord.getSystemFamilyName().isPresent()) {
+                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 givenName = profile == null ? null : profile.getGivenName();
-        final var familyName = profile == null ? null : profile.getFamilyName();
-        if ((contactRecord.getGivenName().isPresent() && !contactRecord.getGivenName().get().equals(givenName)) || (
-                contactRecord.getFamilyName().isPresent() && !contactRecord.getFamilyName().get().equals(familyName)
+        final var profileGivenName = profile == null ? null : profile.getGivenName();
+        final var profileFamilyName = profile == null ? null : profile.getFamilyName();
+        if ((
+                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 newProfile = profileBuilder.withGivenName(contactRecord.getGivenName().orElse(null))
-                    .withFamilyName(contactRecord.getFamilyName().orElse(null))
+            final var newProfile = profileBuilder.withGivenName(contactRecord.getProfileGivenName().orElse(null))
+                    .withFamilyName(contactRecord.getProfileFamilyName().orElse(null))
                     .build();
             account.getProfileStore().storeProfile(recipientId, newProfile);
         }