/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 */

import React from 'react';
import {useEffect} from 'react';
import LegacyApp from './LegacyApp';
import fbConfig from '../fb-stubs/config';
import {isFBEmployee} from '../utils/fbEmployee';
import {Logger} from '../fb-interfaces/Logger';
import isSandyEnabled from '../utils/isSandyEnabled';
import {SandyApp} from '../sandy-chrome/SandyApp';
import {notification} from 'antd';
import isProduction from '../utils/isProduction';

type Props = {logger: Logger};

export default function App(props: Props) {
  useEffect(() => {
    if (fbConfig.warnFBEmployees && isProduction()) {
      isFBEmployee().then(() => {
        notification.warning({
          placement: 'bottomLeft',
          message: 'Please use Flipper@FB',
          description: (
            <>
              You are using the open-source version of Flipper. Install the
              internal build from Managed Software Center to get access to more
              plugins.
            </>
          ),
          duration: null,
        });
      });
    }
  }, []);
  return isSandyEnabled() ? <SandyApp /> : <LegacyApp logger={props.logger} />;
}

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @format
 */

import React from 'react';
import {useEffect} from 'react';
import LegacyApp from './LegacyApp';
import fbConfig from '../fb-stubs/config';
import {isFBEmployee} from '../utils/fbEmployee';
import {Logger} from '../fb-interfaces/Logger';
import isSandyEnabled from '../utils/isSandyEnabled';
import {SandyApp} from '../sandy-chrome/SandyApp';
import {notification} from 'antd';
import isProduction from '../utils/isProduction';

type Props = {logger: Logger};

export default function App(props: Props) {
  useEffect(() => {
    if (fbConfig.warnFBEmployees && isProduction()) {
      isFBEmployee().then((isEmployee) => {
        if (isEmployee) {
          notification.warning({
            placement: 'bottomLeft',
            message: 'Please use Flipper@FB',
            description: (
              <>
                You are using the open-source version of Flipper. Install the
                internal build from Managed Software Center to get access to
                more plugins.
              </>
            ),
            duration: null,
          });
        }
      });
    }
  }, []);
  return isSandyEnabled() ? <SandyApp /> : <LegacyApp logger={props.logger} />;
}

Fix employee detection in OSS version
Fix employee detection in OSS version

Summary: Changelog: Fix incorrect warning in OSS builds hinting to install a closed source build. Fixes #1853

Reviewed By: passy

Differential Revision: D26019227

fbshipit-source-id: 61a0270997d0aa67d55224e4f6268ed3103099c7
