Show unsupported modal for RN-only builds
Summary: ^ Reviewed By: aigoncharov Differential Revision: D50557230 fbshipit-source-id: d1974771edba97ce99294b967c27e4ec76a6cf61
This commit is contained in:
committed by
Facebook GitHub Bot
parent
25245506c7
commit
b3497a1642
@@ -15,6 +15,7 @@ import {
|
|||||||
Layout,
|
Layout,
|
||||||
Dialog,
|
Dialog,
|
||||||
_PortalsManager,
|
_PortalsManager,
|
||||||
|
getFlipperLib,
|
||||||
} from 'flipper-plugin';
|
} from 'flipper-plugin';
|
||||||
import {Link, styled} from '../ui';
|
import {Link, styled} from '../ui';
|
||||||
import {theme} from 'flipper-plugin';
|
import {theme} from 'flipper-plugin';
|
||||||
@@ -37,10 +38,11 @@ import config from '../fb-stubs/config';
|
|||||||
import {WelcomeScreenStaticView} from './WelcomeScreen';
|
import {WelcomeScreenStaticView} from './WelcomeScreen';
|
||||||
import fbConfig from '../fb-stubs/config';
|
import fbConfig from '../fb-stubs/config';
|
||||||
import {isFBEmployee} from '../utils/fbEmployee';
|
import {isFBEmployee} from '../utils/fbEmployee';
|
||||||
import {notification} from 'antd';
|
import {Button, Modal, notification} from 'antd';
|
||||||
import isProduction from '../utils/isProduction';
|
import isProduction from '../utils/isProduction';
|
||||||
import {getRenderHostInstance} from 'flipper-frontend-core';
|
import {getRenderHostInstance} from 'flipper-frontend-core';
|
||||||
import {uiPerfTracker} from '../utils/UIPerfTracker';
|
import {uiPerfTracker} from '../utils/UIPerfTracker';
|
||||||
|
import {WarningOutlined} from '@ant-design/icons';
|
||||||
|
|
||||||
export function SandyApp() {
|
export function SandyApp() {
|
||||||
const logger = useLogger();
|
const logger = useLogger();
|
||||||
@@ -88,10 +90,46 @@ export function SandyApp() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (fbConfig.warnFBEmployees && isProduction()) {
|
|
||||||
isFBEmployee()
|
isFBEmployee()
|
||||||
.then((isEmployee) => {
|
.then((isEmployee) => {
|
||||||
if (isEmployee) {
|
if (isEmployee) {
|
||||||
|
if (process.env.FLIPPER_REACT_NATIVE_ONLY) {
|
||||||
|
Dialog.showModal((onHide) => (
|
||||||
|
<Modal
|
||||||
|
closable={false}
|
||||||
|
keyboard={false}
|
||||||
|
maskClosable={false}
|
||||||
|
open
|
||||||
|
centered
|
||||||
|
onCancel={() => onHide()}
|
||||||
|
width={570}
|
||||||
|
title={
|
||||||
|
<>
|
||||||
|
<WarningOutlined /> This Version of Flipper is Unsupported
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
footer={
|
||||||
|
<>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
getFlipperLib().openLink('munki://detail-Flipper');
|
||||||
|
onHide();
|
||||||
|
}}>
|
||||||
|
Open Flipper Stable instead
|
||||||
|
</Button>
|
||||||
|
<Button type="ghost" onClick={() => onHide()}>
|
||||||
|
I understand
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
}>
|
||||||
|
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.
|
||||||
|
</Modal>
|
||||||
|
));
|
||||||
|
} else if (fbConfig.warnFBEmployees && isProduction()) {
|
||||||
notification.warning({
|
notification.warning({
|
||||||
placement: 'bottomLeft',
|
placement: 'bottomLeft',
|
||||||
message: 'Please use Flipper@FB',
|
message: 'Please use Flipper@FB',
|
||||||
@@ -108,11 +146,11 @@ export function SandyApp() {
|
|||||||
duration: null,
|
duration: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.warn('Failed to check if user is employee', e);
|
console.warn('Failed to check if user is employee', e);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user