Skip to content

Commit 39f7db4

Browse files
FatmeKristianDD
authored andcommitted
Fix PR comments
1 parent c0a1ec3 commit 39f7db4

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
@@ -383,7 +383,7 @@ interface IAndroidLivesyncTool {
383383
* @param configuration - The configuration to the socket connection.
384384
* @returns {Promise<void>}
385385
*/
386-
connect(configuration: ILivesyncToolConfiguration): Promise<void>;
386+
connect(configuration: IAndroidLivesyncToolConfiguration): Promise<void>;
387387
/**
388388
* Sends a file through the socket.
389389
* @param filePath - The full path to the file.
@@ -437,11 +437,26 @@ interface IAndroidLivesyncTool {
437437
end(): void;
438438
}
439439

440-
interface ILivesyncToolConfiguration {
440+
interface IAndroidLivesyncToolConfiguration {
441+
/**
442+
* The application identifier.
443+
*/
441444
appIdentifier: string;
445+
/**
446+
* The device identifier.
447+
*/
442448
deviceIdentifier: string;
443-
appPlatformsPath: string; // path to platforms/android/app/src/main/assets/app/
449+
/**
450+
* The path to app folder inside platforms folder: platforms/android/app/src/main/assets/app/
451+
*/
452+
appPlatformsPath: string;
453+
/**
454+
* If not provided, defaults to 127.0.0.1
455+
*/
444456
localHostAddress?: string;
457+
/**
458+
* If provider will call it when an error occurs.
459+
*/
445460
errorHandler?: any;
446461
}
447462

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)