1
1
import { DeviceAndroidDebugBridge } from "../../common/mobile/android/device-android-debug-bridge" ;
2
2
import { AndroidDeviceHashService } from "../../common/mobile/android/android-device-hash-service" ;
3
+ import { DeviceLiveSyncServiceBase } from "./device-livesync-service-base" ;
3
4
import * as helpers from "../../common/helpers" ;
4
5
import { SYNC_DIR_NAME , FULLSYNC_DIR_NAME , REMOVEDSYNC_DIR_NAME } from "../../constants" ;
5
6
import { cache } from "../../common/decorators" ;
6
7
import * as path from "path" ;
7
8
import * as net from "net" ;
8
- import { EOL } from "os" ;
9
-
10
- export class AndroidDeviceLiveSyncService implements IAndroidNativeScriptDeviceLiveSyncService {
11
- private static FAST_SYNC_FILE_EXTENSIONS = [ ".css" , ".xml" , ".html" ] ;
12
9
10
+ export class AndroidDeviceLiveSyncService extends DeviceLiveSyncServiceBase implements IAndroidNativeScriptDeviceLiveSyncService {
13
11
private static BACKEND_PORT = 18182 ;
14
12
private device : Mobile . IAndroidDevice ;
15
13
16
14
constructor ( _device : Mobile . IDevice ,
17
15
private $mobileHelper : Mobile . IMobileHelper ,
18
16
private $injector : IInjector ,
19
- private $logger : ILogger ,
20
- private $androidDebugService : IPlatformDebugService ,
21
- private $platformsData : IPlatformsData ) {
17
+ protected $platformsData : IPlatformsData ) {
18
+ super ( $platformsData ) ;
22
19
this . device = < Mobile . IAndroidDevice > ( _device ) ;
23
20
}
24
21
25
- public get debugService ( ) : IPlatformDebugService {
26
- return this . $androidDebugService ;
27
- }
28
-
29
22
public async refreshApplication ( projectData : IProjectData , liveSyncInfo : ILiveSyncResultInfo ) : Promise < void > {
30
23
const deviceAppData = liveSyncInfo . deviceAppData ;
31
24
const localToDevicePaths = liveSyncInfo . modifiedFilesData ;
@@ -38,7 +31,7 @@ export class AndroidDeviceLiveSyncService implements IAndroidNativeScriptDeviceL
38
31
`/data/local/tmp/${ deviceAppData . appIdentifier } /sync` ]
39
32
) ;
40
33
41
- let canExecuteFastSync = ! liveSyncInfo . isFullSync && ! _ . some ( localToDevicePaths ,
34
+ const canExecuteFastSync = ! liveSyncInfo . isFullSync && ! _ . some ( localToDevicePaths ,
42
35
( localToDevicePath : Mobile . ILocalToDevicePathData ) => ! this . canExecuteFastSync ( localToDevicePath . getLocalPath ( ) , projectData , this . device . deviceInfo . platform ) ) ;
43
36
44
37
if ( canExecuteFastSync ) {
@@ -48,25 +41,6 @@ export class AndroidDeviceLiveSyncService implements IAndroidNativeScriptDeviceL
48
41
return this . restartApplication ( deviceAppData ) ;
49
42
}
50
43
51
- @cache ( )
52
- private getFastLiveSyncFileExtensions ( platform : string , projectData : IProjectData ) : string [ ] {
53
- const platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
54
- const fastSyncFileExtensions = AndroidDeviceLiveSyncService . FAST_SYNC_FILE_EXTENSIONS . concat ( platformData . fastLivesyncFileExtensions ) ;
55
- return fastSyncFileExtensions ;
56
- }
57
-
58
- public canExecuteFastSync ( filePath : string , projectData : IProjectData , platform : string ) : boolean {
59
- console . log ( "called canExecuteFastSync for file: " , filePath ) ;
60
- const fastSyncFileExtensions = this . getFastLiveSyncFileExtensions ( platform , projectData ) ;
61
- return _ . includes ( fastSyncFileExtensions , path . extname ( filePath ) ) ;
62
- }
63
-
64
- protected printDebugInformation ( information : string [ ] ) : void {
65
- _ . each ( information , i => {
66
- this . $logger . info ( `To start debugging, open the following URL in Chrome:${ EOL } ${ i } ${ EOL } ` . cyan ) ;
67
- } ) ;
68
- }
69
-
70
44
private async restartApplication ( deviceAppData : Mobile . IDeviceAppData ) : Promise < void > {
71
45
let devicePathRoot = `/data/data/${ deviceAppData . appIdentifier } /files` ;
72
46
let devicePath = this . $mobileHelper . buildDevicePath ( devicePathRoot , "code_cache" , "secondary_dexes" , "proxyThumb" ) ;
0 commit comments