]> 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 f4f72aca6a5a751f8dd5944cffc483b2ecd6d265..7ee2b39e94e4eabee7bb6ff9f818b8671b1e2442 100644 (file)
@@ -17,6 +17,7 @@ import org.whispersystems.signalservice.api.groupsv2.GroupsV2Api;
 import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
 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.svr.SecureValueRecovery;
 import org.whispersystems.signalservice.api.util.CredentialsProvider;
@@ -47,6 +48,7 @@ public class SignalDependencies {
 
     private SignalServiceAccountManager accountManager;
     private GroupsV2Api groupsV2Api;
+    private RegistrationApi registrationApi;
     private GroupsV2Operations groupsV2Operations;
     private ClientZkOperations clientZkOperations;
 
@@ -80,8 +82,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 +151,10 @@ public class SignalDependencies {
         return getOrCreate(() -> groupsV2Api, () -> groupsV2Api = getAccountManager().getGroupsV2Api());
     }
 
+    public RegistrationApi getRegistrationApi() {
+        return getOrCreate(() -> registrationApi, () -> registrationApi = getAccountManager().getRegistrationApi());
+    }
+
     public GroupsV2Operations getGroupsV2Operations() {
         return getOrCreate(() -> groupsV2Operations,
                 () -> groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.signalServiceConfiguration()),