mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
[PM-3680] Remove ipcRenderer from desktop-theming.service (#6478)
This commit is contained in:
parent
67fa1e06d0
commit
3dab77ba9e
@ -1,5 +1,4 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { ipcRenderer } from "electron";
|
|
||||||
|
|
||||||
import { ThemingService } from "@bitwarden/angular/services/theming/theming.service";
|
import { ThemingService } from "@bitwarden/angular/services/theming/theming.service";
|
||||||
import { ThemeType } from "@bitwarden/common/enums";
|
import { ThemeType } from "@bitwarden/common/enums";
|
||||||
@ -7,12 +6,10 @@ import { ThemeType } from "@bitwarden/common/enums";
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class DesktopThemingService extends ThemingService {
|
export class DesktopThemingService extends ThemingService {
|
||||||
protected async getSystemTheme(): Promise<ThemeType> {
|
protected async getSystemTheme(): Promise<ThemeType> {
|
||||||
return await ipcRenderer.invoke("systemTheme");
|
return await ipc.platform.getSystemTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected monitorSystemThemeChanges(): void {
|
protected monitorSystemThemeChanges(): void {
|
||||||
ipcRenderer.on("systemThemeUpdated", (_event, theme: ThemeType) =>
|
ipc.platform.onSystemThemeUpdated((theme: ThemeType) => this.updateSystemTheme(theme));
|
||||||
this.updateSystemTheme(theme)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
|
|
||||||
import { DeviceType } from "@bitwarden/common/enums/device-type.enum";
|
import { DeviceType, ThemeType } from "@bitwarden/common/enums";
|
||||||
|
|
||||||
import { isDev, isWindowsStore } from "../utils";
|
import { isDev, isWindowsStore } from "../utils";
|
||||||
|
|
||||||
@ -12,6 +12,11 @@ export default {
|
|||||||
isDev: isDev(),
|
isDev: isDev(),
|
||||||
isWindowsStore: isWindowsStore(),
|
isWindowsStore: isWindowsStore(),
|
||||||
reloadProcess: () => ipcRenderer.send("reload-process"),
|
reloadProcess: () => ipcRenderer.send("reload-process"),
|
||||||
|
|
||||||
|
getSystemTheme: (): Promise<ThemeType> => ipcRenderer.invoke("systemTheme"),
|
||||||
|
onSystemThemeUpdated: (callback: (theme: ThemeType) => void) => {
|
||||||
|
ipcRenderer.on("systemThemeUpdated", (_event, theme: ThemeType) => callback(theme));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function deviceType(): DeviceType {
|
function deviceType(): DeviceType {
|
||||||
|
Loading…
Reference in New Issue
Block a user