@@ -5,7 +5,7 @@ import * as net from "net";
55
66let currentPageReloadId = 0 ;
77
8- export class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService {
8+ export class IOSDeviceLiveSyncService implements INativeScriptDeviceLiveSyncService {
99 private static BACKEND_PORT = 18181 ;
1010 private socket : net . Socket ;
1111 private device : Mobile . IiOSDevice ;
@@ -35,15 +35,15 @@ export class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService {
3535 if ( this . device . isEmulator ) {
3636 await this . $iOSEmulatorServices . postDarwinNotification ( this . $iOSNotification . getAttachRequest ( projectId ) ) ;
3737 try {
38- this . socket = await helpers . connectEventuallyUntilTimeout ( ( ) => net . connect ( IOSLiveSyncService . BACKEND_PORT ) , 5000 ) ;
38+ this . socket = await helpers . connectEventuallyUntilTimeout ( ( ) => net . connect ( IOSDeviceLiveSyncService . BACKEND_PORT ) , 5000 ) ;
3939 } catch ( e ) {
4040 this . $logger . debug ( e ) ;
4141 return false ;
4242 }
4343 } else {
4444 let timeout = 9000 ;
4545 await this . $iOSSocketRequestExecutor . executeAttachRequest ( this . device , timeout , projectId ) ;
46- this . socket = await this . device . connectToPort ( IOSLiveSyncService . BACKEND_PORT ) ;
46+ this . socket = await this . device . connectToPort ( IOSDeviceLiveSyncService . BACKEND_PORT ) ;
4747 }
4848
4949 this . attachEventHandlers ( ) ;
@@ -55,12 +55,10 @@ export class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService {
5555 await Promise . all ( _ . map ( localToDevicePaths , localToDevicePathData => this . device . fileSystem . deleteFile ( localToDevicePathData . getDevicePath ( ) , appIdentifier ) ) ) ;
5656 }
5757
58- public async refreshApplication (
59- deviceAppData : Mobile . IDeviceAppData ,
60- localToDevicePaths : Mobile . ILocalToDevicePathData [ ] ,
61- forceExecuteFullSync : boolean ,
62- projectData : IProjectData ) : Promise < void > {
63- if ( forceExecuteFullSync ) {
58+ public async refreshApplication ( projectData : IProjectData , liveSyncInfo : ILiveSyncResultInfo ) : Promise < void > {
59+ const deviceAppData = liveSyncInfo . deviceAppData ;
60+ const localToDevicePaths = liveSyncInfo . modifiedFilesData ;
61+ if ( liveSyncInfo . isFullSync ) {
6462 await this . restartApplication ( deviceAppData , projectData . projectName ) ;
6563 return ;
6664 }
@@ -72,7 +70,7 @@ export class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService {
7270 let otherFiles = _ . difference ( localToDevicePaths , _ . concat ( scriptFiles , scriptRelatedFiles ) ) ;
7371 let shouldRestart = _ . some ( otherFiles , ( localToDevicePath : Mobile . ILocalToDevicePathData ) => ! this . $liveSyncProvider . canExecuteFastSync ( localToDevicePath . getLocalPath ( ) , projectData , deviceAppData . platform ) ) ;
7472
75- if ( shouldRestart || ( ! this . $options . liveEdit && scriptFiles . length ) ) {
73+ if ( shouldRestart || ( ! liveSyncInfo . useLiveEdit && scriptFiles . length ) ) {
7674 await this . restartApplication ( deviceAppData , projectData . projectName ) ;
7775 return ;
7876 }
@@ -174,4 +172,4 @@ export class IOSLiveSyncService implements INativeScriptDeviceLiveSyncService {
174172 }
175173 }
176174}
177- $injector . register ( "iosLiveSyncServiceLocator" , { factory : IOSLiveSyncService } ) ;
175+ $injector . register ( "iosLiveSyncServiceLocator" , { factory : IOSDeviceLiveSyncService } ) ;
0 commit comments