+ private final UnidentifiedAccessHelper unidentifiedAccessHelper;
+ private final ProfileHelper profileHelper;
+ private final GroupHelper groupHelper;
+ private final PinHelper pinHelper;
+ private final AvatarStore avatarStore;
+
+ Manager(
+ SignalAccount account,
+ PathConfig pathConfig,
+ SignalServiceConfiguration serviceConfiguration,
+ String userAgent
+ ) {
+ this.account = account;
+ this.pathConfig = pathConfig;
+ this.serviceConfiguration = serviceConfiguration;
+ this.userAgent = userAgent;
+ this.groupsV2Operations = capabilities.isGv2() ? new GroupsV2Operations(ClientZkOperations.create(
+ serviceConfiguration)) : null;
+ final SleepTimer timer = new UptimeSleepTimer();
+ this.accountManager = new SignalServiceAccountManager(serviceConfiguration,
+ new DynamicCredentialsProvider(account.getUuid(),
+ account.getUsername(),
+ account.getPassword(),
+ account.getSignalingKey(),
+ account.getDeviceId()),
+ userAgent,
+ groupsV2Operations,
+ timer);
+ this.groupsV2Api = accountManager.getGroupsV2Api();
+ final KeyBackupService keyBackupService = ServiceConfig.createKeyBackupService(accountManager);
+ this.pinHelper = new PinHelper(keyBackupService);
+ this.clientZkProfileOperations = capabilities.isGv2() ? ClientZkOperations.create(serviceConfiguration)
+ .getProfileOperations() : null;
+ this.messageReceiver = new SignalServiceMessageReceiver(serviceConfiguration,
+ account.getUuid(),
+ account.getUsername(),
+ account.getPassword(),
+ account.getDeviceId(),
+ account.getSignalingKey(),
+ userAgent,
+ null,
+ timer,
+ clientZkProfileOperations);
+
+ this.account.setResolver(this::resolveSignalServiceAddress);
+
+ this.unidentifiedAccessHelper = new UnidentifiedAccessHelper(account::getProfileKey,
+ account.getProfileStore()::getProfileKey,
+ this::getRecipientProfile,
+ this::getSenderCertificate);
+ this.profileHelper = new ProfileHelper(account.getProfileStore()::getProfileKey,
+ unidentifiedAccessHelper::getAccessFor,
+ unidentified -> unidentified ? getOrCreateUnidentifiedMessagePipe() : getOrCreateMessagePipe(),
+ () -> messageReceiver);
+ this.groupHelper = new GroupHelper(this::getRecipientProfileKeyCredential,
+ this::getRecipientProfile,
+ account::getSelfAddress,
+ groupsV2Operations,
+ groupsV2Api,
+ this::getGroupAuthForToday);
+ this.avatarStore = new AvatarStore(pathConfig.getAvatarsPath());