]> nmode's Git Repositories - signal-cli/commitdiff
Update dependencies
authorAsamK <asamk@gmx.de>
Tue, 14 Jan 2025 16:31:15 +0000 (17:31 +0100)
committerAsamK <asamk@gmx.de>
Tue, 14 Jan 2025 19:30:06 +0000 (20:30 +0100)
graalvm-config-dir/reflect-config.json
gradle/libs.versions.toml
lib/src/main/java/org/asamk/signal/manager/syncStorage/AccountRecordProcessor.java
lib/src/main/java/org/asamk/signal/manager/syncStorage/StorageRecordProcessor.java
lib/src/main/java/org/asamk/signal/manager/syncStorage/StorageRecordUpdate.java

index 7a8fe2a12a5ac4abe2dc5cc0e985607fb7706bdb..30ace9e3be26f9f28b83aa0b79279299aadb8de4 100644 (file)
 {
   "name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord$Companion"
 },
+{
+  "name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord$IAPSubscriberData"
+},
 {
   "name":"org.whispersystems.signalservice.internal.storage.protos.AccountRecord$PhoneNumberSharingMode"
 },
index 784a2a439ebf54d1c52b04e062c53ed7d67a1a36..9a5d4fee1cc9981a26654ce28506464a73be0f4b 100644 (file)
@@ -8,10 +8,10 @@ argparse4j = "net.sourceforge.argparse4j:argparse4j:0.9.0"
 dbusjava = "com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.0.0"
 slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
 slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
-logback = "ch.qos.logback:logback-classic:1.5.15"
+logback = "ch.qos.logback:logback-classic:1.5.16"
 
-signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_114"
-sqlite = "org.xerial:sqlite-jdbc:3.47.1.0"
+signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_115"
+sqlite = "org.xerial:sqlite-jdbc:3.47.2.0"
 hikari = "com.zaxxer:HikariCP:6.2.1"
 junit-jupiter = "org.junit.jupiter:junit-jupiter:5.11.4"
 junit-launcher = "org.junit.platform:junit-platform-launcher:1.11.4"
index b2f7dd2931801d0c306e2f5ccd35e33c6e1b1f75..5b1efbd68e83064d67e76cfc38c1e873badcce09 100644 (file)
@@ -11,6 +11,7 @@ import org.signal.libsignal.zkgroup.profiles.ProfileKey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.whispersystems.signalservice.api.push.UsernameLinkComponents;
+import org.whispersystems.signalservice.api.storage.IAPSubscriptionId;
 import org.whispersystems.signalservice.api.storage.SignalAccountRecord;
 import org.whispersystems.signalservice.api.storage.StorageId;
 import org.whispersystems.signalservice.api.util.UuidUtil;
@@ -22,8 +23,12 @@ import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Optional;
 
+import okio.ByteString;
+
 import static org.asamk.signal.manager.util.Utils.firstNonEmpty;
