]> nmode's Git Repositories - signal-cli/commitdiff
Store account file version after migration
authorAsamK <asamk@gmx.de>
Sun, 28 Aug 2022 13:40:23 +0000 (15:40 +0200)
committerAsamK <asamk@gmx.de>
Sun, 28 Aug 2022 13:40:23 +0000 (15:40 +0200)
lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java

index a246c3a7178fc82de2ecefe138d1890af033bcc1..21af35ed40b614ce64099dbbdcf2db9ecd41c29d 100644 (file)
@@ -509,6 +509,8 @@ public class SignalAccount implements Closeable {
             rootNode = jsonProcessor.readTree(Channels.newInputStream(fileChannel));
         }
 
             rootNode = jsonProcessor.readTree(Channels.newInputStream(fileChannel));
         }
 
+        var migratedLegacyConfig = false;
+
         if (rootNode.hasNonNull("version")) {
             var accountVersion = rootNode.get("version").asInt(1);
             if (accountVersion > CURRENT_STORAGE_VERSION) {
         if (rootNode.hasNonNull("version")) {
             var accountVersion = rootNode.get("version").asInt(1);
             if (accountVersion > CURRENT_STORAGE_VERSION) {
@@ -517,6 +519,9 @@ public class SignalAccount implements Closeable {
                 throw new IOException("Config file was created by a no longer supported older version!");
             }
             previousStorageVersion = accountVersion;
                 throw new IOException("Config file was created by a no longer supported older version!");
             }
             previousStorageVersion = accountVersion;
+            if (accountVersion < CURRENT_STORAGE_VERSION) {
+                migratedLegacyConfig = true;
+            }
         }
 
         number = Utils.getNotNullNode(rootNode, "username").asText();
         }
 
         number = Utils.getNotNullNode(rootNode, "username").asText();
@@ -616,7 +621,6 @@ public class SignalAccount implements Closeable {
             }
         }
 
             }
         }
 
-        var migratedLegacyConfig = false;
         final var legacySignalProtocolStore = rootNode.hasNonNull("axolotlStore")
                 ? jsonProcessor.convertValue(Utils.getNotNullNode(rootNode, "axolotlStore"),
                 LegacyJsonSignalProtocolStore.class)
         final var legacySignalProtocolStore = rootNode.hasNonNull("axolotlStore")
                 ? jsonProcessor.convertValue(Utils.getNotNullNode(rootNode, "axolotlStore"),
                 LegacyJsonSignalProtocolStore.class)