From b3497a1642ea7c0921a5dff7760a1768efa2345b Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 24 Oct 2023 05:51:06 -0700 Subject: [PATCH] Show unsupported modal for RN-only builds Summary: ^ Reviewed By: aigoncharov Differential Revision: D50557230 fbshipit-source-id: d1974771edba97ce99294b967c27e4ec76a6cf61 --- .../src/sandy-chrome/SandyApp.tsx | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx b/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx index c082546d6..156ebfe33 100644 --- a/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx +++ b/desktop/flipper-ui-core/src/sandy-chrome/SandyApp.tsx @@ -15,6 +15,7 @@ import { Layout, Dialog, _PortalsManager, + getFlipperLib, } from 'flipper-plugin'; import {Link, styled} from '../ui'; import {theme} from 'flipper-plugin'; @@ -37,10 +38,11 @@ import config from '../fb-stubs/config'; import {WelcomeScreenStaticView} from './WelcomeScreen'; import fbConfig from '../fb-stubs/config'; import {isFBEmployee} from '../utils/fbEmployee'; -import {notification} from 'antd'; +import {Button, Modal, notification} from 'antd'; import isProduction from '../utils/isProduction'; import {getRenderHostInstance} from 'flipper-frontend-core'; import {uiPerfTracker} from '../utils/UIPerfTracker'; +import {WarningOutlined} from '@ant-design/icons'; export function SandyApp() { const logger = useLogger(); @@ -88,10 +90,46 @@ export function SandyApp() { }, []); useEffect(() => { - if (fbConfig.warnFBEmployees && isProduction()) { - isFBEmployee() - .then((isEmployee) => { - if (isEmployee) { + isFBEmployee() + .then((isEmployee) => { + if (isEmployee) { + if (process.env.FLIPPER_REACT_NATIVE_ONLY) { + Dialog.showModal((onHide) => ( + onHide()} + width={570} + title={ + <> + This Version of Flipper is Unsupported + + } + footer={ + <> + + + + }> + This version is only meant to be used for React Native + debugging. It is not maintained and it doesn't receive updates. + Instead, you should be using the main Flipper version from + Managed Software Center for all other purposes. + + )); + } else if (fbConfig.warnFBEmployees && isProduction()) { notification.warning({ placement: 'bottomLeft', message: 'Please use Flipper@FB', @@ -108,11 +146,11 @@ export function SandyApp() { duration: null, }); } - }) - .catch((e) => { - console.warn('Failed to check if user is employee', e); - }); - } + } + }) + .catch((e) => { + console.warn('Failed to check if user is employee', e); + }); }, []); return (