mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Refactor Manager and SignalAccount to implement Closeable
Should make sure that file lock and web socket connections are closed reliably.
This commit is contained in:
parent
87f65de0c5
commit
d520023fc7
4 changed files with 224 additions and 164 deletions
|
@ -83,19 +83,22 @@ public class ProvisioningManager {
|
|||
throw new IOException("Received invalid profileKey", e);
|
||||
}
|
||||
}
|
||||
SignalAccount account = SignalAccount.createLinkedAccount(pathConfig.getDataPath(), username, ret.getUuid(), password, ret.getDeviceId(), ret.getIdentity(), registrationId, signalingKey, profileKey);
|
||||
account.save();
|
||||
|
||||
Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent);
|
||||
try (SignalAccount account = SignalAccount.createLinkedAccount(pathConfig.getDataPath(), username, ret.getUuid(), password, ret.getDeviceId(), ret.getIdentity(), registrationId, signalingKey, profileKey)) {
|
||||
account.save();
|
||||
|
||||
m.refreshPreKeys();
|
||||
try (Manager m = new Manager(account, pathConfig, serviceConfiguration, userAgent)) {
|
||||
|
||||
m.requestSyncGroups();
|
||||
m.requestSyncContacts();
|
||||
m.requestSyncBlocked();
|
||||
m.requestSyncConfiguration();
|
||||
m.refreshPreKeys();
|
||||
|
||||
m.saveAccount();
|
||||
m.requestSyncGroups();
|
||||
m.requestSyncContacts();
|
||||
m.requestSyncBlocked();
|
||||
m.requestSyncConfiguration();
|
||||
|
||||
m.saveAccount();
|
||||
}
|
||||
}
|
||||
|
||||
return username;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue