@@ -22,10 +22,10 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
2222 private $projectData : IProjectData ,
2323 $deviceAppDataFactory : Mobile . IDeviceAppDataFactory ,
2424 $logger : ILogger ,
25- private $injector : IInjector ,
25+ $injector : IInjector ,
2626 private $platformService : IPlatformService ,
2727 $dispatcher : IFutureDispatcher ) {
28- super ( $devicesServices , $mobileHelper , $localToDevicePathDataFactory , $logger , $options , $deviceAppDataFactory , $fs , $dispatcher ) ;
28+ super ( $devicesServices , $mobileHelper , $localToDevicePathDataFactory , $logger , $options , $deviceAppDataFactory , $fs , $dispatcher , $injector ) ;
2929 }
3030
3131 public liveSync ( platform : string ) : IFuture < void > {
@@ -50,11 +50,6 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
5050 } ) . future < boolean > ( ) ( ) ;
5151 }
5252
53- let restartAppOnDeviceAction = ( device : Mobile . IDevice , deviceAppData : Mobile . IDeviceAppData , localToDevicePaths ?: Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > => {
54- let platformSpecificUsbLiveSyncService = this . resolveUsbLiveSyncService ( platform || this . $devicesServices . platform , device ) ;
55- return platformSpecificUsbLiveSyncService . restartApplication ( deviceAppData , localToDevicePaths ) ;
56- }
57-
5853 let notInstalledAppOnDeviceAction = ( device : Mobile . IDevice ) : IFuture < void > => {
5954 return this . $platformService . deployOnDevice ( platform ) ;
6055 }
@@ -67,21 +62,13 @@ export class UsbLiveSyncService extends usbLivesyncServiceBaseLib.UsbLiveSyncSer
6762 }
6863
6964 let watchGlob = path . join ( this . $projectData . projectDir , constants . APP_FOLDER_NAME ) + "/**/*" ;
70-
71- this . sync ( platform , this . $projectData . projectId , platformData . appDestinationDirectoryPath , projectFilesPath , this . excludedProjectDirsAndFiles , watchGlob , restartAppOnDeviceAction , notInstalledAppOnDeviceAction , beforeBatchLiveSyncAction , canLiveSyncAction ) . wait ( ) ;
65+ let platformSpecificLiveSyncServices : IDictionary < any > = {
66+ android : AndroidUsbLiveSyncService ,
67+ ios : IOSUsbLiveSyncService
68+ } ;
69+ this . sync ( platform , this . $projectData . projectId , platformData . appDestinationDirectoryPath , projectFilesPath , this . excludedProjectDirsAndFiles , watchGlob , platformSpecificLiveSyncServices , notInstalledAppOnDeviceAction , beforeBatchLiveSyncAction , canLiveSyncAction ) . wait ( ) ;
7270 } ) . future < void > ( ) ( ) ;
7371 }
74-
75- private resolveUsbLiveSyncService ( platform : string , device : Mobile . IDevice ) : IPlatformSpecificUsbLiveSyncService {
76- let platformSpecificUsbLiveSyncService : IPlatformSpecificUsbLiveSyncService = null ;
77- if ( platform . toLowerCase ( ) === "android" ) {
78- platformSpecificUsbLiveSyncService = this . $injector . resolve ( AndroidUsbLiveSyncService , { _device : device } ) ;
79- } else if ( platform . toLowerCase ( ) === "ios" ) {
80- platformSpecificUsbLiveSyncService = this . $injector . resolve ( IOSUsbLiveSyncService , { _device : device } ) ;
81- }
82-
83- return platformSpecificUsbLiveSyncService ;
84- }
8572}
8673$injector . register ( "usbLiveSyncService" , UsbLiveSyncService ) ;
8774
0 commit comments