mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
settings and lock options
This commit is contained in:
24
src/main/powerMonitor.main.ts
Normal file
24
src/main/powerMonitor.main.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { powerMonitor } from 'electron';
|
||||
|
||||
import { ConstantsService } from 'jslib/services/constants.service';
|
||||
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
|
||||
export class PowerMonitorMain {
|
||||
constructor(private storageService: StorageService, private messagingService: MessagingService) { }
|
||||
|
||||
init() {
|
||||
// System sleep
|
||||
powerMonitor.on('suspend', async () => {
|
||||
const lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey);
|
||||
if (lockOption === -3) {
|
||||
this.messagingService.send('lockVault');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: System idle
|
||||
|
||||
// TODO: System locked
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user