Skip to content

Commit 34fe8d4

Browse files
committed
Fix PR comments
1 parent 23b3f9c commit 34fe8d4

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

lib/definitions/livesync.d.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ interface IAndroidLivesyncTool {
377377
* @param configuration - The configuration to the socket connection.
378378
* @returns {Promise<void>}
379379
*/
380-
connect(configuration: ILivesyncToolConfiguration): Promise<void>;
380+
connect(configuration: IAndroidLivesyncToolConfiguration): Promise<void>;
381381
/**
382382
* Sends a file through the socket.
383383
* @param filePath - The full path to the file.
@@ -431,11 +431,26 @@ interface IAndroidLivesyncTool {
431431
end(): void;
432432
}
433433

434-
interface ILivesyncToolConfiguration {
434+
interface IAndroidLivesyncToolConfiguration {
435+
/**
436+
* The application identifier.
437+
*/
435438
appIdentifier: string;
439+
/**
440+
* The device identifier.
441+
*/
436442
deviceIdentifier: string;
437-
appPlatformsPath: string; // path to platforms/android/app/src/main/assets/app/
443+
/**
444+
* The path to app folder inside platforms folder: platforms/android/app/src/main/assets/app/
445+
*/
446+
appPlatformsPath: string;
447+
/**
448+
* If not provided, defaults to 127.0.0.1
449+
*/
438450
localHostAddress?: string;
451+
/**
452+
* If provider will call it when an error occurs.
453+
*/
439454
errorHandler?: any;
440455
}
441456

lib/services/livesync/android-device-livesync-sockets-service.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
7070
if (isFullSync) {
7171
transferredFiles = await this._transferDirectory(deviceAppData, localToDevicePaths, projectFilesPath);
7272
} else {
73-
transferredFiles = await this._transferFiles(deviceAppData, localToDevicePaths, projectFilesPath);
73+
transferredFiles = await this._transferFiles(localToDevicePaths);
7474
}
7575

7676
return transferredFiles;
7777
}
7878

79-
private async _transferFiles(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectFilesPath: string): Promise<Mobile.ILocalToDevicePathData[]> {
79+
private async _transferFiles(localToDevicePaths: Mobile.ILocalToDevicePathData[]): Promise<Mobile.ILocalToDevicePathData[]> {
8080
await this.livesyncTool.sendFiles(localToDevicePaths.map(localToDevicePathData => localToDevicePathData.getLocalPath()));
8181

8282
return localToDevicePaths;
@@ -94,15 +94,11 @@ export class AndroidDeviceSocketsLiveSyncService extends DeviceLiveSyncServiceBa
9494
transferedFiles = localToDevicePaths;
9595
} else {
9696
const changedShasums = deviceHashService.getChnagedShasums(oldShasums, currentShasums);
97-
const changedFiles = _.map(changedShasums, (hash: string, pathToFile: string) => pathToFile);
97+
const changedFiles = _.keys(changedShasums);
9898
if (changedFiles.length) {
9999
await this.livesyncTool.sendFiles(changedFiles);
100100
await deviceHashService.uploadHashFileToDevice(currentShasums);
101-
transferedFiles = localToDevicePaths.filter(localToDevicePathData => {
102-
if (changedFiles.indexOf(localToDevicePathData.getLocalPath()) >= 0) {
103-
return true;
104-
}
105-
});
101+
transferedFiles = localToDevicePaths.filter(localToDevicePathData => changedFiles.indexOf(localToDevicePathData.getLocalPath()) >= 0);
106102
} else {
107103
transferedFiles = [];
108104
}

lib/services/livesync/android-livesync-library.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
1717
private operationPromises: IDictionary<any>;
1818
private socketError: string | Error;
1919
private socketConnection: IDuplexSocket;
20-
private configuration: ILivesyncToolConfiguration;
20+
private configuration: IAndroidLivesyncToolConfiguration;
2121
private appPlatformsPath: string;
2222

2323
constructor(private $androidProcessService: Mobile.IAndroidProcessService,
@@ -30,7 +30,7 @@ export class AndroidLivesyncTool implements IAndroidLivesyncTool {
3030
this.socketConnection = null;
3131
}
3232

33-
public async connect(configuration: ILivesyncToolConfiguration): Promise<void> {
33+
public async connect(configuration: IAndroidLivesyncToolConfiguration): Promise<void> {
3434
if (!configuration.appIdentifier) {
3535
this.$errors.fail(`You need to provide "appIdentifier" as a configuration property!`);
3636
}

0 commit comments

Comments
 (0)