From 310186f2ddadb3e78de5ca11575c80ad58c8c561 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Sat, 13 Jun 2020 11:42:57 +0530 Subject: [PATCH] fix: SDA-2068: show welcome screen per installation (#1020) * SDA-2068: show welcome screen per installation - macOS * SDA-2068: show welcome screen per installation - windows Signed-off-by: Vishwas Shashidhar * SDA-2068: support welcome screen on install for Windows --- config/InstallVariant.info | 1 + installer/mac/postinstall.sh | 8 +++- installer/win/Symphony-x64.aip | 18 ++++++--- package-lock.json | 71 +++++++++++++++++++--------------- package.json | 1 + src/app/config-handler.ts | 34 ++++++++++++---- 6 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 config/InstallVariant.info diff --git a/config/InstallVariant.info b/config/InstallVariant.info new file mode 100644 index 00000000..7a99f6fd --- /dev/null +++ b/config/InstallVariant.info @@ -0,0 +1 @@ +014EDEDF-E632-4E53-AAEC-B4FC8AF1E72D \ No newline at end of file diff --git a/installer/mac/postinstall.sh b/installer/mac/postinstall.sh index 8814195f..ead322c4 100755 --- a/installer/mac/postinstall.sh +++ b/installer/mac/postinstall.sh @@ -4,8 +4,10 @@ settingsFilePath='/tmp/sym_settings.txt' permissionsFilePath='/tmp/sym_permissions.txt' installPath="$2" -configPath="/Symphony.app/Contents/config/Symphony.config" -newPath=${installPath}${configPath} +configPath="/Symphony.app/Contents/config" +configFilePath="${installPath}${configPath}/Symphony.config" +installVariantPath="${installPath}${configPath}/InstallVariant.info" +newPath=${configFilePath} ## Get Symphony Settings from the temp file ## pod_url=$(sed -n '1p' ${settingsFilePath}); @@ -62,3 +64,5 @@ sed -i "" -E "s#\"openExternal\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"o ## Remove the temp settings & permissions file created ## rm -f ${settingsFilePath} rm -f ${permissionsFilePath} + +uuidgen > ${installVariantPath} \ No newline at end of file diff --git a/installer/win/Symphony-x64.aip b/installer/win/Symphony-x64.aip index b7e60907..cfaa99e0 100644 --- a/installer/win/Symphony-x64.aip +++ b/installer/win/Symphony-x64.aip @@ -30,6 +30,7 @@ + @@ -164,6 +165,7 @@ + @@ -176,7 +178,7 @@ - + @@ -448,7 +450,7 @@ - + @@ -534,9 +536,9 @@ - - - + + + @@ -544,6 +546,8 @@ + + @@ -556,6 +560,7 @@ + @@ -583,6 +588,7 @@ + @@ -691,8 +697,10 @@ + + diff --git a/package-lock.json b/package-lock.json index d55855ff..b35b022f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5553,22 +5553,14 @@ } }, "electron": { - "version": "9.0.0", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-9.0.0.tgz", - "integrity": "sha1-M1zUJqilQq2NTJbAxAqGaKtVJ7g=", + "version": "9.0.2", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-9.0.2.tgz", + "integrity": "sha1-NhkkzoMzlvGkWsIZX0QrkutPj10=", "dev": true, "requires": { "@electron/get": "^1.0.1", "@types/node": "^12.0.12", "extract-zip": "^1.0.3" - }, - "dependencies": { - "@types/node": { - "version": "12.12.39", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/@types/node/-/node-12.12.39.tgz", - "integrity": "sha1-Uy0lweY52J3W86odezli4+f6lD0=", - "dev": true - } } }, "electron-builder": { @@ -8107,19 +8099,19 @@ } }, "global-agent": { - "version": "2.1.8", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/global-agent/-/global-agent-2.1.8.tgz", - "integrity": "sha1-mdFTZissBMvBGZ/7wIGjqmVqxQ8=", + "version": "2.1.12", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/global-agent/-/global-agent-2.1.12.tgz", + "integrity": "sha1-5K44Ercxqegcv4Jfk3fvRQqOQZU=", "dev": true, "optional": true, "requires": { - "boolean": "^3.0.0", - "core-js": "^3.6.4", + "boolean": "^3.0.1", + "core-js": "^3.6.5", "es6-error": "^4.1.1", - "matcher": "^2.1.0", - "roarr": "^2.15.2", - "semver": "^7.1.2", - "serialize-error": "^5.0.0" + "matcher": "^3.0.0", + "roarr": "^2.15.3", + "semver": "^7.3.2", + "serialize-error": "^7.0.1" }, "dependencies": { "core-js": { @@ -8129,6 +8121,23 @@ "dev": true, "optional": true }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ=", + "dev": true, + "optional": true + }, + "matcher": { + "version": "3.0.0", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/matcher/-/matcher-3.0.0.tgz", + "integrity": "sha1-vZBg9MW3CqgEHMxvgDaHYJlPMMo=", + "dev": true, + "optional": true, + "requires": { + "escape-string-regexp": "^4.0.0" + } + }, "semver": { "version": "7.3.2", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/semver/-/semver-7.3.2.tgz", @@ -8137,19 +8146,19 @@ "optional": true }, "serialize-error": { - "version": "5.0.0", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/serialize-error/-/serialize-error-5.0.0.tgz", - "integrity": "sha1-p+u82wOl1xpu2EYf/g/Boa/tYqw=", + "version": "7.0.1", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha1-8TYLBEf2H/tIPsQVfHN/q313jhg=", "dev": true, "optional": true, "requires": { - "type-fest": "^0.8.0" + "type-fest": "^0.13.1" } }, "type-fest": { - "version": "0.8.1", - "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha1-CeJJ696FHTseSNJ8EFREZn8XuD0=", + "version": "0.13.1", + "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha1-AXLLW86AsL1ULqNI21DH4hg02TQ=", "dev": true, "optional": true } @@ -14915,16 +14924,16 @@ } }, "screen-share-indicator-frame": { - "version": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#c48f25a170fbf18361d109e58d391d105ca7efc5", - "from": "screen-share-indicator-frame@git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#c48f25a170fbf18361d109e58d391d105ca7efc5", + "version": "1.4.9", + "resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#11d7b82ae1b68ed88d2e9c5c84986aaab280ff00", "optional": true, "requires": { "run-script-os": "1.0.7" } }, "screen-snippet": { - "version": "git+https://github.com/symphonyoss/ScreenSnippet2.git#da09ae15a9ca2978606548bc36e8eaa224128f45", - "from": "screen-snippet@git+https://github.com/symphonyoss/ScreenSnippet2.git#da09ae15a9ca2978606548bc36e8eaa224128f45", + "version": "1.0.9", + "resolved": "git+https://github.com/symphonyoss/ScreenSnippet2.git#31f9fcbbd4750084307c830e2357eb22675eb77c", "optional": true }, "semver": { diff --git a/package.json b/package.json index 5e2780b4..bd2c6ff6 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "extraFiles": [ "config/Symphony.config", "config/titleBarStyles.css", + "config/InstallVariant.info", "dictionaries/**", "library/libsymphonysearch.dylib", "library/indexvalidator.exec", diff --git a/src/app/config-handler.ts b/src/app/config-handler.ts index a4a65145..15172e44 100644 --- a/src/app/config-handler.ts +++ b/src/app/config-handler.ts @@ -37,6 +37,7 @@ export interface IConfig { notificationSettings: INotificationSetting; mainWinPos?: ICustomRectangle; locale?: string; + installVariant?: string; } export interface IGlobalConfig { @@ -113,7 +114,10 @@ class Config { public cloudConfig: ICloudConfig | {}; public filteredCloudConfig: ICloudConfig | {}; private isFirstTime: boolean = true; + private installVariant: string | undefined; private readonly configFileName: string; + private readonly installVariantFilename: string; + private readonly installVariantPath: string; private readonly userConfigPath: string; private readonly appPath: string; private readonly globalConfigPath: string; @@ -121,6 +125,7 @@ class Config { constructor() { this.configFileName = 'Symphony.config'; + this.installVariantFilename = 'InstallVariant.info'; this.userConfigPath = path.join(app.getPath('userData'), this.configFileName); this.cloudConfigPath = path.join(app.getPath('userData'), 'cloudConfig.config'); this.appPath = isDevEnv ? app.getAppPath() : path.dirname(app.getPath('exe')); @@ -128,8 +133,13 @@ class Config { ? path.join(this.appPath, path.join('config', this.configFileName)) : path.join(this.appPath, (isMac) ? '..' : '', 'config', this.configFileName); + this.installVariantPath = isDevEnv + ? path.join(this.appPath, path.join('config', this.installVariantFilename)) + : path.join(this.appPath, (isMac) ? '..' : '', 'config', this.installVariantFilename); + if (isLinux) { this.globalConfigPath = path.join(this.appPath, (isElectronQA) ? '..' : '', 'config', this.configFileName); + this.installVariantPath = path.join(this.appPath, (isElectronQA) ? '..' : '', 'config', this.installVariantFilename); } this.globalConfig = {}; @@ -138,6 +148,7 @@ class Config { this.filteredCloudConfig = {}; this.readUserConfig(); this.readGlobalConfig(); + this.readInstallVariant(); this.readCloudConfig(); this.checkFirstTimeLaunch(); @@ -263,10 +274,11 @@ class Config { ...filteredFields }: IConfig = this.userConfig as IConfig; // update to the new build number filteredFields.buildNumber = buildNumber; + filteredFields.installVariant = this.installVariant; logger.info(`config-handler: setting first time launch for build`, buildNumber); return await this.updateUserConfig(filteredFields); } - await this.updateUserConfig({ buildNumber }); + await this.updateUserConfig({ buildNumber, installVariant: this.installVariant }); } /** @@ -332,6 +344,14 @@ class Config { logger.info(`config-handler: Global configuration: `, this.globalConfig); } + /** + * Reads the install variant from a file + */ + private readInstallVariant() { + this.installVariant = fs.readFileSync(this.installVariantPath, 'utf8'); + logger.info(`config-handler: Install variant: `, this.installVariant); + } + /** * Reads and stores the cloud config file * @@ -354,20 +374,20 @@ class Config { */ private async checkFirstTimeLaunch() { logger.info('config-handler: checking first time launch'); - const configBuildNumber = this.userConfig && (this.userConfig as IConfig).buildNumber || null; + const installVariant = this.userConfig && (this.userConfig as IConfig).installVariant || null; - if (!configBuildNumber) { - logger.info(`config-handler: there's no build number found, this is a first time launch`); + if (!installVariant) { + logger.info(`config-handler: there's no install variant found, this is a first time launch`); this.isFirstTime = true; return; } - if (configBuildNumber && typeof configBuildNumber === 'string' && configBuildNumber !== buildNumber) { - logger.info(`config-handler: build number found is of an older build, this is a first time launch`); + if (installVariant && typeof installVariant === 'string' && installVariant !== this.installVariant) { + logger.info(`config-handler: install variant found is of a different instance, this is a first time launch`); this.isFirstTime = true; return; } - logger.info(`config-handler: build number is the same as the previous build, not a first time launch`); + logger.info(`config-handler: install variant is the same as the existing one, not a first time launch`); this.isFirstTime = false; } }