feature/IO-3066-1-scaffolding: Fix some missing PR Notes around PPG

This commit is contained in:
Dave Richer
2025-05-05 10:37:42 -04:00
parent 2953aa420e
commit cdad47b82f
7 changed files with 330 additions and 158 deletions

View File

@@ -464,27 +464,32 @@ app.whenReady().then(async () => {
if (url.startsWith(`${protocol}://keep-alive`)) {
log.info("Keep-alive protocol received, app is already running.");
// Do nothing if already running
return; // Skip openMainWindow to avoid focusing the window
return;
} else {
openInExplorer(url);
}
} else {
openMainWindow(); // Focus window if no URL
}
// No action taken if no URL is provided
});
//Dynamically load ipcMain handlers once ready.
try {
const module = await import("./ipc/ipcMainConfig");
const { initializeCronTasks } = await import("./ipc/ipcMainConfig");
log.debug("Successfully loaded ipcMainConfig");
// Initialize cron tasks after loading ipcMainConfig
await module.initializeCronTasks();
log.info("Cron tasks initialized successfully");
try {
await initializeCronTasks();
log.info("Cron tasks initialized successfully");
} catch (error) {
log.warn("Non-fatal: Failed to initialize cron tasks", {
...ErrorTypeCheck(error),
});
}
} catch (error) {
log.error("Failed to load ipcMainConfig or initialize cron tasks", {
log.error("Fatal: Failed to load ipcMainConfig", {
...ErrorTypeCheck(error),
});
throw error; // Adjust based on whether the app should continue
}
//Create Tray
@@ -568,15 +573,10 @@ app.whenReady().then(async () => {
app.on("open-url", (event: Electron.Event, url: string) => {
event.preventDefault();
//Don't do anything for now. We just want to open the app.
if (url.startsWith(`${protocol}://keep-alive`)) {
log.info("Keep-alive protocol received.");
if (BrowserWindow.getAllWindows().length === 0) {
isKeepAliveLaunch = true;
openMainWindow(); // Launch app if not running
}
// Do nothing if already running
return; // Skip openMainWindow to avoid focusing the window
// Do nothing, whether app is running or not
return;
} else {
openInExplorer(url);
}