mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-21 10:03:56 +00:00
feat: dont show auto launch on portable version
This commit is contained in:
1
src/renderer/src/declaration.d.ts
vendored
1
src/renderer/src/declaration.d.ts
vendored
@@ -104,6 +104,7 @@ declare global {
|
||||
getVersion: () => Promise<string>;
|
||||
ping: () => string;
|
||||
getDefaultDownloadsPath: () => Promise<string>;
|
||||
isPortableVersion: () => Promise<boolean>;
|
||||
showOpenDialog: (
|
||||
options: Electron.OpenDialogOptions
|
||||
) => Promise<Electron.OpenDialogReturnValue>;
|
||||
|
||||
@@ -10,6 +10,8 @@ export function SettingsBehavior() {
|
||||
(state) => state.userPreferences.value
|
||||
);
|
||||
|
||||
const [showRunAtStartup, setShowRunAtStartup] = useState(false);
|
||||
|
||||
const { updateUserPreferences } = useContext(settingsContext);
|
||||
|
||||
const [form, setForm] = useState({
|
||||
@@ -28,6 +30,12 @@ export function SettingsBehavior() {
|
||||
}
|
||||
}, [userPreferences]);
|
||||
|
||||
useEffect(() => {
|
||||
window.electron.isPortableVersion().then((isPortableVersion) => {
|
||||
setShowRunAtStartup(!isPortableVersion);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleChange = (values: Partial<typeof form>) => {
|
||||
setForm((prev) => ({ ...prev, ...values }));
|
||||
updateUserPreferences(values);
|
||||
@@ -45,14 +53,16 @@ export function SettingsBehavior() {
|
||||
}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
label={t("launch_with_system")}
|
||||
onChange={() => {
|
||||
handleChange({ runAtStartup: !form.runAtStartup });
|
||||
window.electron.autoLaunch(!form.runAtStartup);
|
||||
}}
|
||||
checked={form.runAtStartup}
|
||||
/>
|
||||
{showRunAtStartup && (
|
||||
<CheckboxField
|
||||
label={t("launch_with_system")}
|
||||
onChange={() => {
|
||||
handleChange({ runAtStartup: !form.runAtStartup });
|
||||
window.electron.autoLaunch(!form.runAtStartup);
|
||||
}}
|
||||
checked={form.runAtStartup}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user