private static final Logger logger = LoggerFactory.getLogger(MultiAccountManager.class);
private final PathConfig pathConfig;
+ private final ServiceEnvironment serviceEnvironment;
private final ServiceEnvironmentConfig serviceEnvironmentConfig;
private final String userAgent;
private final TrustNewIdentity trustNewIdentity;
final TrustNewIdentity trustNewIdentity
) throws IOException {
this.pathConfig = PathConfig.createDefault(settingsPath);
- this.serviceEnvironmentConfig = ServiceConfig.getServiceEnvironmentConfig(serviceEnvironment, userAgent);
+ this.serviceEnvironment = serviceEnvironment;
+ this.serviceEnvironmentConfig = ServiceConfig.getServiceEnvironmentConfig(this.serviceEnvironment, userAgent);
this.userAgent = userAgent;
this.trustNewIdentity = trustNewIdentity;
this.accountsStore = new AccountsStore(pathConfig.dataPath());
throw new NotRegisteredException();
}
+ if (account.getServiceEnvironment() != null && account.getServiceEnvironment() != serviceEnvironment) {
+ throw new IOException("Account is registered in another environment: " + account.getServiceEnvironment());
+ }
+
account.initDatabase();
final var manager = new ManagerImpl(account,
throw new AccountCheckException("Error while checking account " + number + ": " + e.getMessage(), e);
}
+ if (account.getServiceEnvironment() == null) {
+ account.setServiceEnvironment(serviceEnvironment);
+ }
+
return manager;
}
var account = SignalAccount.create(pathConfig.dataPath(),
newAccountPath,
number,
+ serviceEnvironment,
aciIdentityKey,
pniIdentityKey,
registrationId,