Skip to content

Commit

Permalink
Merge branch 'dev' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc committed Jun 12, 2024
2 parents a8bd172 + c2a7f58 commit eaf30f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions electron/src/runtime/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const checkSingleInstance = async () => {
logger.info('Checking if we are the first instance ...', isFirstInstance);

if (!EnvironmentUtil.platform.IS_WINDOWS && !isFirstInstance) {
await quit(false);
await quit();
} else {
app.on('second-instance', () => WindowManager.showPrimaryWindow());
}
Expand Down Expand Up @@ -83,7 +83,7 @@ export const addRelaunchListeners = (listener: () => void) => {
relaunchListeners.push(listener);
};

export const quit = async (clearCache = true): Promise<void> => {
export const quit = async (clearCache = false): Promise<void> => {
logger.info('Initiating app quit ...');
settings.persistToFile();

Expand Down
8 changes: 5 additions & 3 deletions electron/src/update/squirrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,26 @@ async function scheduleUpdate(): Promise<void> {

export async function handleSquirrelArgs(): Promise<void> {
const squirrelEvent = process.argv[1];
// See https://github.com/Squirrel/Squirrel.Windows/blob/develop/docs/using/custom-squirrel-events-non-cs.md

switch (squirrelEvent) {
case SQUIRREL_EVENT.INSTALL:
case SQUIRREL_EVENT.UPDATED: {
logger.info(`Creating shortcuts for exe ${exePath}...`);
await createShortcuts(exePath);
await lifecycle.quit();
await lifecycle.quit(true);
return;
}

case SQUIRREL_EVENT.UNINSTALL: {
await removeShortcuts();
await lifecycle.quit();
await lifecycle.quit(true);
return;
}

case SQUIRREL_EVENT.OBSOLETE: {
await lifecycle.quit();
// This is called when the app is updated but the old version is still running
await lifecycle.quit(true);
return;
}
}
Expand Down

0 comments on commit eaf30f0

Please sign in to comment.