SDA-4459 (Apply latest or beta channel based on user entitlement) (#2086)

* SDA-4459 - Apply latest or beta channel based on user entitlement

* SDA-4459 - Fix priority of conditions
This commit is contained in:
Kiran Niranjan 2024-02-12 16:16:34 +05:30 committed by GitHub
parent b172cc15aa
commit 8c0fa7be3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 85 additions and 30 deletions

View File

@ -1,7 +1,6 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Demo (Build &amp; Run)" type="NodeJSConfigurationType" application-parameters=". --url=file://$PROJECT_DIR$/src/demo/index.html" path-to-node="$PROJECT_DIR$/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron" working-dir="$PROJECT_DIR$"> <configuration default="false" name="Demo (Build &amp; Run)" type="NodeJSConfigurationType" application-parameters=". --url=file://$PROJECT_DIR$/src/demo/index.html" path-to-node="$PROJECT_DIR$/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron" working-dir="$PROJECT_DIR$">
<envs> <envs>
<env name="ELECTRON_FORCE_IS_PACKAGED" value="true" />
<env name="ELECTRON_DEBUGGING" value="true" /> <env name="ELECTRON_DEBUGGING" value="true" />
</envs> </envs>
<method v="2"> <method v="2">

View File

@ -45,5 +45,6 @@
"autoLaunchPath": "", "autoLaunchPath": "",
"userDataPath": "", "userDataPath": "",
"chromeFlags": "", "chromeFlags": "",
"betaAutoUpdateChannelEnabled": true "betaAutoUpdateChannelEnabled": true,
"latestAutoUpdateChannelEnabled": true
} }

18
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "symphony", "name": "symphony",
"version": "24.2.0", "version": "24.3.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "symphony", "name": "symphony",
"version": "24.2.0", "version": "24.3.0",
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
@ -40,7 +40,7 @@
"builder-util-runtime": "^9.0.3", "builder-util-runtime": "^9.0.3",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"del": "3.0.0", "del": "3.0.0",
"electron": "^28.1.3", "electron": "^28.2.0",
"electron-builder": "^24.2.1", "electron-builder": "^24.2.1",
"electron-icon-maker": "0.0.5", "electron-icon-maker": "0.0.5",
"electron-osx-sign": "^0.6.0", "electron-osx-sign": "^0.6.0",
@ -6633,9 +6633,9 @@
} }
}, },
"node_modules/electron": { "node_modules/electron": {
"version": "28.1.3", "version": "28.2.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.2.0.tgz",
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==", "integrity": "sha512-22SylXQQ9IHtwLw4D+Z4Si7OUpeDtpHfJVTjy3yv53iLg5zJKKPOCWT4ZwgYGHQZ0eldyBrYBHF/P9FPd2CcVQ==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@ -22991,9 +22991,9 @@
} }
}, },
"electron": { "electron": {
"version": "28.1.3", "version": "28.2.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.1.3.tgz", "resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-28.2.0.tgz",
"integrity": "sha512-NSFyTo6SndTPXzU18XRePv4LnjmuM9rF5GMKta1/kPmi02ISoSRonnD7wUlWXD2x53XyJ6d/TbSVesMW6sXkEQ==", "integrity": "sha512-22SylXQQ9IHtwLw4D+Z4Si7OUpeDtpHfJVTjy3yv53iLg5zJKKPOCWT4ZwgYGHQZ0eldyBrYBHF/P9FPd2CcVQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^2.0.0", "@electron/get": "^2.0.0",

View File

@ -86,6 +86,8 @@ const menuItemConfigFields = [
'isAutoUpdateEnabled', 'isAutoUpdateEnabled',
'enableBrowserLogin', 'enableBrowserLogin',
'forceAutoUpdate', 'forceAutoUpdate',
'betaAutoUpdateChannelEnabled',
'latestAutoUpdateChannelEnabled',
]; ];
let { let {
@ -99,6 +101,8 @@ let {
isAutoUpdateEnabled, isAutoUpdateEnabled,
enableBrowserLogin, enableBrowserLogin,
forceAutoUpdate, forceAutoUpdate,
betaAutoUpdateChannelEnabled,
latestAutoUpdateChannelEnabled,
} = 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';
@ -246,6 +250,8 @@ export class AppMenu {
isAutoUpdateEnabled = configData.isAutoUpdateEnabled; isAutoUpdateEnabled = configData.isAutoUpdateEnabled;
enableBrowserLogin = configData.enableBrowserLogin; enableBrowserLogin = configData.enableBrowserLogin;
forceAutoUpdate = configData.forceAutoUpdate; forceAutoUpdate = configData.forceAutoUpdate;
betaAutoUpdateChannelEnabled = configData.betaAutoUpdateChannelEnabled;
latestAutoUpdateChannelEnabled = configData.latestAutoUpdateChannelEnabled;
// fetch updated cloud config // fetch updated cloud config
this.cloudConfig = config.getFilteredCloudConfigFields( this.cloudConfig = config.getFilteredCloudConfigFields(
this.menuItemConfigFields, this.menuItemConfigFields,
@ -312,7 +318,10 @@ export class AppMenu {
}, },
visible: visible:
isMac && isMac &&
!!(isAutoUpdateEnabled || forceAutoUpdate) && !!(
(isAutoUpdateEnabled || forceAutoUpdate) &&
(betaAutoUpdateChannelEnabled || latestAutoUpdateChannelEnabled)
) &&
!!windowHandler.isMana, !!windowHandler.isMana,
label: i18n.t('Check for updates')(), label: i18n.t('Check for updates')(),
}, },
@ -714,7 +723,10 @@ export class AppMenu {
}, },
visible: visible:
isWindowsOS && isWindowsOS &&
!!(isAutoUpdateEnabled || forceAutoUpdate) && !!(
(isAutoUpdateEnabled || forceAutoUpdate) &&
(betaAutoUpdateChannelEnabled || latestAutoUpdateChannelEnabled)
) &&
!!windowHandler.isMana, !!windowHandler.isMana,
label: i18n.t('Check for updates')(), label: i18n.t('Check for updates')(),
}, },

