diff --git a/src/MenuBar.js b/src/MenuBar.js index 60004b851..51281d722 100644 --- a/src/MenuBar.js +++ b/src/MenuBar.js @@ -15,7 +15,7 @@ import { } from './reducers/application.tsx'; import type {Store} from './reducers/index.tsx'; import electron from 'electron'; -import {ENABLE_SHAREABLE_LINK} from 'flipper'; +import {constants} from 'flipper'; export type DefaultKeyboardAction = 'clear' | 'goToBottom' | 'createPaste'; export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help'; const {dialog} = electron.remote; @@ -210,7 +210,7 @@ function getTemplate( }, }, ]; - if (ENABLE_SHAREABLE_LINK) { + if (constants.ENABLE_SHAREABLE_LINK) { exportSubmenu.push({ label: 'Sharable Link', accelerator: 'CommandOrControl+Shift+E', diff --git a/src/fb-stubs/constants.js b/src/fb-stubs/constants.js deleted file mode 100644 index 35fcd8d51..000000000 --- a/src/fb-stubs/constants.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2018-present Facebook. - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * @format - */ - -export const GRAPH_APP_ID = ''; -export const GRAPH_CLIENT_TOKEN = ''; -export const GRAPH_ACCESS_TOKEN = ''; - -// this provides elevated access to scribe. we really shouldn't be exposing this. -// need to investigate how to abstract the scribe logging so it's safe. -export const GRAPH_SECRET = ''; -export const GRAPH_SECRET_ACCESS_TOKEN = ''; - -// Provides access to Insights Validation ednpoint on interngraph -export const INSIGHT_INTERN_APP_ID = ''; -export const INSIGHT_INTERN_APP_TOKEN = ''; - -// Enables the flipper data to be exported through shareabale link -export const ENABLE_SHAREABLE_LINK = false; - -export const IS_PUBLIC_BUILD = true; diff --git a/src/fb-stubs/constants.tsx b/src/fb-stubs/constants.tsx new file mode 100644 index 000000000..40bdf7418 --- /dev/null +++ b/src/fb-stubs/constants.tsx @@ -0,0 +1,26 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ + +export default Object.freeze({ + GRAPH_APP_ID: '', + GRAPH_CLIENT_TOKEN: '', + GRAPH_ACCESS_TOKEN: '', + + // this provides elevated access to scribe. we really shouldn't be exposing this. + // need to investigate how to abstract the scribe logging so it's safe. + GRAPH_SECRET: '', + GRAPH_SECRET_ACCESS_TOKEN: '', + + // Provides access to Insights Validation endpoint on interngraph + INSIGHT_INTERN_APP_ID: '', + INSIGHT_INTERN_APP_TOKEN: '', + + // Enables the flipper data to be exported through shareabale link + ENABLE_SHAREABLE_LINK: false, + + IS_PUBLIC_BUILD: true, +}); diff --git a/src/index.js b/src/index.js index 77d3c9968..d0ca5ff7e 100644 --- a/src/index.js +++ b/src/index.js @@ -21,7 +21,7 @@ export type {PluginClient, Props} from './plugin.tsx'; export type {MetricType} from './utils/exportMetrics.js'; export {default as Client} from './Client.tsx'; export {clipboard} from 'electron'; -export * from './fb-stubs/constants.js'; +export {default as constants} from './fb-stubs/constants.tsx'; export {connect} from 'react-redux'; export {selectPlugin} from './reducers/connections.tsx'; export {getPluginKey, getPersistedState} from './utils/pluginUtils.js'; diff --git a/src/utils/electronCrashReporter.js b/src/utils/electronCrashReporter.js index 8f1f5c8ec..2de169529 100644 --- a/src/utils/electronCrashReporter.js +++ b/src/utils/electronCrashReporter.js @@ -9,7 +9,7 @@ import {exists, mkdir} from 'fs'; import {promisify} from 'util'; import {crashReporter, remote} from 'electron'; import isProduction from '../utils/isProduction.js'; -import {IS_PUBLIC_BUILD} from '../fb-stubs/constants'; +import constants from '../fb-stubs/constants.tsx'; import {tmpName} from 'tmp'; import {resolve} from 'path'; @@ -35,7 +35,7 @@ export default function initCrashReporter(sessionId: string): Promise { productName: 'Flipper', companyName: 'Facebook', submitURL: 'https://www.facebook.com/intern/flipper/crash_upload', - uploadToServer: isProduction() && !IS_PUBLIC_BUILD, + uploadToServer: isProduction() && !constants.IS_PUBLIC_BUILD, ignoreSystemCrashHandler: true, extra: { flipper_version: flipperVersion,