ELECTRON-1132 (Remove HKU registry entry on uninstalling the SDA) (#592)

* ELECTRON-1132 - Remove HKU registry entry on uninstalling the SDA

* ELECTRON-1132 - Change logic to use build number instead of version number to validate first time launch

* ELECTRON-1132 - Remove config exits check as we gracefully create a new config file
This commit is contained in:
Kiran Niranjan 2019-03-13 16:32:55 +05:30 committed by Vishwas Shashidhar
parent 491a0ca24e
commit 71eb796139
4 changed files with 12 additions and 23 deletions

View File

@ -596,7 +596,7 @@
<ROW Action="AI_AiRestoreRollback" Type="11521" Source="ResourceCleaner.dll" Target="OnAiRestoreRollback" WithoutSeq="true"/>
<ROW Action="AI_AuthorSinglePackage" Type="1" Source="aicustact.dll" Target="AI_AuthorSinglePackage" WithoutSeq="true"/>
<ROW Action="AI_DATA_SETTER" Type="51" Source="CustomActionData" Target="Symphony.exe"/>
<ROW Action="AI_DATA_SETTER_1" Type="51" Source="CustomActionData" Target="AEkAcwA2ADQAQgBpAHQAAgABAFAAYQByAGEAbQBzAAIAAQBTAGMAcgBpAHAAdAACACMAIABCAGwAbwBjAGsAIABmAG8AcgAgAGQAZQBjAGwAYQByAGkAbgBnACAAdABoAGUAIABzAGMAcgBpAHAAdAAgAHAAYQByAGEAbQBlAHQAZQByAHMALgANAAoAUABhAHIAYQBtACgAKQANAAoADQAKACMAIABZAG8AdQByACAAYwBvAGQAZQAgAGcAbwBlAHMAIABoAGUAcgBlAC4ADQAKAFIAZQBtAG8AdgBlAC0ASQB0AGUAbQBQAHIAbwBwAGUAcgB0AHkAIAAtAFAAYQB0AGgAIAAiAEgASwBDAFUAOgBTAG8AZgB0AHcAYQByAGUAXABNAGkAYwByAG8AcwBvAGYAdABcAFcAaQBuAGQAbwB3AHMAXABDAHUAcgByAGUAbgB0AFYAZQByAHMAaQBvAG4AXABSAHUAbgAiACAALQBOAGEAbQBlACAAIgBTAHkAbQBwAGgAbwBuAHkAIgAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMA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AUgBvAG8AdAAgAEgASwBFAFkAXwBDAEwAQQBTAFMARQBTAF8AUgBPAE8AVAAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoAUgBlAG0AbwB2AGUALQBpAHQAZQBtACAAIgBIAEsAQwBSADoAXABzAHkAbQBwAGgAbwBuAHkAIgAgAC0AUgBlAGMAdQByAHMAZQAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoADQAKAE4AZQB3AC0AUABTAEQAcgBpAHYAZQAgAC0ATgBhAG0AZQAgAEgASwBVACAALQBQAFMAUAByAG8AdgBpAGQAZQByACAAUgBlAGcAaQBzAHQAcgB5ACAALQBSAG8AbwB0ACAASABLAEUAWQBfAFUAUwBFAFIAUwAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoAUgBlAG0AbwB2AGUALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgAC0AUABhAHQAaAAgACIASABLAFUAOgAuAEQARQBGAEEAVQBMAFQAXABTAG8AZgB0AHcAYQByAGUAXABNAGkAYwByAG8AcwBvAGYAdABcAFcAaQBuAGQAbwB3AHMAXABDAHUAcgByAGUAbgB0AFYAZQByAHMAaQBvAG4AXABSAHUAbgAiACAALQBOAGEAbQBlACAAIgBTAHkAbQBwAGgAbwBuAHkAIgAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQ=="/>
<ROW Action="AI_DATA_SETTER_2" Type="51" Source="CustomActionData" Target="Symphony.exe"/>
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
<ROW Action="AI_DpiContentScale" Type="1" Source="aicustact.dll" Target="DpiContentScale"/>

View File

@ -578,7 +578,7 @@
<COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
<ROW Action="AI_AuthorSinglePackage" Type="1" Source="aicustact.dll" Target="AI_AuthorSinglePackage" WithoutSeq="true"/>
<ROW Action="AI_DATA_SETTER" Type="51" Source="CustomActionData" Target="Symphony.exe"/>
<ROW Action="AI_DATA_SETTER_1" Type="51" Source="CustomActionData" Target="AEkAcwA2ADQAQgBpAHQAAgABAFAAYQByAGEAbQBzAAIAAQBTAGMAcgBpAHAAdAACACMAIABCAGwAbwBjAGsAIABmAG8AcgAgAGQAZQBjAGwAYQByAGkAbgBnACAAdABoAGUAIABzAGMAcgBpAHAAdAAgAHAAYQByAGEAbQBlAHQAZQByAHMALgANAAoAUABhAHIAYQBtACgAKQANAAoADQAKACMAIABZAG8AdQByACAAYwBvAGQAZQAgAGcAbwBlAHMAIABoAGUAcgBlAC4ADQAKAFIAZQBtAG8AdgBlAC0ASQB0AGUAbQBQAHIAbwBwAGUAcgB0AHkAIAAtAFAAYQB0AGgAIAAiAEgASwBDAFUAOgBTAG8AZgB0AHcAYQByAGUAXABNAGkAYwByAG8AcwBvAGYAdABcAFcAaQBuAGQAbwB3AHMAXABDAHUAcgByAGUAbgB0AFYAZQByAHMAaQBvAG4AXABSAHUAbgAiACAALQBOAGEAbQBlACAAIgBTAHkAbQBwAGgAbwBuAHkAIgAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoAUgBlAG0AbwB2AGUALQBJAHQAZQBtACAAIgBIAEsAQwBVADoAUwBvAGYAdAB3AGEAcgBlAFwAQwBsAGEAcwBzAGUAcwBcAHMAeQBtAHAAaABvAG4AeQAiACAALQBSAGUAYwB1AHIAcwBlACAALQBFAHIAcgBvAHIAQQBjAHQAaQBvAG4AIABTAGkAbABlAG4AdABsAHkAQwBvAG4AdABpAG4AdQBlAA0ACgANAAoAUgBlAG0AbwB2AGUALQBJAHQAZQ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BpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoADQAKAE4AZQB3AC0AUABTAEQAcgBpAHYAZQAgAC0ATgBhAG0AZQAgAEgASwBVACAALQBQAFMAUAByAG8AdgBpAGQAZQByACAAUgBlAGcAaQBzAHQAcgB5ACAALQBSAG8AbwB0ACAASABLAEUAWQBfAFUAUwBFAFIAUwAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQANAAoAUgBlAG0AbwB2AGUALQBJAHQAZQBtAFAAcgBvAHAAZQByAHQAeQAgAC0AUABhAHQAaAAgACIASABLAFUAOgAuAEQARQBGAEEAVQBMAFQAXABTAG8AZgB0AHcAYQByAGUAXABNAGkAYwByAG8AcwBvAGYAdABcAFcAaQBuAGQAbwB3AHMAXABDAHUAcgByAGUAbgB0AFYAZQByAHMAaQBvAG4AXABSAHUAbgAiACAALQBOAGEAbQBlACAAIgBTAHkAbQBwAGgAbwBuAHkAIgAgAC0ARQByAHIAbwByAEEAYwB0AGkAbwBuACAAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQ=="/>
<ROW Action="AI_DATA_SETTER_2" Type="51" Source="CustomActionData" Target="Symphony.exe"/>
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
<ROW Action="AI_DpiContentScale" Type="1" Source="aicustact.dll" Target="DpiContentScale"/>

View File

@ -13,6 +13,7 @@ const isMac = require('./utils/misc.js').isMac;
const getRegistry = require('./utils/getRegistry.js');
const log = require('./log.js');
const logLevels = require('./enums/logLevels.js');
const { buildNumber } = require('../package.json');
const configFileName = 'Symphony.config';
@ -191,10 +192,10 @@ function updateConfigField(fieldName, newValue) {
return saveUserConfig(fieldName, newValue, config);
}, () => {
// in case config doesn't exist, can't read or is corrupted.
// add configVersion - just in case in future we need to provide
// add configBuildNumber - just in case in future we need to provide
// upgrade capabilities.
return saveUserConfig(fieldName, newValue, {
configVersion: app.getVersion().toString(),
configBuildNumber: buildNumber || '0',
});
});
}
@ -280,20 +281,12 @@ function updateUserConfigOnLaunch(resolve, reject) {
// we get the user config path using electron
const userConfigFile = path.join(app.getPath('userData'), configFileName);
// if it's not a per user installation or if the
// user config file doesn't exist, we simple move on
if (!fs.existsSync(userConfigFile)) {
log.send(logLevels.WARN, 'config: Could not find the user config file!');
return reject(new Error('config: Could not find the user config file!'));
}
// In case the file exists, we remove it so that all the
// values are fetched from the global config
// https://perzoinc.atlassian.net/browse/ELECTRON-126
return readUserConfig(userConfigFile).then((data) => {
// Add version info to the user config data
const version = app.getVersion().toString() || '1.0.0';
const updatedData = Object.assign(data || {}, { configVersion: version });
// Add build number info to the user config data
const updatedData = Object.assign(data || {}, { configBuildNumber: buildNumber || '0' });
updateUserConfig(updatedData)
.then(resolve)

View File

@ -24,7 +24,6 @@ const { setCheckboxValues } = require('./menus/menuTemplate.js');
const autoLaunch = require('./autoLaunch');
const { handleCacheFailureCheckOnStartup, handleCacheFailureCheckOnExit} = require('./cacheHandler');
const compareSemVersions = require('./utils/compareSemVersions.js');
const { isMac, isDevEnv } = require('./utils/misc.js');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
@ -314,24 +313,21 @@ function setupThenOpenMainWindow() {
function checkFirstTimeLaunch() {
return new Promise((resolve, reject) => {
getUserConfigField('configVersion')
.then((configVersion) => {
const appVersionString = app.getVersion().toString();
getUserConfigField('configBuildNumber')
.then((configBuildNumber) => {
const execPath = nodePath.dirname(app.getPath('exe'));
const shouldUpdateUserConfig = execPath.indexOf('AppData\\Local\\Programs') !== -1 || isMac;
if (!(configVersion
&& typeof configVersion === 'string'
&& (compareSemVersions.check(appVersionString, configVersion) !== 1))) {
if (configBuildNumber && typeof configBuildNumber === 'string' && configBuildNumber !== buildNumber) {
return setupFirstTimeLaunch(resolve, reject, shouldUpdateUserConfig);
}
log.send(logLevels.INFO, `not a first-time launch as
configVersion: ${configVersion} appVersion: ${appVersionString} shouldUpdateUserConfig: ${shouldUpdateUserConfig}`);
configBuildNumber: ${configBuildNumber} installerBuildNumber: ${buildNumber} shouldUpdateUserConfig: ${shouldUpdateUserConfig}`);
return resolve();
})
.catch((e) => {
log.send(logLevels.ERROR, `Error reading configVersion error: ${e}`);
return setupFirstTimeLaunch(resolve, reject, false);
return setupFirstTimeLaunch(resolve, reject, true);
});
});
}