simplify version api

This commit is contained in:
smartfrigde 2024-05-15 20:32:14 +02:00
parent 0487507bc4
commit b9bf19f059
3 changed files with 8 additions and 17 deletions

View file

@ -1,19 +1,14 @@
import {app} from "electron";
export const packageVersion = "3.2.0";
export function getVersion(): string {
return packageVersion;
if ((app.getVersion() == process.versions.electron) == true) {
return "3.3.0";
}
return app.getVersion();
}
export function getDisplayVersion(): string {
//Checks if the app version # has 4 sections (3.1.0.0) instead of 3 (3.1.0) / Shitty way to check if Kernel Mod is installed
if ((app.getVersion() == packageVersion) == false) {
if ((app.getVersion() == process.versions.electron) == true) {
return `Dev Build (${packageVersion})`;
} else {
return `${packageVersion} [Modified]`;
}
} else {
return packageVersion;
return "Dev Build";
}
return app.getVersion();
}

View file

@ -8,7 +8,7 @@ import path from "path";
import {getConfig, setConfigBulk, getConfigLocation, Settings} from "../common/config";
import {setLang, getLang, getLangName} from "../common/lang";
import {sleep} from "../common/sleep";
import {getVersion, getDisplayVersion, packageVersion} from "../common/version";
import {getVersion, getDisplayVersion} from "../common/version";
import {customTitlebar} from "../main";
import {createSettingsWindow} from "../settings/main";
import {splashWindow} from "../splash/main";
@ -80,9 +80,6 @@ export function registerIpc(): void {
ipcMain.on("modInstallState", (event) => {
event.returnValue = modInstallState;
});
ipcMain.on("get-package-version", (event) => {
event.returnValue = packageVersion;
});
ipcMain.on("splashEnd", async () => {
splashWindow.close();
if (await getConfig("startMinimized")) {

View file

@ -57,7 +57,6 @@ contextBridge.exposeInMainWorld("armcord", {
getDisplayMediaSelector,
version: ipcRenderer.sendSync("get-app-version", "app-version"),
mods: ipcRenderer.sendSync("clientmod"),
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
});
let windowCallback: (arg0: object) => void;