diff --git a/package.json b/package.json index 315ceec..8ab6ead 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bodyshop-desktop", - "version": "0.0.1-alpha.8", + "version": "0.0.1-alpha.10", "description": "Shop Management System Partner", "main": "./out/main/index.js", "author": "Convenient Brands, LLC", diff --git a/src/main/setup-keep-alive-agent.ts b/src/main/setup-keep-alive-agent.ts index 60ae2b4..1f924c0 100644 --- a/src/main/setup-keep-alive-agent.ts +++ b/src/main/setup-keep-alive-agent.ts @@ -19,7 +19,7 @@ export async function setupKeepAliveAgent(): Promise { com.convenientbrands.bodyshop-desktop.keepalive ProgramArguments - open + Shop Partner Keep Alive imexmedia://keep-alive RunAtLoad @@ -30,8 +30,8 @@ export async function setupKeepAliveAgent(): Promise { `; const plistPath = join( - homedir(), - "Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", + homedir(), + "/Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", ); try { @@ -40,15 +40,17 @@ export async function setupKeepAliveAgent(): Promise { log.info(`Launch agent created and loaded: ${stdout}`); if (stderr) log.warn(`Launch agent stderr: ${stderr}`); } catch (error) { - log.error(`Error setting up launch agent: ${error instanceof Error ? error.message : String(error)}`); + log.error( + `Error setting up launch agent: ${error instanceof Error ? error.message : String(error)}`, + ); throw error; // Rethrow to allow caller to handle } } export async function isKeepAliveAgentInstalled(): Promise { const plistPath = join( - homedir(), - "Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", + homedir(), + "/Library/LaunchAgents/com.convenientbrands.bodyshop-desktop.keepalive.plist", ); const maxRetries = 3; const retryDelay = 500; // 500ms delay between retries @@ -56,10 +58,14 @@ export async function isKeepAliveAgentInstalled(): Promise { for (let attempt = 1; attempt <= maxRetries; attempt++) { try { await fs.access(plistPath, fs.constants.F_OK); - const { stdout } = await execPromise(`launchctl list | grep com.convenientbrands.bodyshop-desktop.keepalive`); + const { stdout } = await execPromise( + `launchctl list | grep com.convenientbrands.bodyshop-desktop.keepalive`, + ); return !!stdout; // Return true if plist exists and agent is loaded } catch (error) { - log.debug(`Launch agent not found (attempt ${attempt}/${maxRetries}): ${error instanceof Error ? error.message : String(error)}`); + log.debug( + `Launch agent not found (attempt ${attempt}/${maxRetries}): ${error instanceof Error ? error.message : String(error)}`, + ); if (attempt === maxRetries) { return false; // Return false after all retries fail } @@ -68,4 +74,4 @@ export async function isKeepAliveAgentInstalled(): Promise { } } return false; // Fallback return -} \ No newline at end of file +}