]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/ManagerImpl.java
Retrieve self profile from storage
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / ManagerImpl.java
index de60fa50aa8ce8b90d00f7727ef00e95c7fad763..0fd1eb33cf0d69a937f45ab6e52c4d0a91b2ccb8 100644 (file)
@@ -209,7 +209,7 @@ public class ManagerImpl implements Manager {
                 avatarStore,
                 this::resolveSignalServiceAddress,
                 account.getRecipientStore());
-        this.storageHelper = new StorageHelper(account, dependencies, groupHelper);
+        this.storageHelper = new StorageHelper(account, dependencies, groupHelper, profileHelper);
         this.contactHelper = new ContactHelper(account);
         this.syncHelper = new SyncHelper(account,
                 attachmentHelper,
@@ -320,6 +320,33 @@ public class ManagerImpl implements Manager {
                         account.isDiscoverableByPhoneNumber());
     }
 
+    @Override
+    public void updateConfiguration(
+            final Boolean readReceipts,
+            final Boolean unidentifiedDeliveryIndicators,
+            final Boolean typingIndicators,
+            final Boolean linkPreviews
+    ) throws IOException, NotMasterDeviceException {
+        if (!account.isMasterDevice()) {
+            throw new NotMasterDeviceException();
+        }
+
+        final var configurationStore = account.getConfigurationStore();
+        if (readReceipts != null) {
+            configurationStore.setReadReceipts(readReceipts);
+        }
+        if (unidentifiedDeliveryIndicators != null) {
+            configurationStore.setUnidentifiedDeliveryIndicators(unidentifiedDeliveryIndicators);
+        }
+        if (typingIndicators != null) {
+            configurationStore.setTypingIndicators(typingIndicators);
+        }
+        if (linkPreviews != null) {
+            configurationStore.setLinkPreviews(linkPreviews);
+        }
+        syncHelper.sendConfigurationMessage();
+    }
+
     /**
      * @param givenName  if null, the previous givenName will be kept
      * @param familyName if null, the previous familyName will be kept
@@ -387,7 +414,7 @@ public class ManagerImpl implements Manager {
     }
 
     @Override
-    public void removeLinkedDevices(int deviceId) throws IOException {
+    public void removeLinkedDevices(long deviceId) throws IOException {
         dependencies.getAccountManager().removeDevice(deviceId);
         var devices = dependencies.getAccountManager().getDevices();
         account.setMultiDevice(devices.size() > 1);