From 2dbe0e997ee0633599a2c39caa945f6e723a3e07 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Thu, 6 Oct 2022 08:17:59 +0530 Subject: [PATCH] SDA-3913 (Set up first time launch for auto updated version) (#1513) * SDA-3913 - Set up first time launch for auto updated version * SDA-3913 - Read temp global config file and fix installer.nsh file --- build/installer.nsh | 6 +++--- src/app/config-handler.ts | 23 +++++++++++++++++++---- src/app/main-api-handler.ts | 4 ---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/build/installer.nsh b/build/installer.nsh index 73cecede..a747e02c 100644 --- a/build/installer.nsh +++ b/build/installer.nsh @@ -25,8 +25,8 @@ FunctionEnd !macroend !macro copyLocalGlobalConfig - IfFileExists $LOCALAPPDATA\Symphony\Symphony\config\Symphony.config 0 +2 - CopyFiles /SILENT $LOCALAPPDATA\Symphony\Symphony\config\Symphony.config $WINDIR\Temp\temp-local-Symphony.config + IfFileExists $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config 0 +2 + CopyFiles /SILENT $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config $WINDIR\Temp\temp-local-Symphony.config !macroend !macro replaceSystemGlobalConfig @@ -36,7 +36,7 @@ FunctionEnd !macro replaceLocalGlobalConfig IfFileExists $WINDIR\Temp\temp-local-Symphony.config 0 +2 - CopyFiles /SILENT $WINDIR\Temp\temp-local-Symphony.config $PROGRAMFILES64\Symphony\Symphony\config\Symphony.config + CopyFiles /SILENT $WINDIR\Temp\temp-local-Symphony.config $LOCALAPPDATA\Programs\Symphony\Symphony\config\Symphony.config !macroend !macro bothM diff --git a/src/app/config-handler.ts b/src/app/config-handler.ts index f69fcefb..faf83076 100644 --- a/src/app/config-handler.ts +++ b/src/app/config-handler.ts @@ -402,6 +402,7 @@ class Config { filteredFields.buildNumber = buildNumber; filteredFields.installVariant = this.installVariant; filteredFields.bootCount = 0; + filteredFields.startedAfterAutoUpdate = false; logger.info( `config-handler: setting first time launch for build`, buildNumber, @@ -413,6 +414,7 @@ class Config { buildNumber, installVariant: this.installVariant, bootCount: this.bootCount, + startedAfterAutoUpdate: false, }); } @@ -579,10 +581,9 @@ class Config { this.userConfig && (this.userConfig as IConfig).startedAfterAutoUpdate ) { - await this.updateUserConfig({ - installVariant: this.installVariant, - startedAfterAutoUpdate: false, - }); + // Update config as usual + await this.setUpFirstTimeLaunch(); + // Skip welcome screen this.isFirstTime = false; return; } @@ -706,6 +707,20 @@ class Config { `Global config file missing! App will not run as expected!`, ); } + if (fs.existsSync(this.tempGlobalConfigFilePath)) { + this.globalConfig = this.parseConfigData( + fs.readFileSync(this.tempGlobalConfigFilePath, 'utf8'), + ); + logger.info( + `config-handler: temp global config exists using this file: `, + this.tempGlobalConfigFilePath, + this.globalConfig, + ); + if (isMac) { + this.copyGlobalConfig(); + } + return; + } this.globalConfig = this.parseConfigData( fs.readFileSync(this.globalConfigPath, 'utf8'), ); diff --git a/src/app/main-api-handler.ts b/src/app/main-api-handler.ts index a53be1f4..f5375aa9 100644 --- a/src/app/main-api-handler.ts +++ b/src/app/main-api-handler.ts @@ -13,7 +13,6 @@ import { IApiArgs, INotificationData, } from '../common/api-interface'; -import { isMac } from '../common/env'; import { i18n, LocaleType } from '../common/i18n'; import { logger } from '../common/logger'; import { activityDetection } from './activity-detection'; @@ -353,9 +352,6 @@ ipcMain.on( break; case apiCmds.setPodUrl: await config.updateUserConfig({ url: arg.newPodUrl }); - if (isMac) { - config.copyGlobalConfig(); - } app.relaunch(); app.exit(); break;