mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Store device name in account file and prevent it from becoming null on the server
This commit is contained in:
parent
a4e34e600e
commit
6eb486e858
3 changed files with 15 additions and 1 deletions
|
@ -341,7 +341,8 @@ public class Manager implements Closeable {
|
|||
}
|
||||
|
||||
public void updateAccountAttributes() throws IOException {
|
||||
accountManager.setAccountAttributes(null,
|
||||
accountManager.setAccountAttributes(account.getDeviceName(),
|
||||
null,
|
||||
account.getLocalRegistrationId(),
|
||||
true,
|
||||
// set legacy pin only if no KBS master key is set
|
||||
|
|
|
@ -113,6 +113,7 @@ public class ProvisioningManager {
|
|||
number,
|
||||
ret.getUuid(),
|
||||
password,
|
||||
deviceName,
|
||||
deviceId,
|
||||
ret.getIdentity(),
|
||||
registrationId,
|
||||
|
|
|
@ -74,6 +74,7 @@ public class SignalAccount implements Closeable {
|
|||
|
||||
private String username;
|
||||
private UUID uuid;
|
||||
private String deviceName;
|
||||
private int deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||
private boolean isMultiDevice = false;
|
||||
private String password;
|
||||
|
@ -171,6 +172,7 @@ public class SignalAccount implements Closeable {
|
|||
String username,
|
||||
UUID uuid,
|
||||
String password,
|
||||
String deviceName,
|
||||
int deviceId,
|
||||
IdentityKeyPair identityKey,
|
||||
int registrationId,
|
||||
|
@ -189,6 +191,7 @@ public class SignalAccount implements Closeable {
|
|||
account.uuid = uuid;
|
||||
account.password = password;
|
||||
account.profileKey = profileKey;
|
||||
account.deviceName = deviceName;
|
||||
account.deviceId = deviceId;
|
||||
|
||||
account.initStores(dataPath, identityKey, registrationId);
|
||||
|
@ -303,6 +306,9 @@ public class SignalAccount implements Closeable {
|
|||
throw new IOException("Config file contains an invalid uuid, needs to be a valid UUID", e);
|
||||
}
|
||||
}
|
||||
if (rootNode.hasNonNull("deviceName")) {
|
||||
deviceName = rootNode.get("deviceName").asText();
|
||||
}
|
||||
if (rootNode.hasNonNull("deviceId")) {
|
||||
deviceId = rootNode.get("deviceId").asInt();
|
||||
}
|
||||
|
@ -573,6 +579,7 @@ public class SignalAccount implements Closeable {
|
|||
rootNode.put("version", CURRENT_STORAGE_VERSION)
|
||||
.put("username", username)
|
||||
.put("uuid", uuid == null ? null : uuid.toString())
|
||||
.put("deviceName", deviceName)
|
||||
.put("deviceId", deviceId)
|
||||
.put("isMultiDevice", isMultiDevice)
|
||||
.put("password", password)
|
||||
|
@ -701,6 +708,10 @@ public class SignalAccount implements Closeable {
|
|||
return recipientStore.resolveRecipientTrusted(getSelfAddress());
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public int getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
@ -812,6 +823,7 @@ public class SignalAccount implements Closeable {
|
|||
|
||||
public void finishRegistration(final UUID uuid, final MasterKey masterKey, final String pin) {
|
||||
this.pinMasterKey = masterKey;
|
||||
this.deviceName = null;
|
||||
this.deviceId = SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||
this.isMultiDevice = false;
|
||||
this.registered = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue