Skip to content

Commit

Permalink
chore: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanVicens committed Mar 1, 2024
1 parent 6c25492 commit 327786e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/apps/fuse/callbacks/MakeDirectoryCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class MakeDirectoryCallback extends NotifyFuseCallback {

return this.right();
} catch (throwed: unknown) {
await this.container.syncFolderMessenger.error({
await this.container.syncFolderMessenger.issue({
error: 'FOLDER_CREATE_ERROR',
cause: 'UNKNOWN',
name: basename(path),
Expand Down
2 changes: 1 addition & 1 deletion src/apps/fuse/callbacks/RenameOrMoveFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class RenameOrMoveFolder {

return right(RenameOrMoveFolder.SUCCESS);
} catch (throwed: unknown) {
await this.container.syncFolderMessenger.error({
await this.container.syncFolderMessenger.issue({
error: 'FOLDER_RENAME_ERROR',
cause: 'UNKNOWN',
name: basename(src),
Expand Down
2 changes: 1 addition & 1 deletion src/apps/fuse/callbacks/TrashFolderCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class TrashFolderCallback extends NotifyFuseCallback {

return this.right();
} catch (throwed: unknown) {
await this.container.syncFolderMessenger.error({
await this.container.syncFolderMessenger.issue({
error: 'FOLDER_TRASH_ERROR',
cause: 'UNKNOWN',
name: basename(path),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export interface SyncFolderMessenger {
created(desiredName: string): Promise<void>;
rename(currentName: string, desiredName: string): Promise<void>;
renamed(currentName: string, desiredName: string): Promise<void>;
error(error: VirtualDriveFolderIssue): Promise<void>;
issue(issue: VirtualDriveFolderIssue): Promise<void>;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { SyncEngineIpc } from '../../../../../apps/sync-engine/SyncEngineIpc';
import { VirtualDriveFolderIssue } from '../../../../../shared/issues/VirtualDriveIssue';
import { SyncMessenger } from '../../../../shared/domain/SyncMessenger';
import { SyncFolderMessenger } from '../../domain/SyncFolderMessenger';

export class BackgroundProcessSyncFolderMessenger
extends SyncMessenger
implements SyncFolderMessenger
{
constructor(private readonly ipc: SyncEngineIpc) {
super();
}
constructor(private readonly ipc: SyncEngineIpc) {}

async creating(currentName: string): Promise<void> {
this.ipc.send('FOLDER_CREATING', { name: currentName });
Expand All @@ -19,16 +15,6 @@ export class BackgroundProcessSyncFolderMessenger
this.ipc.send('FOLDER_CREATED', { name: currentName });
}

async errorWhileCreating(
currentName: string,
message: string
): Promise<void> {
this.ipc.send('FOLDER_CREATION_ERROR', {
name: currentName,
error: message,
});
}

async rename(currentName: string, desiredName: string): Promise<void> {
this.ipc.send('FOLDER_RENAMING', {
oldName: currentName,
Expand All @@ -43,23 +29,7 @@ export class BackgroundProcessSyncFolderMessenger
});
}

async errorWhileRenaming(
currentName: string,
desiredName: string,
message: string
): Promise<void> {
this.ipc.send('FOLDER_RENAME_ERROR', {
oldName: currentName,
newName: desiredName,
error: message,
});
}

async errorWhileTrashing(_name: string): Promise<void> {
async issue(_issue: VirtualDriveFolderIssue): Promise<void> {
// TODO: implement
}

error(_error: VirtualDriveFolderIssue): Promise<void> {
throw new Error('Method not implemented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class MainProcessSyncFolderMessenger implements SyncFolderMessenger {
});
}

async error(issue: VirtualDriveFolderIssue): Promise<void> {
async issue(issue: VirtualDriveFolderIssue): Promise<void> {
setTrayStatus('ALERT');

trackVirtualDriveError(issue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class SyncFolderMessengerMock implements SyncFolderMessenger {
public createdMock = jest.fn();
public renameMock = jest.fn();
public renamedMock = jest.fn();
public errorMock = jest.fn();
public issuesMock = jest.fn();

creating(name: string): Promise<void> {
return this.creatingMock(name);
Expand All @@ -24,7 +24,7 @@ export class SyncFolderMessengerMock implements SyncFolderMessenger {
return this.renamedMock(name, newName);
}

error(error: VirtualDriveFolderIssue): Promise<void> {
return this.errorMock(error);
issue(error: VirtualDriveFolderIssue): Promise<void> {
return this.issuesMock(error);
}
}

0 comments on commit 327786e

Please sign in to comment.