mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-5540] DesktopSettingsService (#8369)
* WIP: First Try at making DesktopSettingsService Does not work, migrations are ran in renderer but the values are read in main. * Update window$ retrieval * Fix DesktopSettings * Rename Migration * Add Migration to Builder * Cleanup * Update Comments * Update `migrate.ts` * Catch Unawaited Promises * Remove Comments * Update Tests * Rename Migration * Add `alwaysOnTop` * Make `init` async * Fix Desktop Build
This commit is contained in:
@@ -6,6 +6,7 @@ import { app, ipcMain } from "electron";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
|
||||
import { Main } from "../main";
|
||||
import { DesktopSettingsService } from "../platform/services/desktop-settings.service";
|
||||
|
||||
import { MenuUpdateRequest } from "./menu/menu.updater";
|
||||
|
||||
@@ -17,19 +18,16 @@ export class MessagingMain {
|
||||
constructor(
|
||||
private main: Main,
|
||||
private stateService: StateService,
|
||||
private desktopSettingsService: DesktopSettingsService,
|
||||
) {}
|
||||
|
||||
init() {
|
||||
async init() {
|
||||
this.scheduleNextSync();
|
||||
if (process.platform === "linux") {
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.stateService.setOpenAtLogin(fs.existsSync(this.linuxStartupFile()));
|
||||
await this.desktopSettingsService.setOpenAtLogin(fs.existsSync(this.linuxStartupFile()));
|
||||
} else {
|
||||
const loginSettings = app.getLoginItemSettings();
|
||||
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.stateService.setOpenAtLogin(loginSettings.openAtLogin);
|
||||
await this.desktopSettingsService.setOpenAtLogin(loginSettings.openAtLogin);
|
||||
}
|
||||
ipcMain.on("messagingService", async (event: any, message: any) => this.onMessage(message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user