Make getFlipperLib generally available, and use it to decouple opening links from Electron

Summary:
This stack reduces our direct dependency on Electron, for example by exposing our own API to open links.

Also exposing `getFlipperLib` as API from `flipper-plugin`, so that these utility methods are available outside plugin contexts as well.

Reviewed By: timur-valiev

Differential Revision: D29661689

fbshipit-source-id: 0c0523326eeb0d9d8fbe3e03c4609327bb53596b
This commit is contained in:
Michel Weststrate
2021-07-15 01:51:58 -07:00
committed by Facebook GitHub Bot
parent 2b236c6114
commit 5dbd3bd414
20 changed files with 60 additions and 54 deletions

View File

@@ -24,7 +24,6 @@ import {
import {PluginDefinition, DevicePluginMap, ClientPluginMap} from './plugin';
import {connect} from 'react-redux';
import React, {Component, Fragment} from 'react';
import {clipboard} from 'electron';
import {
PluginNotification,
updatePluginBlocklist,
@@ -35,6 +34,7 @@ import {State as StoreState} from './reducers/index';
import textContent from './utils/textContent';
import createPaste from './fb-stubs/createPaste';
import {getPluginTitle} from './utils/pluginUtils';
import {getFlipperLib} from 'flipper-plugin';
type OwnProps = {
onClear: () => void;
@@ -459,7 +459,7 @@ class NotificationItem extends Component<
createPaste(this.getContent());
};
copy = () => clipboard.writeText(this.getContent());
copy = () => getFlipperLib().writeTextToClipboard(this.getContent());
getContent = (): string =>
[