mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
desktop: zod considers false as undefined and throws error
This commit is contained in:
committed by
Abdullah Atta
parent
b733eb3c44
commit
8df9c49fa1
@@ -52,12 +52,12 @@ export const osIntegrationRouter = t.router({
|
||||
|
||||
privacyMode: t.procedure.query(() => config.privacyMode),
|
||||
setPrivacyMode: t.procedure
|
||||
.input(z.boolean())
|
||||
.input(z.boolean().optional())
|
||||
.mutation(({ input: privacyMode }) => {
|
||||
if (!globalThis.window || !["win32", "darwin"].includes(process.platform))
|
||||
return;
|
||||
|
||||
globalThis.window.setContentProtection(privacyMode);
|
||||
globalThis.window.setContentProtection(!!privacyMode);
|
||||
|
||||
if (process.platform === "win32") {
|
||||
globalThis.window.setThumbnailClip(
|
||||
@@ -66,7 +66,7 @@ export const osIntegrationRouter = t.router({
|
||||
: { x: 0, y: 0, width: 0, height: 0 }
|
||||
);
|
||||
}
|
||||
config.privacyMode = privacyMode;
|
||||
config.privacyMode = !!privacyMode;
|
||||
}),
|
||||
|
||||
desktopIntegration: t.procedure.query(() => config.desktopSettings),
|
||||
@@ -74,7 +74,7 @@ export const osIntegrationRouter = t.router({
|
||||
.input(DesktopIntegration)
|
||||
.mutation(({ input: settings }) => {
|
||||
if (settings.autoStart) {
|
||||
AutoLaunch.enable(settings.startMinimized);
|
||||
AutoLaunch.enable(!!settings.startMinimized);
|
||||
} else {
|
||||
AutoLaunch.disable();
|
||||
}
|
||||
|
||||
@@ -216,6 +216,6 @@ function setupDesktopIntegration(hidden: boolean) {
|
||||
});
|
||||
|
||||
if (desktopIntegration.autoStart) {
|
||||
AutoLaunch.enable(desktopIntegration.startMinimized);
|
||||
AutoLaunch.enable(!!desktopIntegration.startMinimized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ import { JSONStorage } from "./json-storage";
|
||||
import { z } from "zod";
|
||||
|
||||
export const DesktopIntegration = z.object({
|
||||
autoStart: z.boolean(),
|
||||
startMinimized: z.boolean(),
|
||||
minimizeToSystemTray: z.boolean(),
|
||||
closeToSystemTray: z.boolean()
|
||||
autoStart: z.boolean().optional(),
|
||||
startMinimized: z.boolean().optional(),
|
||||
minimizeToSystemTray: z.boolean().optional(),
|
||||
closeToSystemTray: z.boolean().optional()
|
||||
});
|
||||
|
||||
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
|
||||
|
||||
Reference in New Issue
Block a user