import { BrowserWindow } from 'electron';
const UPDATE_HTML = `
Krunker Civilian Client
Checking for updates...
`;
const UPDATE_DATA_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent(UPDATE_HTML);
export function showUpdateWindow(): { window: BrowserWindow; sendProgress: (message: string, percent?: number) => void } {
const win = new BrowserWindow({
width: 450,
height: 180,
resizable: false,
alwaysOnTop: true,
backgroundColor: '#1a1a2e',
autoHideMenuBar: true,
title: 'Krunker Civilian Client - Update',
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
sandbox: false,
},
});
win.removeMenu();
win.loadURL(UPDATE_DATA_URL);
function sendProgress(message: string, percent?: number): void {
if (!win.isDestroyed()) {
win.webContents.send('update-progress', message, percent);
}
}
return { window: win, sendProgress };
}