nits, fixes

This commit is contained in:
Anton Bracke
2022-02-22 19:01:26 +01:00
parent e82de63b34
commit 454ee6cf4c
8 changed files with 26 additions and 30 deletions
-6
View File
@@ -7,12 +7,6 @@ import settings from "./settings";
export async function updateAutoLaunch() {
let isAutoLaunchEnabled = settings.get("auto_launch_enabled");
// set default to enabled
if (isAutoLaunchEnabled === undefined) {
settings.set("auto_launch_enabled", true);
isAutoLaunchEnabled = true;
}
// Don't run this in development
if (electronIsDev) {
return;
+1 -1
View File
@@ -44,7 +44,7 @@ export default () => {
settings.get("servers") || [
// TODO: remove this default server
{
_id: "1",
_id: `${Date.now()}-1`,
name: "WA Demo",
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
},
+16 -2
View File
@@ -6,13 +6,27 @@ export type SettingsData = {
log_level: ElectronLog.LogLevel;
auto_launch_enabled: boolean;
servers: Server[];
shortcuts: Record<"mute_toggle" | "camera_toggle", string | null>;
shortcuts: Record<"mute_toggle" | "camera_toggle", string>;
};
let settings: SettingsData;
const defaultSettings: SettingsData = {
log_level: "info",
auto_launch_enabled: true,
servers: [],
shortcuts: {
mute_toggle: "",
camera_toggle: "",
},
};
async function init() {
settings = (await Settings.get()) as SettingsData;
let _settings = await Settings.get();
if (_settings !== undefined) {
_settings = defaultSettings;
}
settings = _settings as SettingsData;
}
function get(): SettingsData;
+8 -1
View File
@@ -4,7 +4,7 @@ import { showAboutWindow } from "electron-util";
import * as autoUpdater from "./auto-updater";
import * as log from "./log";
import { getWindow } from "./window";
import { getAppView, getWindow } from "./window";
let tray: Tray | undefined;
@@ -46,6 +46,13 @@ export function createTray() {
log.openLog();
},
},
{
label: "Open DevTools",
click() {
getWindow()?.webContents.openDevTools({ mode: "detach" });
getAppView()?.webContents.openDevTools({ mode: "detach" });
},
},
{
label: "About",
click() {
-6
View File
@@ -93,12 +93,6 @@ export async function createWindow() {
mainWindow.once("ready-to-show", () => {
mainWindow?.show();
if (electronIsDev) {
// appView?.webContents.openDevTools({
// mode: "detach",
// });
// mainWindow?.webContents.openDevTools({ mode: "detach" });
}
});
mainWindow.webContents.on("did-finish-load", () => {