mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-28 09:51:06 -06:00
ELECTRON-1247 (Remove old Symphony launch agent plist file) (#658)
* ELECTRON-1247 - Remove old Symphony launch agent * ELECTRON-1247 - Rearrange dependency * ELECTRON-1247 - Remove config path logs * ELECTRON-1247 - Add log for removing old launch agent
This commit is contained in:
parent
fa79bde23a
commit
fe77bc259b
@ -111,6 +111,7 @@
|
||||
"dependencies": {
|
||||
"archiver": "3.0.0",
|
||||
"async.map": "0.5.2",
|
||||
"auto-launch": "5.0.5",
|
||||
"classnames": "2.2.6",
|
||||
"electron-dl": "1.14.0",
|
||||
"electron-fetch": "1.3.0",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import AutoLaunch = require('auto-launch');
|
||||
import { app, LoginItemSettings } from 'electron';
|
||||
|
||||
import { isMac } from '../common/env';
|
||||
@ -57,6 +58,11 @@ class AutoLaunchController {
|
||||
const { launchOnStartup }: IConfig = config.getConfigFields([ 'launchOnStartup' ]);
|
||||
const { openAtLogin: isAutoLaunchEnabled }: LoginItemSettings = this.isAutoLaunchEnabled();
|
||||
|
||||
if (isMac) {
|
||||
// TODO: Remove this method in the future
|
||||
await this.removeOldLaunchAgent();
|
||||
}
|
||||
|
||||
if (typeof launchOnStartup === 'boolean' && launchOnStartup) {
|
||||
if (!isAutoLaunchEnabled) {
|
||||
this.enableAutoLaunch();
|
||||
@ -67,6 +73,21 @@ class AutoLaunchController {
|
||||
this.disableAutoLaunch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes old Symphony launch agent if exists
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
private async removeOldLaunchAgent(): Promise<void> {
|
||||
const autoLaunch = new AutoLaunch(props);
|
||||
try {
|
||||
await autoLaunch.disable();
|
||||
logger.info(`auto-launch-controller: Old Symphony launch agent has been successfully removed`);
|
||||
} catch (e) {
|
||||
logger.error(`auto-launch-controller: Old Symphony launch agent failed to remove ${e}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const autoLaunchInstance = new AutoLaunchController();
|
||||
|
Loading…
Reference in New Issue
Block a user