-import static org.asamk.signal.manager.util.Utils.firstNonNull;
+import static org.whispersystems.signalservice.api.storage.AccountRecordExtensionsKt.safeSetBackupsSubscriber;
+import static org.whispersystems.signalservice.api.storage.AccountRecordExtensionsKt.safeSetPayments;
+import static org.whispersystems.signalservice.api.storage.AccountRecordExtensionsKt.safeSetSubscriber;
 
 /**
  * Processes {@link SignalAccountRecord}s.
@@ -77,6 +82,35 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
             familyName = local.familyName;
         }
 
+        final var payments = remote.payments != null && remote.payments.entropy.size() > 0
+                ? remote.payments
+                : local.payments;
+
+        final ByteString donationSubscriberId;
+        final String donationSubscriberCurrencyCode;
+
+        if (remote.subscriberId.size() > 0) {
+            donationSubscriberId = remote.subscriberId;
+            donationSubscriberCurrencyCode = remote.subscriberCurrencyCode;
+        } else {
+            donationSubscriberId = local.subscriberId;
+            donationSubscriberCurrencyCode = local.subscriberCurrencyCode;
+        }
+
+        final ByteString backupsSubscriberId;
+        final IAPSubscriptionId backupsPurchaseToken;
+
+        final var remoteBackupSubscriberData = remote.backupSubscriberData;
+        if (remoteBackupSubscriberData != null && remoteBackupSubscriberData.subscriberId.size() > 0) {
+            backupsSubscriberId = remoteBackupSubscriberData.subscriberId;
+            backupsPurchaseToken = IAPSubscriptionId.Companion.from(remoteBackupSubscriberData);
+        } else {
+            backupsSubscriberId = local.backupSubscriberData != null
+                    ? local.backupSubscriberData.subscriberId
+                    : ByteString.EMPTY;
+            backupsPurchaseToken = IAPSubscriptionId.Companion.from(local.backupSubscriberData);
+        }
+
         final var mergedBuilder = SignalAccountRecord.Companion.newBuilder(remote.unknownFields().toByteArray())
                 .givenName(givenName)
                 .familyName(familyName)
@@ -96,9 +130,6 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
                 .preferredReactionEmoji(firstNonEmpty(remote.preferredReactionEmoji, local.preferredReactionEmoji))
                 .subscriberId(firstNonEmpty(remote.subscriberId, local.subscriberId))
                 .subscriberCurrencyCode(firstNonEmpty(remote.subscriberCurrencyCode, local.subscriberCurrencyCode))
-                .backupsSubscriberId(firstNonEmpty(remote.backupsSubscriberId, local.backupsSubscriberId))
-                .backupsSubscriberCurrencyCode(firstNonEmpty(remote.backupsSubscriberCurrencyCode,
-                        local.backupsSubscriberCurrencyCode))
                 .displayBadgesOnProfile(remote.displayBadgesOnProfile)
                 .subscriptionManuallyCancelled(remote.subscriptionManuallyCancelled)
                 .keepMutedChatsArchived(remote.keepMutedChatsArchived)
@@ -115,9 +146,12 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor<Signal
                 .username(remote.username)
                 .usernameLink(remote.usernameLink)
                 .e164(account.isPrimaryDevice() ? local.e164 : remote.e164);
-        if (firstNonNull(remote.payments, local.payments) != null) {
-            mergedBuilder.payments(firstNonNull(remote.payments, local.payments));
-        }
+        safeSetPayments(mergedBuilder,
+                payments != null && payments.enabled,
+                payments == null ? null : payments.entropy.toByteArray());
+        safeSetSubscriber(mergedBuilder, donationSubscriberId, donationSubscriberCurrencyCode);
+        safeSetBackupsSubscriber(mergedBuilder, backupsSubscriberId, backupsPurchaseToken);
+
         final var merged = mergedBuilder.build();
 
         final var matchesRemote = doProtosMatch(merged, remote);
index 45a9956275b4517748b1149740a82138bedb95a6..2e14f64876c2ebdbd37ad4a54de775e754446e3e 100644 (file)
@@ -8,7 +8,7 @@ import java.sql.SQLException;
  * Handles processing a remote record, which involves applying any local changes that need to be
  * made based on the remote records.
  */
-interface StorageRecordProcessor<E extends SignalRecord> {
+interface StorageRecordProcessor<E extends SignalRecord<?>> {
 
     void process(E remoteRecord) throws SQLException;
 }
index 8dcb7b34053746e5b19378ebdce5e95adc86c838..da8ccaf662284837b7ca2bac7ad30012672ee3fe 100644 (file)
@@ -5,7 +5,7 @@ import org.whispersystems.signalservice.api.storage.SignalRecord;
 /**
  * Represents a pair of records: one old, and one new. The new record should replace the old.
  */
-record StorageRecordUpdate<E extends SignalRecord>(E oldRecord, E newRecord) {
+record StorageRecordUpdate<E extends SignalRecord<?>>(E oldRecord, E newRecord) {
 
     @Override
     public String toString() {