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 { ipcRenderer } from "electron";
|
||||
|
||||
import { ThemingService } from "@bitwarden/angular/services/theming/theming.service";
|
||||
import { ThemeType } from "@bitwarden/common/enums";
|
||||
@ -7,12 +6,10 @@ import { ThemeType } from "@bitwarden/common/enums";
|
||||
@Injectable()
|
||||
export class DesktopThemingService extends ThemingService {
|
||||
protected async getSystemTheme(): Promise<ThemeType> {
|
||||
return await ipcRenderer.invoke("systemTheme");
|
||||
return await ipc.platform.getSystemTheme();
|
||||
}
|
||||
|
||||
protected monitorSystemThemeChanges(): void {
|
||||
ipcRenderer.on("systemThemeUpdated", (_event, theme: ThemeType) =>
|
||||
this.updateSystemTheme(theme)
|
||||
);
|
||||
ipc.platform.onSystemThemeUpdated((theme: ThemeType) => this.updateSystemTheme(theme));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
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";
|
||||
|
||||
@ -12,6 +12,11 @@ export default {
|
||||
isDev: isDev(),
|
||||
isWindowsStore: isWindowsStore(),
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user