View File

@ -25,6 +25,11 @@ export enum ChannelConfigLocation {
ACP = 'ACP', ACP = 'ACP',
REGISTRY = 'REGISTRY', REGISTRY = 'REGISTRY',
} }
export enum UpdateChannel {
LATEST = 'latest',
BETA = 'beta',
}
const DOWNLOAD_PROGRESS_BANNER_DELAY = 1000 * 10; // 10 sec const DOWNLOAD_PROGRESS_BANNER_DELAY = 1000 * 10; // 10 sec
const AUTO_UPDATE_REASON = 'autoUpdate'; const AUTO_UPDATE_REASON = 'autoUpdate';
@ -234,25 +239,51 @@ export class AutoUpdate {
}; };
private setAutoUpdateChannel = async (): Promise<void> => { private setAutoUpdateChannel = async (): Promise<void> => {
const { autoUpdateChannel, installVariant, betaAutoUpdateChannelEnabled } = const {
config.getConfigFields([ autoUpdateChannel,
'autoUpdateChannel', installVariant,
'installVariant', betaAutoUpdateChannelEnabled,
'betaAutoUpdateChannelEnabled', latestAutoUpdateChannelEnabled,
]); } = config.getConfigFields([
'autoUpdateChannel',
const cc = config.getFilteredCloudConfigFields([ 'installVariant',
'betaAutoUpdateChannelEnabled', 'betaAutoUpdateChannelEnabled',
]) as IConfig; 'latestAutoUpdateChannelEnabled',
this.channelConfigLocation = ]);
Object.keys(cc).length === 0 || cc.betaAutoUpdateChannelEnabled
? ChannelConfigLocation.ACP
: ChannelConfigLocation.LOCALFILE;
this.finalAutoUpdateChannel = betaAutoUpdateChannelEnabled this.channelConfigLocation = ChannelConfigLocation.LOCALFILE;
? 'beta' this.finalAutoUpdateChannel = autoUpdateChannel;
: autoUpdateChannel;
this.installVariant = installVariant; this.installVariant = installVariant;
const pmp = config.getFilteredCloudConfigFields([
'sdaInstallerMsiUrlEnabledVisible',
'sdaInstallerMsiUrlBetaEnabledVisible',
]) as IConfig;
if (
Object.keys(pmp).length > 0 &&
!pmp?.sdaInstallerMsiUrlEnabledVisible &&
!pmp?.sdaInstallerMsiUrlBetaEnabledVisible
) {
this.finalAutoUpdateChannel = UpdateChannel.LATEST;
this.channelConfigLocation = ChannelConfigLocation.ACP;
}
if (
Object.keys(pmp).length === 0 ||
pmp.sdaInstallerMsiUrlEnabledVisible ||
pmp.sdaInstallerMsiUrlBetaEnabledVisible
) {
if (latestAutoUpdateChannelEnabled) {
this.finalAutoUpdateChannel = UpdateChannel.LATEST;
}
if (betaAutoUpdateChannelEnabled) {
this.finalAutoUpdateChannel = UpdateChannel.BETA;
}
this.channelConfigLocation = ChannelConfigLocation.ACP;
}
// Registry has higher priority
if (isWindowsOS) { if (isWindowsOS) {
await retrieveWindowsRegistry(); await retrieveWindowsRegistry();
const registryAutoUpdate = RegistryStore.getRegistry(); const registryAutoUpdate = RegistryStore.getRegistry();

View File

@ -71,8 +71,11 @@ export interface IConfig {
enableBrowserLogin?: boolean; enableBrowserLogin?: boolean;
browserLoginAutoConnect?: boolean; browserLoginAutoConnect?: boolean;
betaAutoUpdateChannelEnabled?: boolean; betaAutoUpdateChannelEnabled?: boolean;
latestAutoUpdateChannelEnabled?: boolean;
forceAutoUpdate?: boolean; forceAutoUpdate?: boolean;
isPodUrlEditable?: boolean; isPodUrlEditable?: boolean;
sdaInstallerMsiUrlEnabledVisible?: boolean;
sdaInstallerMsiUrlBetaEnabledVisible?: boolean;
} }
export interface IGlobalConfig { export interface IGlobalConfig {
@ -123,6 +126,8 @@ export interface IPMPEntitlements {
memoryRefresh: CloudConfigDataTypes; memoryRefresh: CloudConfigDataTypes;
refreshAppThreshold: CloudConfigDataTypes; refreshAppThreshold: CloudConfigDataTypes;
disableThrottling: CloudConfigDataTypes; disableThrottling: CloudConfigDataTypes;
sdaInstallerMsiUrlEnabledVisible: boolean;
sdaInstallerMsiUrlBetaEnabledVisible: boolean;
} }
export interface IPermission { export interface IPermission {

View File

@ -1090,6 +1090,8 @@ export const updateFeaturesForCloudConfig = async (
isAutoUpdateEnabled, isAutoUpdateEnabled,
autoUpdateCheckInterval, autoUpdateCheckInterval,
forceAutoUpdate, forceAutoUpdate,
betaAutoUpdateChannelEnabled,
latestAutoUpdateChannelEnabled,
} = config.getConfigFields([ } = config.getConfigFields([
'launchOnStartup', 'launchOnStartup',
'alwaysOnTop', 'alwaysOnTop',
@ -1098,6 +1100,8 @@ export const updateFeaturesForCloudConfig = async (
'isAutoUpdateEnabled', 'isAutoUpdateEnabled',
'autoUpdateCheckInterval', 'autoUpdateCheckInterval',
'forceAutoUpdate', 'forceAutoUpdate',
'betaAutoUpdateChannelEnabled',
'latestAutoUpdateChannelEnabled',
]) as IConfig; ]) as IConfig;
const mainWebContents = windowHandler.getMainWebContents(); const mainWebContents = windowHandler.getMainWebContents();
@ -1149,7 +1153,10 @@ 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 (forceAutoUpdate || isAutoUpdateEnabled) { if (
(forceAutoUpdate || isAutoUpdateEnabled) &&
(betaAutoUpdateChannelEnabled || latestAutoUpdateChannelEnabled)
) {
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 () => {