This repository was archived by the owner on Feb 2, 2021. It is now read-only.
File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ declare module Mobile {
283
283
checkDependencies ( ) : IFuture < void > ;
284
284
checkAvailability ( dependsOnProject ?: boolean ) : IFuture < void > ;
285
285
startEmulator ( app : string , emulatorOptions ?: IEmulatorOptions ) : IFuture < void > ;
286
+ getEmulatorId ?( ) : IFuture < string > ;
286
287
}
287
288
288
289
interface IiOSSimulatorService extends IEmulatorPlatformServices {
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ class AndroidEmulatorServices implements Mobile.IEmulatorPlatformServices {
45
45
this . adbFilePath = this . $staticConfig . getAdbFilePath ( ) . wait ( ) ;
46
46
}
47
47
48
+ public getEmulatorId ( ) : IFuture < string > {
49
+ return ( ( ) => {
50
+ let image = this . getEmulatorImage ( ) . wait ( ) ;
51
+ if ( ! image ) {
52
+ this . $errors . fail ( "Could not find an emulator image to run your project." ) ;
53
+ }
54
+
55
+ let emulatorId = this . startEmulatorInstance ( image ) . wait ( ) ;
56
+ return emulatorId ;
57
+ } ) . future < string > ( ) ( ) ;
58
+ }
59
+
48
60
public checkDependencies ( ) : IFuture < void > {
49
61
return ( ( ) => {
50
62
this . checkAndroidSDKConfiguration ( ) . wait ( ) ;
@@ -77,6 +89,13 @@ class AndroidEmulatorServices implements Mobile.IEmulatorPlatformServices {
77
89
} ) . future < void > ( ) ( ) ;
78
90
}
79
91
92
+ private getEmulatorImage ( ) : IFuture < string > {
93
+ return ( ( ) => {
94
+ let image = this . $options . avd || this . $options . geny || this . getBestFit ( ) . wait ( ) ;
95
+ return image ;
96
+ } ) . future < string > ( ) ( ) ;
97
+ }
98
+
80
99
public checkAvailability ( ) : IFuture < void > {
81
100
return ( ( ) => {
82
101
let platform = this . $devicePlatformsConstants . Android ;
@@ -92,7 +111,7 @@ class AndroidEmulatorServices implements Mobile.IEmulatorPlatformServices {
92
111
this . $errors . fail ( "You cannot specify both --avd and --geny options. Please use only one of them." ) ;
93
112
}
94
113
95
- let image = this . $options . avd || this . $options . geny || this . getBestFit ( ) . wait ( ) ;
114
+ let image = this . getEmulatorImage ( ) . wait ( ) ;
96
115
if ( image ) {
97
116
this . startEmulatorCore ( app , emulatorOptions . appId , image ) . wait ( ) ;
98
117
} else {
You can’t perform that action at this time.
0 commit comments