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;
if (account.getProfileKey() == null) {
// Old config file, creating new profile key
account.setProfileKey(KeyUtils.createProfileKey());
+ account.save();
}
}
account.setPassword(KeyUtils.createPassword());
accountManager = new SignalServiceAccountManager(BaseConfig.serviceConfiguration, account.getUsername(), account.getPassword(), BaseConfig.USER_AGENT, timer);
- if (voiceVerification)
- accountManager.requestVoiceVerificationCode();
- else
- accountManager.requestSmsVerificationCode();
+ if (voiceVerification) {
+ accountManager.requestVoiceVerificationCode(Locale.getDefault());
+ } else {
+ accountManager.requestSmsVerificationCode(false);
+ }
account.setRegistered(false);
account.save();
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 (c.getExpirationTimer().isPresent()) {
ThreadInfo thread = account.getThreadStore().getThread(c.getNumber());
+ if (thread == null) {
+ thread = new ThreadInfo();
+ thread.id = c.getNumber();
+ }
thread.messageExpirationTime = c.getExpirationTimer().get();
account.getThreadStore().updateThread(thread);
}