From 4b499e656e9e8b97c4b24aa8a08f320bd2fcc7f6 Mon Sep 17 00:00:00 2001 From: haritabh-z01 Date: Fri, 4 Jul 2025 15:47:04 +0530 Subject: [PATCH] chore: set up notarization --- apps/desktop/forge.config.ts | 17 +++++++++++------ apps/desktop/src/main/core/app-manager.ts | 5 ++++- apps/desktop/src/main/core/window-manager.ts | 14 ++++++++++++-- apps/desktop/src/main/main.ts | 3 ++- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/apps/desktop/forge.config.ts b/apps/desktop/forge.config.ts index e64f2e3..4702515 100644 --- a/apps/desktop/forge.config.ts +++ b/apps/desktop/forge.config.ts @@ -245,6 +245,7 @@ const config: ForgeConfig = { name: "Amical", executableName: "Amical", icon: "./assets/logo.icns", // Path to your icon file + appBundleId: "com.amical.desktop", // Proper bundle ID extraResource: [ "../../packages/native-helpers/swift-helper/bin", "./src/db/migrations", @@ -261,13 +262,17 @@ const config: ForgeConfig = { osxSign: { identity: process.env.CODESIGNING_IDENTITY, }, + // Notarization for macOS + ...(process.env.SKIP_NOTARIZATION === "true" + ? {} + : { + osxNotarize: { + appleId: process.env.APPLE_ID!, + appleIdPassword: process.env.APPLE_APP_PASSWORD!, + teamId: process.env.APPLE_TEAM_ID!, + }, + }), }), - // Notarization for macOS (configure when ready for distribution) - // osxNotarize: { - // appleId: process.env.APPLE_ID, - // appleIdPassword: process.env.APPLE_APP_PASSWORD, - // teamId: process.env.APPLE_TEAM_ID, - // }, //! issues with monorepo setup and module resolutions //! when forge walks paths via flora-colossus prune: false, diff --git a/apps/desktop/src/main/core/app-manager.ts b/apps/desktop/src/main/core/app-manager.ts index 9a776e4..eb4bc6e 100644 --- a/apps/desktop/src/main/core/app-manager.ts +++ b/apps/desktop/src/main/core/app-manager.ts @@ -72,8 +72,11 @@ export class AppManager { this.windowManager.createOrShowMainWindow(); // tRPC handler is now set up in WindowManager when windows are created - if (process.platform === "darwin" && app.dock) { + if (app.dock) { app.dock.show(); + logger.main.info("Explicitly showing app in dock"); + } else { + logger.main.warn("app.dock is not available"); } } diff --git a/apps/desktop/src/main/core/window-manager.ts b/apps/desktop/src/main/core/window-manager.ts index e82e819..e35537b 100644 --- a/apps/desktop/src/main/core/window-manager.ts +++ b/apps/desktop/src/main/core/window-manager.ts @@ -42,10 +42,15 @@ export class WindowManager { ); } - this.mainWindow.on("closed", () => { + this.mainWindow.on("close", () => { + // Detach window before it's destroyed ServiceManager.getInstance()! .getTRPCHandler()! .detachWindow(this.mainWindow!); + }); + + this.mainWindow.on("closed", () => { + // Window is already destroyed, just clean up reference this.mainWindow = null; }); @@ -92,10 +97,15 @@ export class WindowManager { ); } - this.widgetWindow.on("closed", () => { + this.widgetWindow.on("close", () => { + // Detach window before it's destroyed ServiceManager.getInstance()! .getTRPCHandler()! .detachWindow(this.widgetWindow!); + }); + + this.widgetWindow.on("closed", () => { + // Window is already destroyed, just clean up reference this.widgetWindow = null; }); diff --git a/apps/desktop/src/main/main.ts b/apps/desktop/src/main/main.ts index e6d3b70..10c6659 100644 --- a/apps/desktop/src/main/main.ts +++ b/apps/desktop/src/main/main.ts @@ -4,6 +4,7 @@ dotenv.config(); import { app } from "electron"; import started from "electron-squirrel-startup"; import { AppManager } from "./core/app-manager"; +import { updateElectronApp } from "update-electron-app"; if (started) { app.quit(); @@ -11,7 +12,7 @@ if (started) { // Set up auto-updater for production builds if (app.isPackaged) { - require("update-electron-app")(); + updateElectronApp(); } const appManager = new AppManager();