diff --git a/src/NotificationsHub.js b/src/NotificationsHub.js index eebaa499f..271149c00 100644 --- a/src/NotificationsHub.js +++ b/src/NotificationsHub.js @@ -37,7 +37,8 @@ import { updateCategoryBlacklist, } from './reducers/notifications'; import {selectPlugin} from './reducers/connections'; -import {createPaste, textContent} from './utils/index'; +import {textContent} from './utils/index'; +import createPaste from './fb-stubs/createPaste'; export default class Notifications extends FlipperDevicePlugin<{}> { static id = 'notifications'; diff --git a/src/chrome/PluginDebugger.js b/src/chrome/PluginDebugger.js index 9dbe34593..491f30568 100644 --- a/src/chrome/PluginDebugger.js +++ b/src/chrome/PluginDebugger.js @@ -297,7 +297,7 @@ class PluginDebugger extends Component { The table lists all plugins known to Flipper. Some of them might be blocked by GKs, others may not show up, because none of the - connected apps is supporting it. + connected apps are supporting it. { + return Promise.reject('Not implemented!'); +} diff --git a/src/index.js b/src/index.js index 65f0452a1..172172e5a 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,7 @@ export {default as styled} from 'react-emotion'; export * from './ui/index.js'; export * from './utils/index.js'; export {default as GK} from './fb-stubs/GK.js'; +export {default as createPaste} from './fb-stubs/createPaste.js'; export { FlipperBasePlugin, FlipperPlugin, @@ -17,7 +18,7 @@ export { export type {PluginClient} from './plugin.js'; export {clipboard} from 'electron'; export * from './fb-stubs/constants.js'; -export * from './utils/createPaste.js'; +export * from './fb-stubs/createPaste.js'; export {connect} from 'react-redux'; export {selectPlugin} from './reducers/connections'; export {getPluginKey, getPersistedState} from './utils/pluginUtils.js'; diff --git a/src/ui/components/data-inspector/DataInspector.js b/src/ui/components/data-inspector/DataInspector.js index 518d88027..50c21236f 100644 --- a/src/ui/components/data-inspector/DataInspector.js +++ b/src/ui/components/data-inspector/DataInspector.js @@ -11,7 +11,7 @@ import ContextMenu from '../ContextMenu.js'; import Tooltip from '../Tooltip.js'; import styled from '../../styled/index.js'; import DataPreview from './DataPreview.js'; -import createPaste from '../../../utils/createPaste.js'; +import createPaste from '../../../fb-stubs/createPaste.js'; import {reportInteraction} from '../../../utils/InteractionTracker.js'; import {getSortedKeys} from './utils.js'; import {colors} from '../colors.js'; diff --git a/src/ui/components/table/ManagedTable.js b/src/ui/components/table/ManagedTable.js index a41bdd7da..473f37524 100644 --- a/src/ui/components/table/ManagedTable.js +++ b/src/ui/components/table/ManagedTable.js @@ -27,7 +27,7 @@ import TableHead from './TableHead.js'; import TableRow from './TableRow.js'; import ContextMenu from '../ContextMenu.js'; import FlexColumn from '../FlexColumn.js'; -import createPaste from '../../../utils/createPaste.js'; +import createPaste from '../../../fb-stubs/createPaste.js'; import debounceRender from 'react-debounce-render'; import debounce from 'lodash.debounce'; import {DEFAULT_ROW_HEIGHT} from './types'; diff --git a/src/utils/createPaste.js b/src/utils/createPaste.js deleted file mode 100644 index f53ba9a07..000000000 --- a/src/utils/createPaste.js +++ /dev/null @@ -1,50 +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 - */ - -import child_process from 'child_process'; -import {clipboard, shell} from 'electron'; -import JSONStream from 'JSONStream'; - -type PasteResponse = - | string - | { - createdPaste: { - id: number, - url: string, - }, - }; - -export default function createPaste(input: string): Promise { - return new Promise((resolve, reject) => { - const child = child_process.spawn('pastry', ['--json']); - - let lastMessage: ?PasteResponse; - - child.stdout - .pipe(JSONStream.parse([true])) - .on('data', (data: PasteResponse) => { - if (typeof data === 'string' && lastMessage === 'error') { - new window.Notification('Failed to create paste', { - body: data, - }); - reject(data); - } else if (typeof data === 'object' && data.createdPaste) { - const {url, id} = data.createdPaste; - clipboard.writeText(url); - const notification = new window.Notification(`Paste P${id} created`, { - body: 'URL copied to clipboard', - }); - notification.onclick = () => shell.openExternal(url); - resolve(url); - } - lastMessage = data; - }); - - child.stdin.write(input); - child.stdin.end(); - }); -} diff --git a/src/utils/index.js b/src/utils/index.js index c34250a4e..19b3b410e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -6,4 +6,3 @@ */ export {default as textContent} from './textContent.js'; -export {default as createPaste} from './createPaste.js';