mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
feat: dont show auto launch on portable version
This commit is contained in:
parent
9c99e56b70
commit
f1fecb684b
@ -49,4 +49,8 @@ import "./profile/update-profile";
|
|||||||
|
|
||||||
ipcMain.handle("ping", () => "pong");
|
ipcMain.handle("ping", () => "pong");
|
||||||
ipcMain.handle("getVersion", () => app.getVersion());
|
ipcMain.handle("getVersion", () => app.getVersion());
|
||||||
|
ipcMain.handle(
|
||||||
|
"isPortableVersion",
|
||||||
|
() => process.env.PORTABLE_EXECUTABLE_FILE != null
|
||||||
|
);
|
||||||
ipcMain.handle("getDefaultDownloadsPath", () => defaultDownloadsPath);
|
ipcMain.handle("getDefaultDownloadsPath", () => defaultDownloadsPath);
|
||||||
|
@ -110,6 +110,7 @@ contextBridge.exposeInMainWorld("electron", {
|
|||||||
ping: () => ipcRenderer.invoke("ping"),
|
ping: () => ipcRenderer.invoke("ping"),
|
||||||
getVersion: () => ipcRenderer.invoke("getVersion"),
|
getVersion: () => ipcRenderer.invoke("getVersion"),
|
||||||
getDefaultDownloadsPath: () => ipcRenderer.invoke("getDefaultDownloadsPath"),
|
getDefaultDownloadsPath: () => ipcRenderer.invoke("getDefaultDownloadsPath"),
|
||||||
|
isPortableVersion: () => ipcRenderer.invoke("isPortableVersion"),
|
||||||
openExternal: (src: string) => ipcRenderer.invoke("openExternal", src),
|
openExternal: (src: string) => ipcRenderer.invoke("openExternal", src),
|
||||||
isUserLoggedIn: () => ipcRenderer.invoke("isUserLoggedIn"),
|
isUserLoggedIn: () => ipcRenderer.invoke("isUserLoggedIn"),
|
||||||
showOpenDialog: (options: Electron.OpenDialogOptions) =>
|
showOpenDialog: (options: Electron.OpenDialogOptions) =>
|
||||||
|
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>;
|
getVersion: () => Promise<string>;
|
||||||
ping: () => string;
|
ping: () => string;
|
||||||
getDefaultDownloadsPath: () => Promise<string>;
|
getDefaultDownloadsPath: () => Promise<string>;
|
||||||
|
isPortableVersion: () => Promise<boolean>;
|
||||||
showOpenDialog: (
|
showOpenDialog: (
|
||||||
options: Electron.OpenDialogOptions
|
options: Electron.OpenDialogOptions
|
||||||
) => Promise<Electron.OpenDialogReturnValue>;
|
) => Promise<Electron.OpenDialogReturnValue>;
|
||||||
|
@ -10,6 +10,8 @@ export function SettingsBehavior() {
|
|||||||
(state) => state.userPreferences.value
|
(state) => state.userPreferences.value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [showRunAtStartup, setShowRunAtStartup] = useState(false);
|
||||||
|
|
||||||
const { updateUserPreferences } = useContext(settingsContext);
|
const { updateUserPreferences } = useContext(settingsContext);
|
||||||
|
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
@ -28,6 +30,12 @@ export function SettingsBehavior() {
|
|||||||
}
|
}
|
||||||
}, [userPreferences]);
|
}, [userPreferences]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.electron.isPortableVersion().then((isPortableVersion) => {
|
||||||
|
setShowRunAtStartup(!isPortableVersion);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleChange = (values: Partial<typeof form>) => {
|
const handleChange = (values: Partial<typeof form>) => {
|
||||||
setForm((prev) => ({ ...prev, ...values }));
|
setForm((prev) => ({ ...prev, ...values }));
|
||||||
updateUserPreferences(values);
|
updateUserPreferences(values);
|
||||||
@ -45,14 +53,16 @@ export function SettingsBehavior() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CheckboxField
|
{showRunAtStartup && (
|
||||||
label={t("launch_with_system")}
|
<CheckboxField
|
||||||
onChange={() => {
|
label={t("launch_with_system")}
|
||||||
handleChange({ runAtStartup: !form.runAtStartup });
|
onChange={() => {
|
||||||
window.electron.autoLaunch(!form.runAtStartup);
|
handleChange({ runAtStartup: !form.runAtStartup });
|
||||||
}}
|
window.electron.autoLaunch(!form.runAtStartup);
|
||||||
checked={form.runAtStartup}
|
}}
|
||||||
/>
|
checked={form.runAtStartup}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user