11///<reference path="../../.d.ts"/>
22"use strict" ;
33
4+ import { AndroidDebugBridge } from "../../common/mobile/android/android-debug-bridge" ;
5+ import { AndroidDeviceHashService } from "../../common/mobile/android/android-device-hash-service" ;
46import Future = require( "fibers/future" ) ;
57import * as helpers from "../../common/helpers" ;
68import liveSyncServiceBaseLib = require( "./livesync-service-base" ) ;
@@ -13,7 +15,9 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
1315 constructor ( _device : Mobile . IDevice ,
1416 private $fs : IFileSystem ,
1517 private $mobileHelper : Mobile . IMobileHelper ,
16- private $options : IOptions ) {
18+ private $options : IOptions ,
19+ private $injector : IInjector ,
20+ private $projectData : IProjectData ) {
1721 super ( _device ) ;
1822 }
1923
@@ -53,9 +57,15 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
5357 let deviceFilePath = this . $mobileHelper . buildDevicePath ( deviceRootPath , "removedsync" , relativeUnixPath ) ;
5458 this . device . adb . executeShellCommand ( [ "mkdir" , "-p" , path . dirname ( deviceFilePath ) , "&&" , "touch" , deviceFilePath ] ) . wait ( ) ;
5559 } ) ;
60+
61+ this . deviceHashService . removeHashes ( localToDevicePaths ) . wait ( ) ;
5662 } ) . future < void > ( ) ( ) ;
5763 }
5864
65+ public afterInstallApplicationAction ( deviceAppData : Mobile . IDeviceAppData , localToDevicePaths : Mobile . ILocalToDevicePathData [ ] ) : IFuture < void > {
66+ return this . deviceHashService . uploadHashFileToDevice ( localToDevicePaths ) ;
67+ }
68+
5969 private getDeviceRootPath ( appIdentifier : string ) : string {
6070 return `/data/local/tmp/${ appIdentifier } ` ;
6171 }
@@ -77,5 +87,15 @@ class AndroidLiveSyncService extends liveSyncServiceBaseLib.LiveSyncServiceBase<
7787
7888 return future ;
7989 }
90+
91+ private _deviceHashService : Mobile . IAndroidDeviceHashService ;
92+ private get deviceHashService ( ) : Mobile . IAndroidDeviceHashService {
93+ if ( ! this . _deviceHashService ) {
94+ let adb = this . $injector . resolve ( AndroidDebugBridge , { identifier : this . device . deviceInfo . identifier } ) ;
95+ this . _deviceHashService = this . $injector . resolve ( AndroidDeviceHashService , { adb : adb , appIdentifier : this . $projectData . projectId } ) ;
96+ }
97+
98+ return this . _deviceHashService ;
99+ }
80100}
81101$injector . register ( "androidLiveSyncServiceLocator" , { factory : AndroidLiveSyncService } ) ;
0 commit comments