Skip to content

Commit 2b8cc50

Browse files
committed
feat: settings to enable steam achievements search
1 parent e0c5f80 commit 2b8cc50

File tree

8 files changed

+52
-3
lines changed

8 files changed

+52
-3
lines changed

src/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@
379379
"installing_common_redist": "Installing…",
380380
"show_download_speed_in_megabytes": "Show download speed in megabytes per second",
381381
"extract_files_by_default": "Extract files by default after download",
382+
"enable_steam_achievements": "Enable search for Steam achievements",
382383
"achievement_custom_notification_position": "Achievement custom notification position",
383384
"top-left": "Top left",
384385
"top-center": "Top center",

src/locales/pt-BR/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@
364364
"installing_common_redist": "Instalando…",
365365
"show_download_speed_in_megabytes": "Exibir taxas de download em megabytes por segundo",
366366
"extract_files_by_default": "Extrair arquivos automaticamente após o download",
367+
"enable_steam_achievements": "Habilitar busca por conquistas da Steam",
367368
"enable_achievement_custom_notifications": "Habilitar notificações customizadas de conquistas",
368369
"top-left": "Superior esquerdo",
369370
"top-center": "Superior central",

src/main/services/achievements/find-achivement-files.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import path from "node:path";
22
import fs from "node:fs";
3-
import type { Game, AchievementFile } from "@types";
3+
import type { Game, AchievementFile, UserPreferences } from "@types";
44
import { Cracker } from "@shared";
55
import { achievementsLogger } from "../logger";
66
import { SystemPath } from "../system-path";
77
import { getSteamLocation, getSteamUsersIds } from "../steam";
8+
import { db, levelKeys } from "@main/level";
89

910
const getAppDataPath = () => {
1011
if (process.platform === "win32") {
@@ -285,6 +286,17 @@ export const findAchievementFileInSteamPath = async (game: Game) => {
285286
return [];
286287
}
287288

289+
const userPreferences = await db.get<string, UserPreferences | null>(
290+
levelKeys.userPreferences,
291+
{
292+
valueEncoding: "json",
293+
}
294+
);
295+
296+
if (!userPreferences?.enableSteamAchievements) {
297+
return [];
298+
}
299+
288300
const achievementFiles: AchievementFile[] = [];
289301

290302
for (const steamUserId of steamUserIds) {

src/main/services/window-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ export class WindowManager {
582582
tray.popUpContextMenu(contextMenu);
583583
};
584584

585-
tray.setToolTip("Hydra");
585+
tray.setToolTip("Hydra Launcher");
586586

587587
if (process.platform !== "darwin") {
588588
await updateSystemTray();

src/renderer/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Hydra</title>
6+
<title>Hydra Launcher</title>
77
<meta
88
http-equiv="Content-Security-Policy"
99
content="default-src 'self' 'unsafe-inline' * data: local:;"

src/renderer/src/pages/settings/settings-behavior.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,16 @@
99
opacity: 1;
1010
cursor: pointer;
1111
}
12+
13+
&--with-tooltip {
14+
display: flex;
15+
flex-direction: row;
16+
gap: 8px;
17+
align-items: center;
18+
}
19+
20+
&--tooltip {
21+
cursor: pointer;
22+
}
1223
}
1324
}

src/renderer/src/pages/settings/settings-behavior.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CheckboxField } from "@renderer/components";
55
import { useAppSelector } from "@renderer/hooks";
66
import { settingsContext } from "@renderer/context";
77
import "./settings-behavior.scss";
8+
import { QuestionIcon } from "@primer/octicons-react";
89

910
export function SettingsBehavior() {
1011
const userPreferences = useAppSelector(
@@ -25,6 +26,7 @@ export function SettingsBehavior() {
2526
showHiddenAchievementsDescription: false,
2627
showDownloadSpeedInMegabytes: false,
2728
extractFilesByDefault: true,
29+
enableSteamAchievements: false,
2830
});
2931

3032
const { t } = useTranslation("settings");
@@ -45,6 +47,8 @@ export function SettingsBehavior() {
4547
showDownloadSpeedInMegabytes:
4648
userPreferences.showDownloadSpeedInMegabytes ?? false,
4749
extractFilesByDefault: userPreferences.extractFilesByDefault ?? true,
50+
enableSteamAchievements:
51+
userPreferences.enableSteamAchievements ?? false,
4852
});
4953
}
5054
}, [userPreferences]);
@@ -164,6 +168,25 @@ export function SettingsBehavior() {
164168
})
165169
}
166170
/>
171+
172+
<div className={`settings-behavior__checkbox-container--with-tooltip`}>
173+
<CheckboxField
174+
label={t("enable_steam_achievements")}
175+
checked={form.enableSteamAchievements}
176+
onChange={() =>
177+
handleChange({
178+
enableSteamAchievements: !form.enableSteamAchievements,
179+
})
180+
}
181+
/>
182+
183+
<small
184+
className="settings-behavior__checkbox-container--tooltip"
185+
data-open-article="steam-achievements"
186+
>
187+
<QuestionIcon size={12} />
188+
</small>
189+
</div>
167190
</>
168191
);
169192
}

src/types/level.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export interface UserPreferences {
101101
friendStartGameNotificationsEnabled?: boolean;
102102
showDownloadSpeedInMegabytes?: boolean;
103103
extractFilesByDefault?: boolean;
104+
enableSteamAchievements?: boolean;
104105
}
105106

106107
export interface ScreenState {

0 commit comments

Comments
 (0)