updating login

This commit is contained in:
Andrew Gundersen 2021-03-25 15:13:15 -05:00
commit bb9769e917
22 changed files with 316 additions and 362 deletions

View file

@ -16,7 +16,6 @@ let win: BrowserWindow | null;
// Called when a NavBar button is pressed.
const onNavBar = (_event: any, action: string): void => {
console.log("onNavBar")
if (win) {
if (action === "close") {
win.close()
@ -59,18 +58,25 @@ const saveWindowState = () => {
// Do this on window mount.
const onWindowMount = (): void => {
console.log("BW:Adding window listeners. ")
// Must tell initApp that window exists.
backgroundMitt.emit('window-active', true);
// Handle win nav-bar event.
ipcMain.removeHandler('nav-bar'); // avoid setting duplicate handlers
ipcMain.handle('nav-bar', onNavBar);
ipcMain.removeHandler("nav-bar") // avoid setting duplicate handlers
ipcMain.handle("nav-bar", onNavBar);
// Gateway for messages to the frontend.
backgroundMitt.removeAllListeners('ipc-renderer')
backgroundMitt.on('ipc-renderer', renderMessage);
console.log("BW:Listeners created.")
}
// Do this on window dismount (close).
const onWindowDismount = (): void => {
console.log("BW:Window closed.")
win = null;
backgroundMitt.emit('window-active', false);
}
@ -78,6 +84,7 @@ const onWindowDismount = (): void => {
// function used by run.ts to create the main window.
export async function createWindow(): Promise<void> {
return new Promise((resolve, _reject) => {
console.log("BW:Creating browser window. ")
// avoid creating duplicate windows.
if (win) resolve();
@ -122,6 +129,7 @@ export async function createWindow(): Promise<void> {
if (win) win.show()
})
// For showing/hiding the splash screen.
win.webContents.on('did-finish-load', () => {
if (win) win.webContents.send('window-ready', {
message: true