fix: ensure both values are passed to object to prevent false outcome

This commit is contained in:
Hachi-R 2024-10-30 17:46:52 -03:00
parent 36813d5f86
commit 0d68851cf4
2 changed files with 10 additions and 4 deletions

View File

@ -115,8 +115,8 @@ declare global {
preferences: Partial<UserPreferences>
) => Promise<void>;
autoLaunch: (autoLaunchProps: {
enabled?: boolean;
minimized?: boolean;
enabled: boolean;
minimized: boolean;
}) => Promise<void>;
authenticateRealDebrid: (apiToken: string) => Promise<RealDebridUser>;

View File

@ -60,7 +60,10 @@ export function SettingsBehavior() {
label={t("launch_with_system")}
onChange={() => {
handleChange({ runAtStartup: !form.runAtStartup });
window.electron.autoLaunch({ enabled: !form.runAtStartup });
window.electron.autoLaunch({
enabled: !form.runAtStartup,
minimized: form.startMinimized,
});
}}
checked={form.runAtStartup}
/>
@ -75,7 +78,10 @@ export function SettingsBehavior() {
disabled={!form.runAtStartup}
onChange={() => {
handleChange({ startMinimized: !form.startMinimized });
window.electron.autoLaunch({ minimized: !form.startMinimized });
window.electron.autoLaunch({
minimized: !form.startMinimized,
enabled: form.runAtStartup,
});
}}
/>
</div>