name changes

This commit is contained in:
Hachi-R 2024-05-05 20:11:12 -03:00
parent 970a3be280
commit ce5b7a337d
5 changed files with 12 additions and 15 deletions

View File

@ -35,7 +35,6 @@
"@sentry/electron": "^4.23.0", "@sentry/electron": "^4.23.0",
"@sentry/react": "^7.111.0", "@sentry/react": "^7.111.0",
"@sentry/vite-plugin": "^2.16.1", "@sentry/vite-plugin": "^2.16.1",
"@types/auto-launch": "^5.0.5",
"@vanilla-extract/css": "^1.14.2", "@vanilla-extract/css": "^1.14.2",
"@vanilla-extract/recipes": "^0.5.2", "@vanilla-extract/recipes": "^0.5.2",
"auto-launch": "^5.0.6", "auto-launch": "^5.0.6",
@ -68,6 +67,7 @@
"@electron-toolkit/eslint-config-ts": "^1.0.1", "@electron-toolkit/eslint-config-ts": "^1.0.1",
"@electron-toolkit/tsconfig": "^1.0.1", "@electron-toolkit/tsconfig": "^1.0.1",
"@swc/core": "^1.4.16", "@swc/core": "^1.4.16",
"@types/auto-launch": "^5.0.5",
"@types/jsdom": "^21.1.6", "@types/jsdom": "^21.1.6",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.7", "@types/node": "^20.12.7",

View File

@ -30,7 +30,7 @@ export class UserPreferences {
preferQuitInsteadOfHiding: boolean; preferQuitInsteadOfHiding: boolean;
@Column("boolean", { default: false }) @Column("boolean", { default: false })
startWithSystem: boolean; runAtStartup: boolean;
@CreateDateColumn() @CreateDateColumn()
createdAt: Date; createdAt: Date;

View File

@ -1,21 +1,18 @@
import { registerEvent } from "../register-event"; import { registerEvent } from "../register-event";
import AutoLaunch from "auto-launch"; import AutoLaunch from "auto-launch";
import { app } from "electron";
const autoLaunch = async ( const autoLaunch = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
enabled: boolean enabled: boolean
) => { ) => {
const appLauncher = new AutoLaunch({ const appLauncher = new AutoLaunch({
name: "Hydra", name: app.getName(),
}); });
if (enabled) { if (enabled) {
appLauncher appLauncher.enable().catch();
.enable()
.catch((err) => console.error("Error enabling auto-launch:", err));
} else { } else {
appLauncher appLauncher.disable().catch();
.disable()
.catch((err) => console.error("Error disabling auto-launch:", err));
} }
}; };

View File

@ -12,7 +12,7 @@ export function Settings() {
repackUpdatesNotificationsEnabled: false, repackUpdatesNotificationsEnabled: false,
telemetryEnabled: false, telemetryEnabled: false,
preferQuitInsteadOfHiding: false, preferQuitInsteadOfHiding: false,
startWithSystem: false, runAtStartup: false,
}); });
const { t } = useTranslation("settings"); const { t } = useTranslation("settings");
@ -31,7 +31,7 @@ export function Settings() {
telemetryEnabled: userPreferences?.telemetryEnabled ?? false, telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
preferQuitInsteadOfHiding: preferQuitInsteadOfHiding:
userPreferences?.preferQuitInsteadOfHiding ?? false, userPreferences?.preferQuitInsteadOfHiding ?? false,
startWithSystem: userPreferences?.startWithSystem ?? false, runAtStartup: userPreferences?.runAtStartup ?? false,
}); });
}); });
}, []); }, []);
@ -129,10 +129,10 @@ export function Settings() {
<CheckboxField <CheckboxField
label={t("launch_with_system")} label={t("launch_with_system")}
onChange={() => { onChange={() => {
updateUserPreferences("startWithSystem", !form.startWithSystem); updateUserPreferences("runAtStartup", !form.runAtStartup);
window.electron.autoLaunch(!form.startWithSystem); window.electron.autoLaunch(!form.runAtStartup);
}} }}
checked={form.startWithSystem} checked={form.runAtStartup}
/> />
</div> </div>
</section> </section>

View File

@ -106,7 +106,7 @@ export interface UserPreferences {
repackUpdatesNotificationsEnabled: boolean; repackUpdatesNotificationsEnabled: boolean;
telemetryEnabled: boolean; telemetryEnabled: boolean;
preferQuitInsteadOfHiding: boolean; preferQuitInsteadOfHiding: boolean;
startWithSystem: boolean; runAtStartup: boolean;
} }
export interface HowLongToBeatCategory { export interface HowLongToBeatCategory {