Merge pull request #1892 from NguyenTranHoangSym/SDA-4223

SDA-4223: Add new option to overwrite auto-update pmp
This commit is contained in:
NguyenTranHoangSym 2023-07-13 16:41:06 +07:00 committed by GitHub
commit 028292b6d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 4 deletions

View File

@ -45,6 +45,11 @@ sed -i "" -E "s#\"devToolsEnabled\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#
sed -i "" -E "s#\"enableBrowserLogin\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"enableBrowserLogin\":\ $enable_browser_login#g" "${newPath}" sed -i "" -E "s#\"enableBrowserLogin\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"enableBrowserLogin\":\ $enable_browser_login#g" "${newPath}"
sed -i "" -E "s#\"browserLoginAutoConnect\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"browserLoginAutoConnect\":\ $browser_login_autoconnect#g" "${newPath}" sed -i "" -E "s#\"browserLoginAutoConnect\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"browserLoginAutoConnect\":\ $browser_login_autoconnect#g" "${newPath}"
## Add settings force auto update
force_auto_update=$(sed -n '10p' ${settingsFilePath});
if [ "$force_auto_update" = "" ]; then force_auto_update=false; fi
sed -i "" -E "s#\"forceAutoUpdate\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"forceAutoUpdate\":\ $force_auto_update#g" "${newPath}"
## Get Symphony Permissions from the temp file ## ## Get Symphony Permissions from the temp file ##
media=$(sed -n '1p' ${permissionsFilePath}); media=$(sed -n '1p' ${permissionsFilePath});
geo_location=$(sed -n '2p' ${permissionsFilePath}); geo_location=$(sed -n '2p' ${permissionsFilePath});

View File

@ -160,6 +160,7 @@ class Script
new PublicProperty("OVERRIDE_USER_AGENT", "false"), new PublicProperty("OVERRIDE_USER_AGENT", "false"),
new PublicProperty("ENABLE_BROWSER_LOGIN", "false"), new PublicProperty("ENABLE_BROWSER_LOGIN", "false"),
new PublicProperty("BROWSER_LOGIN_AUTOCONNECT", "false"), new PublicProperty("BROWSER_LOGIN_AUTOCONNECT", "false"),
new PublicProperty("FORCE_AUTO_UPDATE","false"),
new PublicProperty("CHROME_FLAGS", ""), new PublicProperty("CHROME_FLAGS", ""),
new Property("MSIINSTALLPERUSER", "1"), new Property("MSIINSTALLPERUSER", "1"),
new Property("PROGRAMSFOLDER", System.Environment.ExpandEnvironmentVariables(@"%PROGRAMFILES%")) new Property("PROGRAMSFOLDER", System.Environment.ExpandEnvironmentVariables(@"%PROGRAMFILES%"))
@ -188,7 +189,7 @@ class Script
new ElevatedManagedAction(CustomActions.UpdateConfig, Return.check, When.After, Step.InstallFiles, Condition.NOT_BeingRemoved ) new ElevatedManagedAction(CustomActions.UpdateConfig, Return.check, When.After, Step.InstallFiles, Condition.NOT_BeingRemoved )
{ {
// The UpdateConfig action needs the built-in property INSTALLDIR as well as most of the custom properties // The UpdateConfig action needs the built-in property INSTALLDIR as well as most of the custom properties
UsesProperties = "INSTALLDIR,POD_URL,CONTEXT_ORIGIN_URL,MINIMIZE_ON_CLOSE,ALWAYS_ON_TOP,AUTO_START,BRING_TO_FRONT,MEDIA,LOCATION,NOTIFICATIONS,MIDI_SYSEX,POINTER_LOCK,FULL_SCREEN,OPEN_EXTERNAL,CUSTOM_TITLE_BAR,DEV_TOOLS_ENABLED,AUTO_LAUNCH_PATH,USER_DATA_PATH,OVERRIDE_USER_AGENT,CHROME_FLAGS,ENABLE_BROWSER_LOGIN,BROWSER_LOGIN_AUTOCONNECT" UsesProperties = "INSTALLDIR,POD_URL,CONTEXT_ORIGIN_URL,MINIMIZE_ON_CLOSE,ALWAYS_ON_TOP,AUTO_START,BRING_TO_FRONT,MEDIA,LOCATION,NOTIFICATIONS,MIDI_SYSEX,POINTER_LOCK,FULL_SCREEN,OPEN_EXTERNAL,CUSTOM_TITLE_BAR,DEV_TOOLS_ENABLED,AUTO_LAUNCH_PATH,USER_DATA_PATH,OVERRIDE_USER_AGENT,CHROME_FLAGS,ENABLE_BROWSER_LOGIN,BROWSER_LOGIN_AUTOCONNECT,FORCE_AUTO_UPDATE"
}, },
// CleanRegistry // CleanRegistry
@ -364,6 +365,7 @@ public class CustomActions
data = ReplaceBooleanProperty(data, "overrideUserAgent", session.Property("OVERRIDE_USER_AGENT")); data = ReplaceBooleanProperty(data, "overrideUserAgent", session.Property("OVERRIDE_USER_AGENT"));
data = ReplaceBooleanProperty(data, "enableBrowserLogin", session.Property("ENABLE_BROWSER_LOGIN")); data = ReplaceBooleanProperty(data, "enableBrowserLogin", session.Property("ENABLE_BROWSER_LOGIN"));
data = ReplaceBooleanProperty(data, "browserLoginAutoConnect", session.Property("BROWSER_LOGIN_AUTOCONNECT")); data = ReplaceBooleanProperty(data, "browserLoginAutoConnect", session.Property("BROWSER_LOGIN_AUTOCONNECT"));
data = ReplaceBooleanProperty(data, "forceAutoUpdate", session.Property("FORCE_AUTO_UPDATE"));
// Write the contents back to the file // Write the contents back to the file
System.IO.File.WriteAllText(filename, data); System.IO.File.WriteAllText(filename, data);
} }

