66 private $childProcess : IChildProcess ,
77 private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
88 private $config : IConfiguration ,
9+ private $usbLiveSyncService : ILiveSyncService ,
910 protected $options : IOptions ) { }
1011
1112 execute ( args : string [ ] ) : IFuture < void > {
1213 if ( ! this . $options . rebuild && ! this . $options . start ) {
1314 this . $config . debugLivesync = true ;
14- let usbLiveSyncService : ILiveSyncService = this . $injector . resolve ( "usbLiveSyncService" ) ;
15- let liveSyncServiceBase : any = this . $injector . resolve ( "liveSyncServiceBase" ) ;
16- let liveSyncProvider : ILiveSyncProvider = this . $injector . resolve ( "liveSyncProvider " ) ;
15+ let applicationReloadAction = ( deviceAppData : Mobile . IDeviceAppData , localToDevicePaths : Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > => {
16+ return ( ( ) => {
17+ let projectData : IProjectData = this . $injector . resolve ( "projectData " ) ;
1718
18- liveSyncServiceBase . on ( "sync" , ( device : Mobile . IDevice , data : ILiveSyncData ) => {
19- let platformLiveSyncService : IPlatformLiveSyncService = this . $injector . resolve ( liveSyncProvider . platformSpecificLiveSyncServices [ data . platform . toLowerCase ( ) ] , { _device : device } ) ;
20- let projectData : IProjectData = this . $injector . resolve ( "projectData" ) ;
21- let appId = device . isEmulator ? projectData . projectName : data . appIdentifier ;
22- if ( data . platform === this . $devicePlatformsConstants . iOS ) {
23- platformLiveSyncService . debugService . debugStop ( ) . wait ( ) ;
24- }
25- device . applicationManager . stopApplication ( appId ) . wait ( ) ;
26- platformLiveSyncService . debugService . debug ( ) . wait ( ) ;
27- } ) ;
19+ this . debugService . debugStop ( ) . wait ( ) ;
2820
29- liveSyncServiceBase . on ( "syncAfterInstall" , ( device : Mobile . IDevice , data : ILiveSyncData ) => {
30- let platformLiveSyncService : IPlatformLiveSyncService = this . $injector . resolve ( liveSyncProvider . platformSpecificLiveSyncServices [ data . platform . toLowerCase ( ) ] , { _device : device } ) ;
31- platformLiveSyncService . debugService . debug ( ) . wait ( ) ;
32- } ) ;
21+ let applicationId = deviceAppData . device . isEmulator ? projectData . projectName : deviceAppData . appIdentifier ;
22+ deviceAppData . device . applicationManager . stopApplication ( applicationId ) . wait ( ) ;
3323
34- return usbLiveSyncService . liveSync ( this . $devicesService . platform ) ;
24+ this . debugService . debug ( ) . wait ( ) ;
25+ } ) . future < void > ( ) ( ) ;
26+ } ;
27+
28+ return this . $usbLiveSyncService . liveSync ( this . $devicesService . platform , applicationReloadAction ) ;
3529 }
3630 return this . debugService . debug ( ) ;
3731 }
@@ -66,8 +60,9 @@ export class DebugIOSCommand extends DebugPlatformCommand {
6660 $childProcess : IChildProcess ,
6761 $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
6862 $config : IConfiguration ,
63+ $usbLiveSyncService : ILiveSyncService ,
6964 $options : IOptions ) {
70- super ( $iOSDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $options ) ;
65+ super ( $iOSDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $ options) ;
7166 }
7267}
7368$injector . registerCommand ( "debug|ios" , DebugIOSCommand ) ;
@@ -78,10 +73,11 @@ export class DebugAndroidCommand extends DebugPlatformCommand {
7873 $injector : IInjector ,
7974 $logger : ILogger ,
8075 $childProcess : IChildProcess ,
81- $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
76+ $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
8277 $config : IConfiguration ,
78+ $usbLiveSyncService : ILiveSyncService ,
8379 $options : IOptions ) {
84- super ( $androidDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $options ) ;
80+ super ( $androidDebugService , $devicesService , $injector , $logger , $childProcess , $devicePlatformsConstants , $config , $usbLiveSyncService , $ options) ;
8581 }
8682}
8783$injector . registerCommand ( "debug|android" , DebugAndroidCommand ) ;
0 commit comments