account = SignalAccount.createOrUpdateLinkedAccount(pathConfig.dataPath(),
accountPath,
number,
+ serviceEnvironmentConfig.getType(),
aci,
pni,
password,
final var accountPathFinal = accountPath;
m = new ManagerImpl(account,
pathConfig,
- (newNumber, newAci) -> accountsStore.updateAccount(accountPathFinal, newNumber, newAci),
+ new AccountFileUpdaterImpl(accountsStore, accountPathFinal),
serviceEnvironmentConfig,
userAgent);
account = null;
}
try (signalAccount) {
- if (signalAccount.isMasterDevice()) {
- logger.debug("Account is a master device.");
+ if (signalAccount.isPrimaryDevice()) {
+ logger.debug("Account is a primary device.");
+ return false;
+ }
+ if (signalAccount.isRegistered()
+ && signalAccount.getServiceEnvironment() != null
+ && signalAccount.getServiceEnvironment() != serviceEnvironmentConfig.getType()) {
+ logger.debug("Account is registered in another environment: {}.",
+ signalAccount.getServiceEnvironment());
return false;
}
final var m = new ManagerImpl(signalAccount,
pathConfig,
- (newNumber, newAci) -> accountsStore.updateAccount(accountPath, newNumber, newAci),
+ new AccountFileUpdaterImpl(accountsStore, accountPath),
serviceEnvironmentConfig,
userAgent);
try (m) {