X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/1dd22132ffd15cc25fffa62aa765af979c7ae347..276ecef3009baecb740f23d53ddaa81f487d57a2:/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java diff --git a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java index 6450f1f8..f4489ea7 100644 --- a/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java +++ b/lib/src/main/java/org/asamk/signal/manager/SignalDependencies.java @@ -40,6 +40,8 @@ public class SignalDependencies { private final ExecutorService executor; private final SignalSessionLock sessionLock; + private boolean allowStories = true; + private SignalServiceAccountManager accountManager; private GroupsV2Api groupsV2Api; private GroupsV2Operations groupsV2Operations; @@ -72,12 +74,24 @@ public class SignalDependencies { public void resetAfterAddressChange() { this.messageSender = null; this.cipher = null; + getSignalWebSocket().forceNewWebSockets(); + } + + /** + * This method needs to be called before the first websocket is created + */ + public void setAllowStories(final boolean allowStories) { + this.allowStories = allowStories; } public ServiceEnvironmentConfig getServiceEnvironmentConfig() { return serviceEnvironmentConfig; } + public SignalSessionLock getSessionLock() { + return sessionLock; + } + public SignalServiceAccountManager getAccountManager() { return getOrCreate(() -> accountManager, () -> accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(), @@ -105,7 +119,7 @@ public class SignalDependencies { public GroupsV2Operations getGroupsV2Operations() { return getOrCreate(() -> groupsV2Operations, - () -> groupsV2Operations = capabilities.isGv2() + () -> groupsV2Operations = capabilities.getGv2() ? new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration()), ServiceConfig.GROUP_MAX_SIZE) : null); @@ -113,7 +127,7 @@ public class SignalDependencies { private ClientZkOperations getClientZkOperations() { return getOrCreate(() -> clientZkOperations, - () -> clientZkOperations = capabilities.isGv2() + () -> clientZkOperations = capabilities.getGv2() ? ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration()) : null); } @@ -135,7 +149,7 @@ public class SignalDependencies { Optional.of(credentialsProvider), userAgent, healthMonitor, - true); + allowStories); } @Override @@ -145,7 +159,7 @@ public class SignalDependencies { Optional.empty(), userAgent, healthMonitor, - true); + allowStories); } }; signalWebSocket = new SignalWebSocket(webSocketFactory);