Normalize export to fle and share link behaviour.

Summary:
Both export methods behaved slightly differently:
* Export to file returned earlier when running in background, which skiped the tracking of export termination;
* Share link always showed notification, even when on foreground;
* Share link status "hanged" - the share was never unset.

This change makes both consistent:
* Always track export finish - whether its in foreground or background;
* Only show notificaiton if running in background;
* Always reset the share/status.

On top of this it also:
* Normalizes the screenshot status to terminate in '...' as all the others;
* Only copies export URL to clipboard when exporting link if running in the background.

Reviewed By: passy

Differential Revision: D21425095

fbshipit-source-id: 9864a63269df6bd05ab065ff0e5d9f17b9ac6db6
This commit is contained in:
João Vieira
2020-05-07 04:02:41 -07:00
committed by Facebook GitHub Bot
parent a2d7297bbb
commit 64deaee5a7
3 changed files with 12 additions and 10 deletions

View File

@@ -125,15 +125,14 @@ export default class ShareSheetExportFile extends Component<Props, State> {
),
`${EXPORT_FLIPPER_TRACE_EVENT}:UI_FILE`,
);
this.store.dispatch(unsetShare());
if (this.state.runInBackground) {
new Notification('Shareable Flipper Export created', {
body: `Saved to ${this.props.file}`,
requireInteraction: true,
});
return;
}
this.setState({fetchMetaDataErrors, result: {kind: 'success'}});
this.store.dispatch(unsetShare());
this.props.logger.trackTimeSince(mark, 'export:file-success');
} catch (err) {
const result: {