View File

@ -565,6 +565,20 @@ Expected values:
* "false" * "false"
User will need to click on Login button to start browser login flow. User will need to click on Login button to start browser login flow.
-------------------------------------------------------------------
### FORCE_AUTO_UPDATE
The provided property will enable user ability to overwrite PMP settings of auto update. Thus,
the update option will take "FORCE_AUTO_UPDATE" first then consider PMP later
By default its value will be 'false'
Expected values:
* "true"
Allow user to check for update regardless conditions
* "false"
Will also consider PMP settings
#### Example, install with browser login autoconnect enabled #### Example, install with browser login autoconnect enabled
msiexec /i Symphony.msi BROWSER_LOGIN_AUTOCONNECT="true" msiexec /i Symphony.msi BROWSER_LOGIN_AUTOCONNECT="true"
@ -576,3 +590,10 @@ Expected values:
or or
msiexec /i Symphony.msi msiexec /i Symphony.msi
#### Example, install with force auto-update
msiexec /i Symphony.msi FORCE_AUTO_UPDATE="true"
or
msiexec /i Symphony.msi
This equals to msiexec /i Symphony.msi FORCE_AUTO_UPDATE="false"

View File

@ -85,6 +85,7 @@ const menuItemConfigFields = [
'devToolsEnabled', 'devToolsEnabled',
'isAutoUpdateEnabled', 'isAutoUpdateEnabled',
'enableBrowserLogin', 'enableBrowserLogin',
'forceAutoUpdate',
]; ];
let { let {
@ -97,6 +98,7 @@ let {
devToolsEnabled, devToolsEnabled,
isAutoUpdateEnabled, isAutoUpdateEnabled,
enableBrowserLogin, enableBrowserLogin,
forceAutoUpdate,
} = config.getConfigFields(menuItemConfigFields) as IConfig; } = config.getConfigFields(menuItemConfigFields) as IConfig;
let initialAnalyticsSent = false; let initialAnalyticsSent = false;
const CORP_URL = 'https://corporate.symphony.com'; const CORP_URL = 'https://corporate.symphony.com';
@ -243,6 +245,7 @@ export class AppMenu {
devToolsEnabled = configData.devToolsEnabled; devToolsEnabled = configData.devToolsEnabled;
isAutoUpdateEnabled = configData.isAutoUpdateEnabled; isAutoUpdateEnabled = configData.isAutoUpdateEnabled;
enableBrowserLogin = configData.enableBrowserLogin; enableBrowserLogin = configData.enableBrowserLogin;
forceAutoUpdate = configData.forceAutoUpdate;
// fetch updated cloud config // fetch updated cloud config
this.cloudConfig = config.getFilteredCloudConfigFields( this.cloudConfig = config.getFilteredCloudConfigFields(
this.menuItemConfigFields, this.menuItemConfigFields,
@ -307,7 +310,10 @@ export class AppMenu {
click: (_item) => { click: (_item) => {
autoUpdate.checkUpdates(AutoUpdateTrigger.MANUAL); autoUpdate.checkUpdates(AutoUpdateTrigger.MANUAL);
}, },
visible: isMac && !!isAutoUpdateEnabled && !!windowHandler.isMana, visible:
isMac &&
!!(isAutoUpdateEnabled || forceAutoUpdate) &&
!!windowHandler.isMana,
label: i18n.t('Check for updates')(), label: i18n.t('Check for updates')(),
}, },
this.buildSeparator(), this.buildSeparator(),
@ -706,7 +712,9 @@ export class AppMenu {
autoUpdate.checkUpdates(AutoUpdateTrigger.MANUAL); autoUpdate.checkUpdates(AutoUpdateTrigger.MANUAL);
}, },
visible: visible:
isWindowsOS && !!isAutoUpdateEnabled && !!windowHandler.isMana, isWindowsOS &&
!!(isAutoUpdateEnabled || forceAutoUpdate) &&
!!windowHandler.isMana,
label: i18n.t('Check for updates')(), label: i18n.t('Check for updates')(),
}, },
{ {

View File

@ -61,6 +61,7 @@ export interface IConfig {
enableBrowserLogin?: boolean; enableBrowserLogin?: boolean;
browserLoginAutoConnect?: boolean; browserLoginAutoConnect?: boolean;
betaAutoUpdateChannelEnabled?: boolean; betaAutoUpdateChannelEnabled?: boolean;
forceAutoUpdate?: boolean;
} }
export interface IGlobalConfig { export interface IGlobalConfig {

View File

@ -1089,6 +1089,7 @@ export const updateFeaturesForCloudConfig = async (
memoryThreshold, memoryThreshold,
isAutoUpdateEnabled, isAutoUpdateEnabled,
autoUpdateCheckInterval, autoUpdateCheckInterval,
forceAutoUpdate,
} = config.getConfigFields([ } = config.getConfigFields([
'launchOnStartup', 'launchOnStartup',
'alwaysOnTop', 'alwaysOnTop',
@ -1096,6 +1097,7 @@ export const updateFeaturesForCloudConfig = async (
'memoryThreshold', 'memoryThreshold',
'isAutoUpdateEnabled', 'isAutoUpdateEnabled',
'autoUpdateCheckInterval', 'autoUpdateCheckInterval',
'forceAutoUpdate',
]) as IConfig; ]) as IConfig;
const mainWebContents = windowHandler.getMainWebContents(); const mainWebContents = windowHandler.getMainWebContents();
@ -1147,7 +1149,7 @@ export const updateFeaturesForCloudConfig = async (
// SDA auto updater // SDA auto updater
logger.info(`window-utils: initiate auto update?`, isAutoUpdateEnabled); logger.info(`window-utils: initiate auto update?`, isAutoUpdateEnabled);
if (isAutoUpdateEnabled) { if (forceAutoUpdate || isAutoUpdateEnabled) {
if (!autoUpdateIntervalId) { if (!autoUpdateIntervalId) {
// randomised to avoid having all users getting SDA update at the same time // randomised to avoid having all users getting SDA update at the same time
autoUpdateIntervalId = setInterval(async () => { autoUpdateIntervalId = setInterval(async () => {