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 {
accountManager.addDevice(deviceIdentifier, deviceKey, identityKeyPair, Optional.of(account.getProfileKey()), verificationCode);
account.setMultiDevice(true);
+ account.save();
}
private List<PreKeyRecord> generatePreKeys() {
if (node != null) {
deviceId = node.asInt();
}
+ if (rootNode.has("isMultiDevice")) isMultiDevice = Util.getNotNullNode(rootNode, "isMultiDevice").asBoolean();
username = Util.getNotNullNode(rootNode, "username").asText();
password = Util.getNotNullNode(rootNode, "password").asText();
JsonNode pinNode = rootNode.get("registrationLockPin");
- registrationLockPin = pinNode == null ? null : pinNode.asText();
+ registrationLockPin = pinNode == null || pinNode.isNull() ? null : pinNode.asText();
if (rootNode.has("signalingKey")) {
signalingKey = Util.getNotNullNode(rootNode, "signalingKey").asText();
}
ObjectNode rootNode = jsonProcessor.createObjectNode();
rootNode.put("username", username)
.put("deviceId", deviceId)
+ .put("isMultiDevice", isMultiDevice)
.put("password", password)
.put("registrationLockPin", registrationLockPin)
.put("signalingKey", signalingKey)
.put("preKeyIdOffset", preKeyIdOffset)
.put("nextSignedPreKeyId", nextSignedPreKeyId)
+ .put("profileKey", Base64.encodeBytes(profileKey))
.put("registered", registered)
.putPOJO("axolotlStore", signalProtocolStore)
.putPOJO("groupStore", groupStore)