Merge branch 'feat/migration-to-leveldb' into feature/check-directory-permission

# Conflicts:
#	src/main/events/library/open-game.ts
#	src/main/events/user-preferences/update-user-preferences.ts
#	src/main/index.ts
#	src/main/main.ts
#	src/main/services/achievements/achievement-watcher-manager.ts
#	src/main/services/achievements/get-game-achievement-data.ts
#	src/main/services/notifications/index.ts
#	src/renderer/src/pages/downloads/download-group.tsx
This commit is contained in:
Zamitto
2025-01-29 09:38:32 -03:00
132 changed files with 1941 additions and 2604 deletions

View File

@@ -1,8 +1,6 @@
import { Notification, app } from "electron";
import { t } from "i18next";
import trayIcon from "@resources/tray-icon.png?asset";
import { Game } from "@main/entity";
import { userPreferencesRepository } from "@main/repository";
import fs from "node:fs";
import axios from "axios";
import path from "node:path";
@@ -12,6 +10,8 @@ import icon from "@resources/icon.png?asset";
import { NotificationOptions, toXmlString } from "./xml";
import { logger } from "../logger";
import { WindowManager } from "../window-manager";
import type { Game, UserPreferences } from "@types";
import { db, levelKeys } from "@main/level";
async function downloadImage(url: string | null) {
if (!url) return undefined;
@@ -39,9 +39,12 @@ async function downloadImage(url: string | null) {
}
export const publishDownloadCompleteNotification = async (game: Game) => {
const userPreferences = await userPreferencesRepository.findOne({
where: { id: 1 },
});
const userPreferences = await db.get<string, UserPreferences>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
if (userPreferences?.downloadNotificationsEnabled) {
new Notification({