]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/Manager.java
Bump version 0.6.1
[signal-cli] / src / main / java / org / asamk / signal / manager / Manager.java
index 1b703e4291a838b4454d329c4917458eba45d838..f18cb219df05cac96a71d89fdbb59e4bf4e90cd1 100644 (file)
@@ -73,16 +73,14 @@ public class Manager implements Signal {
     private final String dataPath;
     private final String attachmentsPath;
     private final String avatarsPath;
+    private final SleepTimer timer = new UptimeSleepTimer();
 
     private SignalAccount account;
-
     private String username;
     private SignalServiceAccountManager accountManager;
     private SignalServiceMessagePipe messagePipe = null;
     private SignalServiceMessagePipe unidentifiedMessagePipe = null;
 
-    private SleepTimer timer = new UptimeSleepTimer();
-
     public Manager(String username, String settingsPath) {
         this.username = username;
         this.settingsPath = settingsPath;
@@ -163,6 +161,7 @@ public class Manager implements Signal {
         if (account.getProfileKey() == null) {
             // Old config file, creating new profile key
             account.setProfileKey(KeyUtils.createProfileKey());
+            account.save();
         }
     }
 
@@ -250,11 +249,15 @@ public class Manager implements Signal {
     public List<DeviceInfo> getLinkedDevices() throws IOException {
         List<DeviceInfo> devices = accountManager.getDevices();
         account.setMultiDevice(devices.size() > 1);
+        account.save();
         return devices;
     }
 
     public void removeLinkedDevices(int deviceId) throws IOException {
         accountManager.removeDevice(deviceId);
+        List<DeviceInfo> devices = accountManager.getDevices();
+        account.setMultiDevice(devices.size() > 1);
+        account.save();
     }
 
     public void addDeviceLink(URI linkUri) throws IOException, InvalidKeyException {
@@ -269,6 +272,7 @@ public class Manager implements Signal {
 
         accountManager.addDevice(deviceIdentifier, deviceKey, identityKeyPair, Optional.of(account.getProfileKey()), verificationCode);
         account.setMultiDevice(true);
+        account.save();
     }
 
     private List<PreKeyRecord> generatePreKeys() {