Decouple CertificateProvider and adb/idb client intialization

Summary:
Previously CertificateProvider initialized ADB and provided config to IDB. As result, AndroidDeviceManager and iOSDeviceManager indirectly depended on CertificateProvider.

With this diff we:
1. Make idbConfig resemble adbClient.
2. Make AndroidDeviceManager and iOSDeviceManager initialize their own clients
3. Fix server crash when one of the clients couldn't be initialized. The reason for the crash is CertificateProvider.prototype.init which is no longer needed.

Reviewed By: passy

Differential Revision: D33711652

fbshipit-source-id: 055b5625ed993827b65396f4af5157808479242b
This commit is contained in:
Andrey Goncharov
2022-01-26 03:57:46 -08:00
committed by Facebook GitHub Bot
parent 1255621cba
commit da618fd3f3
9 changed files with 101 additions and 72 deletions

View File

@@ -89,10 +89,7 @@ class ServerController extends EventEmitter implements ServerEventsListener {
constructor(flipperServer: FlipperServerImpl) {
super();
this.flipperServer = flipperServer;
this.certificateProvider = new CertificateProvider(
this,
getFlipperServerConfig().settings,
);
this.certificateProvider = new CertificateProvider(this);
this.connectionTracker = new ConnectionTracker(this.logger);
}
@@ -116,7 +113,6 @@ class ServerController extends EventEmitter implements ServerEventsListener {
if (isTest()) {
throw new Error('Spawing new server is not supported in test');
}
await this.certificateProvider.init();
const {insecure, secure} = getServerPortsConfig().serverPorts;
const options = await this.certificateProvider.loadSecureServerConfig();