diff --git a/desktop/flipper-common/src/settings.tsx b/desktop/flipper-common/src/settings.tsx index 02b72f8c0..de730cc13 100644 --- a/desktop/flipper-common/src/settings.tsx +++ b/desktop/flipper-common/src/settings.tsx @@ -76,7 +76,7 @@ export type LauncherSettings = { ignoreLocalPin: boolean; }; -// Settings that primarily only apply to Eelectron atm +// Settings that primarily only apply to Electron atm // TODO: further separte between flipper-ui config and Electron config export type ProcessConfig = { disabledPlugins: string[]; @@ -90,6 +90,8 @@ export type ProcessConfig = { launcherMsg: string | null; // Controls whether to delegate to the launcher if present. launcherEnabled: boolean; + // Control whether to suppress "update available" notifications + suppressPluginUpdateNotifications?: boolean; }; export type Platform = diff --git a/desktop/flipper-server-core/src/utils/__tests__/processConfig.node.tsx b/desktop/flipper-server-core/src/utils/__tests__/processConfig.node.tsx index 2a1d6af63..0f41b8865 100644 --- a/desktop/flipper-server-core/src/utils/__tests__/processConfig.node.tsx +++ b/desktop/flipper-server-core/src/utils/__tests__/processConfig.node.tsx @@ -17,6 +17,7 @@ test('config is decoded from env', () => { launcherMsg: 'wubba lubba dub dub', screenCapturePath: '/my/screenshot/path', launcherEnabled: false, + suppressPluginUpdateNotifications: true, }), }); @@ -26,6 +27,7 @@ test('config is decoded from env', () => { launcherMsg: 'wubba lubba dub dub', screenCapturePath: '/my/screenshot/path', launcherEnabled: false, + suppressPluginUpdateNotifications: true, }); }); @@ -36,5 +38,6 @@ test('config is decoded from env with defaults', () => { launcherMsg: undefined, screenCapturePath: undefined, launcherEnabled: true, + suppressPluginUpdateNotifications: false, }); }); diff --git a/desktop/flipper-server-core/src/utils/processConfig.tsx b/desktop/flipper-server-core/src/utils/processConfig.tsx index 71085f59a..547be1755 100644 --- a/desktop/flipper-server-core/src/utils/processConfig.tsx +++ b/desktop/flipper-server-core/src/utils/processConfig.tsx @@ -18,5 +18,9 @@ export function loadProcessConfig(env: NodeJS.ProcessEnv): ProcessConfig { screenCapturePath: json.screenCapturePath, launcherEnabled: typeof json.launcherEnabled === 'boolean' ? json.launcherEnabled : true, + suppressPluginUpdateNotifications: + typeof json.suppressPluginUpdateNotifications === 'boolean' + ? json.suppressPluginUpdateNotifications + : false, }; } diff --git a/desktop/flipper-ui-core/src/chrome/UpdateIndicator.tsx b/desktop/flipper-ui-core/src/chrome/UpdateIndicator.tsx index fee3675cb..caf69eb71 100644 --- a/desktop/flipper-ui-core/src/chrome/UpdateIndicator.tsx +++ b/desktop/flipper-ui-core/src/chrome/UpdateIndicator.tsx @@ -15,6 +15,7 @@ import fbConfig from '../fb-stubs/config'; import {useStore} from '../utils/useStore'; import {getAppVersion} from '../utils/info'; import {checkForUpdate} from '../fb-stubs/checkForUpdate'; +import {getRenderHostInstance} from 'flipper-frontend-core'; export type VersionCheckResult = | { @@ -63,6 +64,7 @@ export default function UpdateIndicator() { // trigger the update check, unless there is a launcher message already useEffect(() => { const version = getAppVersion(); + const config = getRenderHostInstance().serverConfig.processConfig; if (launcherMsg && launcherMsg.message) { if (launcherMsg.severity === 'error') { notification.error({ @@ -81,7 +83,11 @@ export default function UpdateIndicator() { duration: null, }); } - } else if (version && isProduction()) { + } else if ( + version && + !config.suppressPluginUpdateNotifications && + isProduction() + ) { reportPlatformFailures( checkForUpdate(version).then((res) => { if (res.kind === 'error') { diff --git a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx index 5daa14ef8..68ecb76ec 100644 --- a/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx +++ b/desktop/flipper-ui-core/src/dispatcher/handleOpenPluginDeeplink.tsx @@ -274,7 +274,8 @@ async function waitForLogin(store: Store) { } async function verifyFlipperIsUpToDate(title: string) { - if (!isProduction() || isTest()) { + const config = getRenderHostInstance().serverConfig.processConfig; + if (!isProduction() || isTest() || config.suppressPluginUpdateNotifications) { return; } const currentVersion = getAppVersion(); diff --git a/desktop/scripts/jest-setup-after.tsx b/desktop/scripts/jest-setup-after.tsx index a19544147..cdd708565 100644 --- a/desktop/scripts/jest-setup-after.tsx +++ b/desktop/scripts/jest-setup-after.tsx @@ -137,6 +137,7 @@ function createStubRenderHost(): RenderHost { launcherEnabled: false, launcherMsg: null, screenCapturePath: `/dev/null`, + suppressPluginUpdateNotifications: false, }, settings: { androidHome: `/dev/null`, diff --git a/desktop/static/main.tsx b/desktop/static/main.tsx index ba1a78f01..df44dfcac 100644 --- a/desktop/static/main.tsx +++ b/desktop/static/main.tsx @@ -216,7 +216,7 @@ app.on('ready', async () => { {allowFileAccess: true}, ); } catch (e) { - console.error('Failed to loa React devtools from disk: ', e); + console.error('Failed to load React devtools from disk: ', e); } } else { try { diff --git a/desktop/static/setup.tsx b/desktop/static/setup.tsx index d64c24617..ccf3904ef 100644 --- a/desktop/static/setup.tsx +++ b/desktop/static/setup.tsx @@ -17,6 +17,7 @@ export const defaultConfig: Config = { pluginPaths: [], disabledPlugins: [], darkMode: 'light', + suppressPluginUpdateNotifications: false, }; export type Config = { @@ -33,6 +34,7 @@ export type Config = { updaterEnabled?: boolean; launcherEnabled?: boolean; darkMode: 'system' | 'light' | 'dark'; + suppressPluginUpdateNotifications?: boolean; }; const ensureConfigDirExists = async (path: fs.PathLike) => { @@ -83,6 +85,10 @@ export default async function setup(argv: any) { updaterEnabled: argv.updater, launcherEnabled: argv.launcher, launcherMsg: argv.launcherMsg, + suppressPluginUpdateNotifications: + typeof config.suppressPluginUpdateNotifications === 'boolean' + ? config.suppressPluginUpdateNotifications + : false, }; return config;