Defer initialization of Android and iOS device managers
Summary: Remove hidden async initialization of adb and idb. Make it explicit. Remove nullable fields in Android and iOS device managers. Reviewed By: lawrencelomax Differential Revision: D33915177 fbshipit-source-id: 882f79310410e0dfde6169abf343ab808644e4a2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fd13399cb9
commit
51ef1810b2
@@ -24,6 +24,7 @@ import invariant from 'invariant';
|
||||
import DummyDevice from '../devices/DummyDevice';
|
||||
import {
|
||||
appNameWithUpdateHint,
|
||||
assertNotNull,
|
||||
cloneClientQuerySafeForLogging,
|
||||
transformCertificateExchangeMediumToType,
|
||||
} from './Utilities';
|
||||
@@ -281,10 +282,12 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
let certificateProvider: CertificateProvider;
|
||||
switch (clientQuery.os) {
|
||||
case 'Android': {
|
||||
assertNotNull(this.flipperServer.android);
|
||||
certificateProvider = this.flipperServer.android.certificateProvider;
|
||||
break;
|
||||
}
|
||||
case 'iOS': {
|
||||
assertNotNull(this.flipperServer.ios);
|
||||
certificateProvider = this.flipperServer.ios.certificateProvider;
|
||||
|
||||
if (medium === 'WWW') {
|
||||
@@ -377,6 +380,7 @@ class ServerController extends EventEmitter implements ServerEventsListener {
|
||||
// For Android, device id might change
|
||||
if (csr_path && csr && query.os === 'Android') {
|
||||
const app_name = await extractAppNameFromCSR(csr);
|
||||
assertNotNull(this.flipperServer.android);
|
||||
// TODO: allocate new object, kept now as is to keep changes minimal
|
||||
(query as any).device_id =
|
||||
await this.flipperServer.android.certificateProvider.getTargetDeviceId(
|
||||
|
||||
Reference in New Issue
Block a user