]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/internal/SignalDependencies.java
Update dependencies
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / internal / SignalDependencies.java
index c19e6b6601874dc41405c8777def92162b2256e2..f954588f4d28ab8a305d607eebc0e5083025678d 100644 (file)
@@ -14,12 +14,17 @@ import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
 import org.whispersystems.signalservice.api.SignalServiceMessageSender;
 import org.whispersystems.signalservice.api.SignalSessionLock;
 import org.whispersystems.signalservice.api.account.AccountApi;
+import org.whispersystems.signalservice.api.attachment.AttachmentApi;
 import org.whispersystems.signalservice.api.cds.CdsApi;
+import org.whispersystems.signalservice.api.certificate.CertificateApi;
 import org.whispersystems.signalservice.api.crypto.SignalServiceCipher;
 import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
 import org.whispersystems.signalservice.api.groupsv2.GroupsV2Api;
 import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
+import org.whispersystems.signalservice.api.keys.KeysApi;
 import org.whispersystems.signalservice.api.link.LinkDeviceApi;
+import org.whispersystems.signalservice.api.message.MessageApi;
+import org.whispersystems.signalservice.api.profiles.ProfileApi;
 import org.whispersystems.signalservice.api.push.ServiceIdType;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
 import org.whispersystems.signalservice.api.ratelimit.RateLimitChallengeApi;
@@ -68,6 +73,10 @@ public class SignalDependencies {
     private RegistrationApi registrationApi;
     private LinkDeviceApi linkDeviceApi;
     private StorageServiceApi storageServiceApi;
+    private CertificateApi certificateApi;
+    private AttachmentApi attachmentApi;
+    private MessageApi messageApi;
+    private KeysApi keysApi;
     private GroupsV2Operations groupsV2Operations;
     private ClientZkOperations clientZkOperations;
 
@@ -80,6 +89,7 @@ public class SignalDependencies {
 
     private List<SecureValueRecovery> secureValueRecovery;
     private ProfileService profileService;
+    private ProfileApi profileApi;
 
     SignalDependencies(
             final ServiceEnvironmentConfig serviceEnvironmentConfig,
@@ -137,7 +147,6 @@ public class SignalDependencies {
                 () -> pushServiceSocket = new PushServiceSocket(serviceEnvironmentConfig.signalServiceConfiguration(),
                         credentialsProvider,
                         userAgent,
-                        getClientZkProfileOperations(),
                         ServiceConfig.AUTOMATIC_NETWORK_RETRY));
     }
 
@@ -174,7 +183,8 @@ public class SignalDependencies {
 
     public SignalServiceAccountManager getAccountManager() {
         return getOrCreate(() -> accountManager,
-                () -> accountManager = new SignalServiceAccountManager(getAccountApi(),
+                () -> accountManager = new SignalServiceAccountManager(getAuthenticatedSignalWebSocket(),
+                        getAccountApi(),
                         getPushServiceSocket(),
                         getGroupsV2Operations()));
     }
@@ -231,6 +241,27 @@ public class SignalDependencies {
         return new StorageServiceRepository(getStorageServiceApi());
     }
 
+    public CertificateApi getCertificateApi() {
+        return getOrCreate(() -> certificateApi,
+                () -> certificateApi = new CertificateApi(getAuthenticatedSignalWebSocket()));
+    }
+
+    public AttachmentApi getAttachmentApi() {
+        return getOrCreate(() -> attachmentApi,
+                () -> attachmentApi = new AttachmentApi(getAuthenticatedSignalWebSocket(), getPushServiceSocket()));
+    }
+
+    public MessageApi getMessageApi() {
+        return getOrCreate(() -> messageApi,
+                () -> messageApi = new MessageApi(getAuthenticatedSignalWebSocket(),
+                        getUnauthenticatedSignalWebSocket()));
+    }
+
+    public KeysApi getKeysApi() {
+        return getOrCreate(() -> keysApi,
+                () -> keysApi = new KeysApi(getAuthenticatedSignalWebSocket(), getUnauthenticatedSignalWebSocket()));
+    }
+
     public GroupsV2Operations getGroupsV2Operations() {
         return getOrCreate(() -> groupsV2Operations,
                 () -> groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),
@@ -258,7 +289,7 @@ public class SignalDependencies {
                     Optional.of(credentialsProvider),
                     userAgent,
                     healthMonitor,
-                    allowStories), timer, TimeUnit.SECONDS.toMillis(10));
+                    allowStories), () -> true, timer, TimeUnit.SECONDS.toMillis(10));
             healthMonitor.monitor(authenticatedSignalWebSocket);
         });
     }
@@ -274,7 +305,7 @@ public class SignalDependencies {
                     Optional.empty(),
                     userAgent,
                     healthMonitor,
-                    allowStories), timer, TimeUnit.SECONDS.toMillis(10));
+                    allowStories), () -> true, timer, TimeUnit.SECONDS.toMillis(10));
             healthMonitor.monitor(unauthenticatedSignalWebSocket);
         });
     }
@@ -289,11 +320,13 @@ public class SignalDependencies {
                 () -> messageSender = new SignalServiceMessageSender(getPushServiceSocket(),
                         dataStore,
                         sessionLock,
-                        getAuthenticatedSignalWebSocket(),
-                        getUnauthenticatedSignalWebSocket(),
+                        getAttachmentApi(),
+                        getMessageApi(),
+                        getKeysApi(),
                         Optional.empty(),
                         executor,
-                        ServiceConfig.MAX_ENVELOPE_SIZE));
+                        ServiceConfig.MAX_ENVELOPE_SIZE,
+                        () -> true));
     }
 
     public List<SecureValueRecovery> getSecureValueRecovery() {
@@ -304,10 +337,17 @@ public class SignalDependencies {
                         .toList());
     }
 
+    public ProfileApi getProfileApi() {
+        return getOrCreate(() -> profileApi,
+                () -> profileApi = new ProfileApi(getAuthenticatedSignalWebSocket(),
+                        getUnauthenticatedSignalWebSocket(),
+                        getPushServiceSocket(),
+                        getClientZkProfileOperations()));
+    }
+
     public ProfileService getProfileService() {
         return getOrCreate(() -> profileService,
                 () -> profileService = new ProfileService(getClientZkProfileOperations(),
-                        getMessageReceiver(),
                         getAuthenticatedSignalWebSocket(),
                         getUnauthenticatedSignalWebSocket()));
     }