Merge branch 'main' into feature/aria2-for-http-downloads

This commit is contained in:
Chubby Granny Chaser 2024-07-03 20:26:28 +01:00 committed by GitHub
commit 0b2c407770
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -2,17 +2,23 @@ import { userPreferencesRepository } from "@main/repository";
import { registerEvent } from "../register-event";
import type { UserPreferences } from "@types";
import i18next from "i18next";
const updateUserPreferences = async (
_event: Electron.IpcMainInvokeEvent,
preferences: Partial<UserPreferences>
) =>
userPreferencesRepository.upsert(
) => {
if (preferences.language) {
i18next.changeLanguage(preferences.language);
}
return userPreferencesRepository.upsert(
{
id: 1,
...preferences,
},
["id"]
);
};
registerEvent("updateUserPreferences", updateUserPreferences);

View File

@ -72,6 +72,10 @@ app.whenReady().then(async () => {
where: { id: 1 },
});
if (userPreferences?.language) {
i18n.changeLanguage(userPreferences.language);
}
WindowManager.createMainWindow();
WindowManager.createSystemTray(userPreferences?.language || "en");
});