Inject deps
This commit is contained in:
parent
e9c6f99df2
commit
e83539bb48
1 changed files with 17 additions and 7 deletions
|
|
@ -14,6 +14,7 @@ import { Syncer } from "./sync-operations/syncer";
|
||||||
import type { FileSystemOperations } from "./file-operations/filesystem-operations";
|
import type { FileSystemOperations } from "./file-operations/filesystem-operations";
|
||||||
import { FileOperations } from "./file-operations/file-operations";
|
import { FileOperations } from "./file-operations/file-operations";
|
||||||
import { ConnectionStatus } from "./services/connection-status";
|
import { ConnectionStatus } from "./services/connection-status";
|
||||||
|
import { UnrestrictedSyncer } from "./sync-operations/unrestricted-syncer";
|
||||||
|
|
||||||
export class SyncClient {
|
export class SyncClient {
|
||||||
private remoteListenerIntervalId: NodeJS.Timeout | null = null;
|
private remoteListenerIntervalId: NodeJS.Timeout | null = null;
|
||||||
|
|
@ -41,11 +42,6 @@ export class SyncClient {
|
||||||
|
|
||||||
if (newSettings.vaultName !== oldSettings.vaultName) {
|
if (newSettings.vaultName !== oldSettings.vaultName) {
|
||||||
void this.reset();
|
void this.reset();
|
||||||
} else if (
|
|
||||||
newSettings.isSyncEnabled &&
|
|
||||||
!oldSettings.isSyncEnabled
|
|
||||||
) {
|
|
||||||
void this.start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -111,13 +107,27 @@ export class SyncClient {
|
||||||
const connectionStatus = new ConnectionStatus(settings, logger);
|
const connectionStatus = new ConnectionStatus(settings, logger);
|
||||||
const syncService = new SyncService(connectionStatus, settings, logger);
|
const syncService = new SyncService(connectionStatus, settings, logger);
|
||||||
syncService.fetchImplementation = fetch;
|
syncService.fetchImplementation = fetch;
|
||||||
|
const fileOperations = new FileOperations(
|
||||||
|
logger,
|
||||||
|
database,
|
||||||
|
fs,
|
||||||
|
nativeLineEndings
|
||||||
|
);
|
||||||
|
const unrestrictedSyncer = new UnrestrictedSyncer(
|
||||||
|
logger,
|
||||||
|
database,
|
||||||
|
settings,
|
||||||
|
syncService,
|
||||||
|
fileOperations,
|
||||||
|
history
|
||||||
|
);
|
||||||
const syncer = new Syncer(
|
const syncer = new Syncer(
|
||||||
logger,
|
logger,
|
||||||
database,
|
database,
|
||||||
settings,
|
settings,
|
||||||
syncService,
|
syncService,
|
||||||
new FileOperations(logger, database, fs, nativeLineEndings),
|
fileOperations,
|
||||||
history
|
unrestrictedSyncer
|
||||||
);
|
);
|
||||||
|
|
||||||
const client = new SyncClient(
|
const client = new SyncClient(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue