mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
Add setting to disable auto update
This commit is contained in:
parent
6ccef6e515
commit
293d8ec584
5 changed files with 53 additions and 5 deletions
|
|
@ -0,0 +1,41 @@
|
|||
import isElectron from 'is-electron';
|
||||
import { useWindowSettings, useSettingsStoreActions } from '../../../../store/settings.store';
|
||||
import {
|
||||
SettingsSection,
|
||||
SettingOption,
|
||||
} from '/@/renderer/features/settings/components/settings-section';
|
||||
import { Switch } from '/@/renderer/components';
|
||||
|
||||
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||
|
||||
export const UpdateSettings = () => {
|
||||
const settings = useWindowSettings();
|
||||
const { setSettings } = useSettingsStoreActions();
|
||||
|
||||
const updateOptions: SettingOption[] = [
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
aria-label="Disable automatic updates"
|
||||
defaultChecked={settings.disableAutoUpdate}
|
||||
disabled={!isElectron()}
|
||||
onChange={(e) => {
|
||||
if (!e) return;
|
||||
localSettings?.set('disable_auto_updates', e.currentTarget.checked);
|
||||
setSettings({
|
||||
window: {
|
||||
...settings,
|
||||
disableAutoUpdate: e.currentTarget.checked,
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
),
|
||||
description: 'Enabling this option will disable checking for new versions on startup',
|
||||
isHidden: !isElectron(),
|
||||
title: 'Disable automatic updates',
|
||||
},
|
||||
];
|
||||
|
||||
return <SettingsSection options={updateOptions} />;
|
||||
};
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
import { Stack } from '@mantine/core';
|
||||
import { WindowSettings } from './window-settings';
|
||||
import { Divider, Stack } from '@mantine/core';
|
||||
import { UpdateSettings } from '/@/renderer/features/settings/components/window/update-settings';
|
||||
import { WindowSettings } from '/@/renderer/features/settings/components/window/window-settings';
|
||||
|
||||
export const WindowTab = () => {
|
||||
return (
|
||||
<Stack spacing="md">
|
||||
<WindowSettings />
|
||||
<Divider />
|
||||
<UpdateSettings />
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue