2021-01-11 21:49:38 -05:00
|
|
|
import {ipcRenderer, remote} from "electron";
|
|
|
|
import * as os from "os";
|
2021-03-20 11:18:05 -04:00
|
|
|
import {NativeClientBackend, NativeClientVersionInfo} from "tc-shared/backend/NativeClient";
|
|
|
|
import {Arguments, processArguments} from "../shared/process-arguments";
|
2020-10-05 09:10:49 -04:00
|
|
|
|
|
|
|
const call_basic_action = (name: string, ...args: any[]) => ipcRenderer.send('basic-action', name, ...args);
|
2021-01-11 21:49:38 -05:00
|
|
|
let versionInfo: NativeClientVersionInfo;
|
2020-10-05 09:10:49 -04:00
|
|
|
export class NativeClientBackendImpl implements NativeClientBackend {
|
|
|
|
openChangeLog(): void {
|
|
|
|
call_basic_action("open-changelog");
|
|
|
|
}
|
|
|
|
|
|
|
|
openClientUpdater(): void {
|
|
|
|
call_basic_action("check-native-update");
|
|
|
|
}
|
|
|
|
|
|
|
|
openDeveloperTools(): void {
|
|
|
|
call_basic_action("open-dev-tools");
|
|
|
|
}
|
|
|
|
|
|
|
|
quit(): void {
|
|
|
|
call_basic_action("quit");
|
|
|
|
}
|
|
|
|
|
|
|
|
reloadWindow(): void {
|
|
|
|
call_basic_action("reload-window")
|
|
|
|
}
|
|
|
|
|
|
|
|
showDeveloperOptions(): boolean {
|
|
|
|
return processArguments.has_flag(Arguments.DEV_TOOLS);
|
|
|
|
}
|
2021-01-11 21:49:38 -05:00
|
|
|
|
|
|
|
getVersionInfo(): NativeClientVersionInfo {
|
|
|
|
if(!versionInfo) {
|
|
|
|
versionInfo = {
|
|
|
|
version: remote.getGlobal("app_version_client") || "?.?.?",
|
|
|
|
|
|
|
|
os_platform: os.platform(),
|
|
|
|
os_platform_version: os.release(),
|
|
|
|
|
|
|
|
os_architecture: os.arch()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return versionInfo;
|
|
|
|
}
|
2020-10-05 09:10:49 -04:00
|
|
|
}
|