mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +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),
|
privacyMode: t.procedure.query(() => config.privacyMode),
|
||||||
setPrivacyMode: t.procedure
|
setPrivacyMode: t.procedure
|
||||||
.input(z.boolean())
|
.input(z.boolean().optional())
|
||||||
.mutation(({ input: privacyMode }) => {
|
.mutation(({ input: privacyMode }) => {
|
||||||
if (!globalThis.window || !["win32", "darwin"].includes(process.platform))
|
if (!globalThis.window || !["win32", "darwin"].includes(process.platform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
globalThis.window.setContentProtection(privacyMode);
|
globalThis.window.setContentProtection(!!privacyMode);
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
globalThis.window.setThumbnailClip(
|
globalThis.window.setThumbnailClip(
|
||||||
@@ -66,7 +66,7 @@ export const osIntegrationRouter = t.router({
|
|||||||
: { x: 0, y: 0, width: 0, height: 0 }
|
: { x: 0, y: 0, width: 0, height: 0 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
config.privacyMode = privacyMode;
|
config.privacyMode = !!privacyMode;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
desktopIntegration: t.procedure.query(() => config.desktopSettings),
|
desktopIntegration: t.procedure.query(() => config.desktopSettings),
|
||||||
@@ -74,7 +74,7 @@ export const osIntegrationRouter = t.router({
|
|||||||
.input(DesktopIntegration)
|
.input(DesktopIntegration)
|
||||||
.mutation(({ input: settings }) => {
|
.mutation(({ input: settings }) => {
|
||||||
if (settings.autoStart) {
|
if (settings.autoStart) {
|
||||||
AutoLaunch.enable(settings.startMinimized);
|
AutoLaunch.enable(!!settings.startMinimized);
|
||||||
} else {
|
} else {
|
||||||
AutoLaunch.disable();
|
AutoLaunch.disable();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,6 @@ function setupDesktopIntegration(hidden: boolean) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (desktopIntegration.autoStart) {
|
if (desktopIntegration.autoStart) {
|
||||||
AutoLaunch.enable(desktopIntegration.startMinimized);
|
AutoLaunch.enable(!!desktopIntegration.startMinimized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ import { JSONStorage } from "./json-storage";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
export const DesktopIntegration = z.object({
|
export const DesktopIntegration = z.object({
|
||||||
autoStart: z.boolean(),
|
autoStart: z.boolean().optional(),
|
||||||
startMinimized: z.boolean(),
|
startMinimized: z.boolean().optional(),
|
||||||
minimizeToSystemTray: z.boolean(),
|
minimizeToSystemTray: z.boolean().optional(),
|
||||||
closeToSystemTray: z.boolean()
|
closeToSystemTray: z.boolean().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
|
export type DesktopIntegration = z.infer<typeof DesktopIntegration>;
|
||||||
|
|||||||
Reference in New Issue
Block a user