initial commit

This commit is contained in:
Hachi-R 2024-05-05 17:18:06 -03:00
parent 21296cba95
commit 5b9af9e0ea
6 changed files with 78 additions and 0 deletions

View File

@ -35,8 +35,10 @@
"@sentry/electron": "^4.23.0",
"@sentry/react": "^7.111.0",
"@sentry/vite-plugin": "^2.16.1",
"@types/auto-launch": "^5.0.5",
"@vanilla-extract/css": "^1.14.2",
"@vanilla-extract/recipes": "^0.5.2",
"auto-launch": "^5.0.6",
"axios": "^1.6.8",
"better-sqlite3": "^9.5.0",
"check-disk-space": "^3.4.0",

View File

@ -29,6 +29,9 @@ export class UserPreferences {
@Column("boolean", { default: false })
preferQuitInsteadOfHiding: boolean;
@Column("boolean", { default: false })
startWithSystem: boolean;
@CreateDateColumn()
createdAt: Date;

View File

@ -0,0 +1,22 @@
import AutoLaunch from "auto-launch";
export const autoLaunch = () => {
Promise.all([window.electron.getUserPreferences()]).then(
(userPreferences) => {
if (userPreferences && userPreferences.length > 0) {
const appLauncher = new AutoLaunch({
name: "Hydra",
});
if (userPreferences[0]?.startWithSystem) {
appLauncher
.enable()
.catch((err) => console.error("Error enabling auto-launch:", err));
} else {
appLauncher
.disable()
.catch((err) => console.error("Error disabling auto-launch:", err));
}
}
}
);
};

View File

@ -4,6 +4,7 @@ import { Button, CheckboxField, TextField } from "@renderer/components";
import * as styles from "./settings.css";
import { useTranslation } from "react-i18next";
import { UserPreferences } from "@types";
// import { autoLaunch } from "./auto-launch";
export function Settings() {
const [form, setForm] = useState({
@ -12,6 +13,7 @@ export function Settings() {
repackUpdatesNotificationsEnabled: false,
telemetryEnabled: false,
preferQuitInsteadOfHiding: false,
startWithSystem: false,
});
const { t } = useTranslation("settings");
@ -30,6 +32,7 @@ export function Settings() {
telemetryEnabled: userPreferences?.telemetryEnabled ?? false,
preferQuitInsteadOfHiding:
userPreferences?.preferQuitInsteadOfHiding ?? false,
startWithSystem: userPreferences?.startWithSystem ?? false,
});
});
}, []);
@ -123,6 +126,15 @@ export function Settings() {
)
}
/>
<CheckboxField
label={"autoLaunch"}
onChange={() => {
updateUserPreferences("startWithSystem", !form.startWithSystem);
// autoLaunch();
}}
checked={form.startWithSystem}
/>
</div>
</section>
);

View File

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

View File

@ -1316,6 +1316,11 @@
resolved "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz"
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
"@types/auto-launch@^5.0.5":
version "5.0.5"
resolved "https://registry.yarnpkg.com/@types/auto-launch/-/auto-launch-5.0.5.tgz#439ed36aaaea501e2e2cfbddd8a20c366c34863b"
integrity sha512-/nGvQZSzM/pvCMCh4Gt2kIeiUmOP/cKGJbjlInI+A+5MoV/7XmT56DJ6EU8bqc3+ItxEe4UC2GVspmPzcCc8cg==
"@types/babel__core@^7.20.5":
version "7.20.5"
resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz"
@ -1822,6 +1827,11 @@ app-root-path@^3.1.0:
resolved "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz"
integrity sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==
applescript@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/applescript/-/applescript-1.0.0.tgz#bb87af568cad034a4e48c4bdaf6067a3a2701317"
integrity sha512-yvtNHdWvtbYEiIazXAdp/NY+BBb65/DAseqlNiJQjOx9DynuzOYDbVLBJvuc0ve0VL9x6B3OHF6eH52y9hCBtQ==
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz"
@ -1949,6 +1959,17 @@ at-least-node@^1.0.0:
resolved "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
auto-launch@^5.0.6:
version "5.0.6"
resolved "https://registry.yarnpkg.com/auto-launch/-/auto-launch-5.0.6.tgz#ccc238ddc07b2fa84e96a1bc2fd11b581a20cb2d"
integrity sha512-OgxiAm4q9EBf9EeXdPBiVNENaWE3jUZofwrhAkWjHDYGezu1k3FRZHU8V2FBxGuSJOHzKmTJEd0G7L7/0xDGFA==
dependencies:
applescript "^1.0.0"
mkdirp "^0.5.1"
path-is-absolute "^1.0.0"
untildify "^3.0.2"
winreg "1.2.4"
available-typed-arrays@^1.0.7:
version "1.0.7"
resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz"
@ -4381,6 +4402,13 @@ mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3:
resolved "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz"
integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==
mkdirp@^0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
dependencies:
minimist "^1.2.6"
mkdirp@^1.0.3:
version "1.0.4"
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz"
@ -5763,6 +5791,11 @@ unplugin@1.0.1:
webpack-sources "^3.2.3"
webpack-virtual-modules "^0.5.0"
untildify@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9"
integrity sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==
update-browserslist-db@^1.0.13:
version "1.0.14"
resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.14.tgz"
@ -5975,6 +6008,11 @@ which@^2.0.1, which@^2.0.2:
dependencies:
isexe "^2.0.0"
winreg@1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
integrity sha512-IHpzORub7kYlb8A43Iig3reOvlcBJGX9gZ0WycHhghHtA65X0LYnMRuJs+aH1abVnMJztQkvQNlltnbPi5aGIA==
winston-transport@^4.7.0:
version "4.7.0"
resolved "https://registry.npmjs.org/winston-transport/-/winston-transport-4.7.0.tgz"