Share sheet for the file export

Summary:
This diff shows an export sheet when one exports the Flipper data in a file. It also shows if any error happens.
Look at the video in test case.

Reviewed By: danielbuechele

Differential Revision: D14624194

fbshipit-source-id: dea0179a83e626e49593e5dde1d5ff128048db02
This commit is contained in:
Pritesh Nandgaonkar
2019-04-01 08:50:48 -07:00
committed by Facebook Github Bot
parent 2dacea8541
commit 45999a5292
5 changed files with 188 additions and 16 deletions

View File

@@ -15,6 +15,7 @@ import BugReporterDialog from './chrome/BugReporterDialog.js';
import ErrorBar from './chrome/ErrorBar.js';
import ShareSheet from './chrome/ShareSheet.js';
import SignInSheet from './chrome/SignInSheet.js';
import ShareSheetExportFile from './chrome/ShareSheetExportFile.js';
import PluginContainer from './PluginContainer.js';
import Sheet from './chrome/Sheet.js';
import {ipcRenderer, remote} from 'electron';
@@ -24,6 +25,7 @@ import {
ACTIVE_SHEET_PLUGIN_DEBUGGER,
ACTIVE_SHEET_SHARE_DATA,
ACTIVE_SHEET_SIGN_IN,
ACTIVE_SHEET_SHARE_DATA_IN_FILE,
} from './reducers/application.js';
import type {Logger} from './fb-interfaces/Logger.js';
@@ -44,6 +46,7 @@ type Props = {|
selectedDevice: ?BaseDevice,
error: ?string,
activeSheet: ActiveSheet,
exportFile: ?string,
|};
export class App extends React.Component<Props> {
@@ -76,6 +79,12 @@ export class App extends React.Component<Props> {
return <ShareSheet onHide={onHide} />;
} else if (this.props.activeSheet === ACTIVE_SHEET_SIGN_IN) {
return <SignInSheet onHide={onHide} />;
} else if (this.props.activeSheet === ACTIVE_SHEET_SHARE_DATA_IN_FILE) {
const {exportFile} = this.props;
if (!exportFile) {
throw new Error('Tried to export data without passing the file path');
}
return <ShareSheetExportFile onHide={onHide} file={exportFile} />;
} else {
// contents are added via React.Portal
return null;
@@ -103,12 +112,13 @@ export class App extends React.Component<Props> {
export default connect<Props, OwnProps, _, _, _, _>(
({
application: {leftSidebarVisible, activeSheet},
application: {leftSidebarVisible, activeSheet, exportFile},
connections: {selectedDevice, error},
}) => ({
leftSidebarVisible,
selectedDevice,
activeSheet,
exportFile,
error,
}),
)(App);