2
2
"use strict" ;
3
3
4
4
import * as constants from "../../constants" ;
5
+ import * as helpers from "../../common/helpers" ;
5
6
import * as path from "path" ;
6
7
import * as semver from "semver" ;
7
8
8
9
class LiveSyncService implements ILiveSyncService {
10
+ public forceExecuteFullSync = false ;
9
11
private _isInitialized = false ;
10
12
11
13
constructor ( private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
@@ -15,7 +17,8 @@ class LiveSyncService implements ILiveSyncService {
15
17
private $platformService : IPlatformService ,
16
18
private $projectData : IProjectData ,
17
19
private $projectDataService : IProjectDataService ,
18
- private $prompter : IPrompter ) { }
20
+ private $prompter : IPrompter ,
21
+ private $injector : IInjector ) { }
19
22
20
23
private ensureAndroidFrameworkVersion ( platformData : IPlatformData ) : IFuture < void > { // TODO: this can be moved inside command or canExecute function
21
24
return ( ( ) => {
@@ -50,15 +53,22 @@ class LiveSyncService implements ILiveSyncService {
50
53
51
54
this . _isInitialized = true ; // If we want before-prepare hooks to work properly, this should be set after preparePlatform function
52
55
53
- let platformData = this . $platformsData . getPlatformData ( platformLowerCase ) ;
54
- this . ensureAndroidFrameworkVersion ( platformData ) . wait ( ) ;
56
+ this . liveSyncCore ( platform ) . wait ( ) ;
57
+ } ) . future < void > ( ) ( ) ;
58
+ }
55
59
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 ( ) ;
56
65
let liveSyncData : ILiveSyncData = {
57
66
platform : platform ,
58
- appIdentifier : this . $projectData . projectId ,
67
+ appIdentifier : this . $projectData . projectId ,
59
68
projectFilesPath : path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ,
60
69
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
62
72
} ;
63
73
this . $liveSyncServiceBase . sync ( liveSyncData ) . wait ( ) ;
64
74
} ) . future < void > ( ) ( ) ;
0 commit comments