fixed bug with vencord crashing on opening settings

This commit is contained in:
miri 2024-01-18 20:14:47 +01:00
parent e764c51e77
commit f30a94df43
4 changed files with 9 additions and 2 deletions

View file

@ -40,6 +40,11 @@ handleSync(
() => process.platform === "win32" && Number(release().split(".").pop()) >= 22621
);
handleSync(
IpcEvents.IS_WINDOWS,
() => process.platform === "win32"
);
handleSync(IpcEvents.AUTOSTART_ENABLED, () => autoStart.isEnabled());
handle(IpcEvents.ENABLE_AUTOSTART, autoStart.enable);
handle(IpcEvents.DISABLE_AUTOSTART, autoStart.disable);

View file

@ -24,7 +24,8 @@ export const VesktopNative = {
relaunch: () => invoke<void>(IpcEvents.RELAUNCH),
getVersion: () => sendSync<void>(IpcEvents.GET_VERSION),
setBadgeCount: (count: number) => invoke<void>(IpcEvents.SET_BADGE_COUNT, count),
supportsWindowsTransparency: () => sendSync<boolean>(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY)
supportsWindowsTransparency: () => sendSync<boolean>(IpcEvents.SUPPORTS_WINDOWS_TRANSPARENCY),
isWindows: () => sendSync<boolean>(IpcEvents.IS_WINDOWS)
},
autostart: {
isEnabled: () => sendSync<boolean>(IpcEvents.AUTOSTART_ENABLED),

View file

@ -16,7 +16,7 @@ import { isTruthy } from "shared/utils/guards";
export default function SettingsUi() {
const Settings = useSettings();
const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency();
const isWindows = process.platform === "win32";
const isWindows = VesktopNative.app.isWindows();
const { autostart } = VesktopNative;
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());

View file

@ -12,6 +12,7 @@ export const enum IpcEvents {
GET_VERSION = "VCD_GET_VERSION",
SUPPORTS_WINDOWS_TRANSPARENCY = "VCD_SUPPORTS_WINDOWS_TRANSPARENCY",
IS_WINDOWS = "VCD_IS_WINDOWS",
RELAUNCH = "VCD_RELAUNCH",
CLOSE = "VCD_CLOSE",