mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-27 04:41:03 +00:00
feat: settings to enable steam achievements search
This commit is contained in:
@@ -379,6 +379,7 @@
|
|||||||
"installing_common_redist": "Installing…",
|
"installing_common_redist": "Installing…",
|
||||||
"show_download_speed_in_megabytes": "Show download speed in megabytes per second",
|
"show_download_speed_in_megabytes": "Show download speed in megabytes per second",
|
||||||
"extract_files_by_default": "Extract files by default after download",
|
"extract_files_by_default": "Extract files by default after download",
|
||||||
|
"enable_steam_achievements": "Enable search for Steam achievements",
|
||||||
"achievement_custom_notification_position": "Achievement custom notification position",
|
"achievement_custom_notification_position": "Achievement custom notification position",
|
||||||
"top-left": "Top left",
|
"top-left": "Top left",
|
||||||
"top-center": "Top center",
|
"top-center": "Top center",
|
||||||
|
|||||||
@@ -364,6 +364,7 @@
|
|||||||
"installing_common_redist": "Instalando…",
|
"installing_common_redist": "Instalando…",
|
||||||
"show_download_speed_in_megabytes": "Exibir taxas de download em megabytes por segundo",
|
"show_download_speed_in_megabytes": "Exibir taxas de download em megabytes por segundo",
|
||||||
"extract_files_by_default": "Extrair arquivos automaticamente após o download",
|
"extract_files_by_default": "Extrair arquivos automaticamente após o download",
|
||||||
|
"enable_steam_achievements": "Habilitar busca por conquistas da Steam",
|
||||||
"enable_achievement_custom_notifications": "Habilitar notificações customizadas de conquistas",
|
"enable_achievement_custom_notifications": "Habilitar notificações customizadas de conquistas",
|
||||||
"top-left": "Superior esquerdo",
|
"top-left": "Superior esquerdo",
|
||||||
"top-center": "Superior central",
|
"top-center": "Superior central",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import type { Game, AchievementFile } from "@types";
|
import type { Game, AchievementFile, UserPreferences } from "@types";
|
||||||
import { Cracker } from "@shared";
|
import { Cracker } from "@shared";
|
||||||
import { achievementsLogger } from "../logger";
|
import { achievementsLogger } from "../logger";
|
||||||
import { SystemPath } from "../system-path";
|
import { SystemPath } from "../system-path";
|
||||||
import { getSteamLocation, getSteamUsersIds } from "../steam";
|
import { getSteamLocation, getSteamUsersIds } from "../steam";
|
||||||
|
import { db, levelKeys } from "@main/level";
|
||||||
|
|
||||||
const getAppDataPath = () => {
|
const getAppDataPath = () => {
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
@@ -285,6 +286,17 @@ export const findAchievementFileInSteamPath = async (game: Game) => {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userPreferences = await db.get<string, UserPreferences | null>(
|
||||||
|
levelKeys.userPreferences,
|
||||||
|
{
|
||||||
|
valueEncoding: "json",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!userPreferences?.enableSteamAchievements) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const achievementFiles: AchievementFile[] = [];
|
const achievementFiles: AchievementFile[] = [];
|
||||||
|
|
||||||
for (const steamUserId of steamUserIds) {
|
for (const steamUserId of steamUserIds) {
|
||||||
|
|||||||
@@ -582,7 +582,7 @@ export class WindowManager {
|
|||||||
tray.popUpContextMenu(contextMenu);
|
tray.popUpContextMenu(contextMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
tray.setToolTip("Hydra");
|
tray.setToolTip("Hydra Launcher");
|
||||||
|
|
||||||
if (process.platform !== "darwin") {
|
if (process.platform !== "darwin") {
|
||||||
await updateSystemTray();
|
await updateSystemTray();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Hydra</title>
|
<title>Hydra Launcher</title>
|
||||||
<meta
|
<meta
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="default-src 'self' 'unsafe-inline' * data: local:;"
|
content="default-src 'self' 'unsafe-inline' * data: local:;"
|
||||||
|
|||||||
@@ -9,5 +9,16 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--with-tooltip {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--tooltip {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { CheckboxField } from "@renderer/components";
|
|||||||
import { useAppSelector } from "@renderer/hooks";
|
import { useAppSelector } from "@renderer/hooks";
|
||||||
import { settingsContext } from "@renderer/context";
|
import { settingsContext } from "@renderer/context";
|
||||||
import "./settings-behavior.scss";
|
import "./settings-behavior.scss";
|
||||||
|
import { QuestionIcon } from "@primer/octicons-react";
|
||||||
|
|
||||||
export function SettingsBehavior() {
|
export function SettingsBehavior() {
|
||||||
const userPreferences = useAppSelector(
|
const userPreferences = useAppSelector(
|
||||||
@@ -25,6 +26,7 @@ export function SettingsBehavior() {
|
|||||||
showHiddenAchievementsDescription: false,
|
showHiddenAchievementsDescription: false,
|
||||||
showDownloadSpeedInMegabytes: false,
|
showDownloadSpeedInMegabytes: false,
|
||||||
extractFilesByDefault: true,
|
extractFilesByDefault: true,
|
||||||
|
enableSteamAchievements: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
@@ -45,6 +47,8 @@ export function SettingsBehavior() {
|
|||||||
showDownloadSpeedInMegabytes:
|
showDownloadSpeedInMegabytes:
|
||||||
userPreferences.showDownloadSpeedInMegabytes ?? false,
|
userPreferences.showDownloadSpeedInMegabytes ?? false,
|
||||||
extractFilesByDefault: userPreferences.extractFilesByDefault ?? true,
|
extractFilesByDefault: userPreferences.extractFilesByDefault ?? true,
|
||||||
|
enableSteamAchievements:
|
||||||
|
userPreferences.enableSteamAchievements ?? false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [userPreferences]);
|
}, [userPreferences]);
|
||||||
@@ -164,6 +168,25 @@ export function SettingsBehavior() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div className={`settings-behavior__checkbox-container--with-tooltip`}>
|
||||||
|
<CheckboxField
|
||||||
|
label={t("enable_steam_achievements")}
|
||||||
|
checked={form.enableSteamAchievements}
|
||||||
|
onChange={() =>
|
||||||
|
handleChange({
|
||||||
|
enableSteamAchievements: !form.enableSteamAchievements,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<small
|
||||||
|
className="settings-behavior__checkbox-container--tooltip"
|
||||||
|
data-open-article="steam-achievements"
|
||||||
|
>
|
||||||
|
<QuestionIcon size={12} />
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ export interface UserPreferences {
|
|||||||
friendStartGameNotificationsEnabled?: boolean;
|
friendStartGameNotificationsEnabled?: boolean;
|
||||||
showDownloadSpeedInMegabytes?: boolean;
|
showDownloadSpeedInMegabytes?: boolean;
|
||||||
extractFilesByDefault?: boolean;
|
extractFilesByDefault?: boolean;
|
||||||
|
enableSteamAchievements?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScreenState {
|
export interface ScreenState {
|
||||||
|
|||||||
Reference in New Issue
Block a user