Skip to content

Commit

Permalink
Revert "Hopefully working now pff"
Browse files Browse the repository at this point in the history
This reverts commit 76c9717.
  • Loading branch information
digimezzo committed Sep 20, 2024
1 parent 76c9717 commit d0d666d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
20 changes: 9 additions & 11 deletions main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ try {
}
});

ipcMain.on('clear-file-queue', (event: any, arg: any) => {
log.error('[Main] [clear-file-queue] Clearing file queue');
ipcMain.on('arguments-processed', (event: any, arg: any) => {
log.error('[Main] [arguments-processed] Clearing file queue');
globalAny.fileQueue = [];
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/services/file/file.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ describe('FileService', () => {
it('should return true if there is at least 1 playable file as parameter', () => {
// Arrange
applicationMock.setup((x) => x.getParameters()).returns(() => ['file 1.png', 'file 2.ogg', 'file 3.bmp']);
applicationMock.setup((x) => x.getGlobal('fileQueue')).returns(() => []);
const service: FileServiceBase = createService();

// Act
Expand All @@ -196,7 +195,6 @@ describe('FileService', () => {

it('should return false if there are no playable files as parameters', () => {
applicationMock.setup((x) => x.getParameters()).returns(() => ['file 1.png', 'file 2.mkv', 'file 3.bmp']);
applicationMock.setup((x) => x.getGlobal('fileQueue')).returns(() => []);

// Arrange
const service: FileServiceBase = createService();
Expand Down
16 changes: 5 additions & 11 deletions src/app/services/file/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ export class FileService implements FileServiceBase {
}

public hasPlayableFilesAsParameters(): boolean {
const parameters: string[] = this.getParameters();
const parameters: string[] = this.application.getParameters();

return this.hasPlayableFilesAsGivenParameters(parameters);
}

public async enqueueParameterFilesAsync(): Promise<void> {
const parameters: string[] = this.getParameters();
this.ipcProxy.sendToMainProcess('clear-file-queue', undefined);
const parameters: string[] = this.application.getParameters();
const fileQueue: string[] = this.application.getGlobal('fileQueue') as string[];
parameters.push(...fileQueue);
this.ipcProxy.sendToMainProcess('arguments-processed', undefined);
await this.enqueueGivenParameterFilesAsync(parameters);
}

Expand Down Expand Up @@ -99,12 +101,4 @@ export class FileService implements FileServiceBase {
this.logger.error(e, 'Could not enqueue given parameter files', 'FileService', 'enqueueGivenParameterFilesAsync');
}
}

private getParameters(): string[] {
const parameters: string[] = this.application.getParameters();
const fileQueue: string[] = this.application.getGlobal('fileQueue') as string[];
parameters.push(...fileQueue);

return parameters;
}
}

0 comments on commit d0d666d

Please sign in to comment.