]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/internal/SignalDependencies.java
Update libsignal-service
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / internal / SignalDependencies.java
index f4f72aca6a5a751f8dd5944cffc483b2ecd6d265..90e3b1595e0ad4389b3b6c72cf04a6238a6e5c1f 100644 (file)
@@ -15,9 +15,13 @@ 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.link.LinkDeviceApi;
 import org.whispersystems.signalservice.api.push.ServiceIdType;
 import org.whispersystems.signalservice.api.push.SignalServiceAddress;
+import org.whispersystems.signalservice.api.registration.RegistrationApi;
 import org.whispersystems.signalservice.api.services.ProfileService;
+import org.whispersystems.signalservice.api.storage.StorageServiceApi;
+import org.whispersystems.signalservice.api.storage.StorageServiceRepository;
 import org.whispersystems.signalservice.api.svr.SecureValueRecovery;
 import org.whispersystems.signalservice.api.util.CredentialsProvider;
 import org.whispersystems.signalservice.api.util.UptimeSleepTimer;
@@ -47,6 +51,9 @@ public class SignalDependencies {
 
     private SignalServiceAccountManager accountManager;
     private GroupsV2Api groupsV2Api;
+    private RegistrationApi registrationApi;
+    private LinkDeviceApi linkDeviceApi;
+    private StorageServiceApi storageServiceApi;
     private GroupsV2Operations groupsV2Operations;
     private ClientZkOperations clientZkOperations;
 
@@ -80,8 +87,14 @@ public class SignalDependencies {
         if (this.pushServiceSocket != null) {
             this.pushServiceSocket.close();
             this.pushServiceSocket = null;
+            this.accountManager = null;
+            this.messageReceiver = null;
+            this.messageSender = null;
+            this.profileService = null;
+            this.groupsV2Api = null;
+            this.registrationApi = null;
+            this.secureValueRecovery = null;
         }
-        this.messageSender = null;
         getSignalWebSocket().forceNewWebSockets();
     }
 
@@ -143,6 +156,23 @@ public class SignalDependencies {
         return getOrCreate(() -> groupsV2Api, () -> groupsV2Api = getAccountManager().getGroupsV2Api());
     }
 
+    public RegistrationApi getRegistrationApi() {
+        return getOrCreate(() -> registrationApi, () -> registrationApi = getAccountManager().getRegistrationApi());
+    }
+
+    public LinkDeviceApi getLinkDeviceApi() {
+        return getOrCreate(() -> linkDeviceApi, () -> linkDeviceApi = new LinkDeviceApi(getPushServiceSocket()));
+    }
+
+    private StorageServiceApi getStorageServiceApi() {
+        return getOrCreate(() -> storageServiceApi,
+                () -> storageServiceApi = new StorageServiceApi(getPushServiceSocket()));
+    }
+
+    public StorageServiceRepository getStorageServiceRepository() {
+        return new StorageServiceRepository(getStorageServiceApi());
+    }
+
     public GroupsV2Operations getGroupsV2Operations() {
         return getOrCreate(() -> groupsV2Operations,
                 () -> groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),