-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add handle to receive get sync status * add check sync status on fallback
- Loading branch information
1 parent
c0534ea
commit f36a055
Showing
4 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
src/context/virtual-drive/shared/application/PollingMonitorStart.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { MonitorFn, PollingMonitor } from '../domain/PollingMonitor'; | ||
import { ipcRenderer } from 'electron'; | ||
import Logger from 'electron-log'; | ||
|
||
export class PollingMonitorStart { | ||
constructor(private readonly polling: PollingMonitor) {} | ||
run(fn: MonitorFn) { | ||
return this.polling.start(fn); | ||
Logger.info('[SYNC ENGINE] check sync engine'); | ||
|
||
const permission = this.permissionFn.bind(this); | ||
return this.polling.start(fn, permission); | ||
} | ||
|
||
private async permissionFn() { | ||
const isSyncing = await ipcRenderer.invoke('CHECK_SYNC_IN_PROGRESS'); | ||
Logger.info('[SYNC ENGINE] is syncing', isSyncing); | ||
|
||
const isPermitted = !isSyncing; | ||
return isPermitted; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters