22"use strict" ;
33
44import * as constants from "../../constants" ;
5+ import * as helpers from "../../common/helpers" ;
56import * as path from "path" ;
67import * as semver from "semver" ;
78
89class LiveSyncService implements ILiveSyncService {
10+ public forceExecuteFullSync = false ;
911 private _isInitialized = false ;
1012
1113 constructor ( private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
@@ -15,7 +17,8 @@ class LiveSyncService implements ILiveSyncService {
1517 private $platformService : IPlatformService ,
1618 private $projectData : IProjectData ,
1719 private $projectDataService : IProjectDataService ,
18- private $prompter : IPrompter ) { }
20+ private $prompter : IPrompter ,
21+ private $injector : IInjector ) { }
1922
2023 private ensureAndroidFrameworkVersion ( platformData : IPlatformData ) : IFuture < void > { // TODO: this can be moved inside command or canExecute function
2124 return ( ( ) => {
@@ -50,15 +53,22 @@ class LiveSyncService implements ILiveSyncService {
5053
5154 this . _isInitialized = true ; // If we want before-prepare hooks to work properly, this should be set after preparePlatform function
5255
53- let platformData = this . $platformsData . getPlatformData ( platformLowerCase ) ;
54- this . ensureAndroidFrameworkVersion ( platformData ) . wait ( ) ;
56+ this . liveSyncCore ( platform ) . wait ( ) ;
57+ } ) . future < void > ( ) ( ) ;
58+ }
5559
60+ @helpers . hook ( 'livesync' )
61+ private liveSyncCore ( platform : string ) : IFuture < void > {
62+ return ( ( ) => {
63+ let platformData = this . $platformsData . getPlatformData ( platform . toLowerCase ( ) ) ;
64+ this . ensureAndroidFrameworkVersion ( platformData ) . wait ( ) ;
5665 let liveSyncData : ILiveSyncData = {
5766 platform : platform ,
58- appIdentifier : this . $projectData . projectId ,
67+ appIdentifier : this . $projectData . projectId ,
5968 projectFilesPath : path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ,
6069 syncWorkingDirectory : path . join ( this . $projectData . projectDir , constants . APP_FOLDER_NAME ) ,
61- excludedProjectDirsAndFiles : constants . LIVESYNC_EXCLUDED_FILE_PATTERNS
70+ excludedProjectDirsAndFiles : constants . LIVESYNC_EXCLUDED_FILE_PATTERNS ,
71+ forceExecuteFullSync : this . forceExecuteFullSync
6272 } ;
6373 this . $liveSyncServiceBase . sync ( liveSyncData ) . wait ( ) ;
6474 } ) . future < void > ( ) ( ) ;
0 commit comments