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

@@ -154,16 +154,19 @@ export default class ShareSheetExportUrl extends Component<Props, State> {
getLogger().trackTimeSince(uploadMarker, uploadMarker, {
plugins: this.store.getState().plugins.selectedPlugins,
});
this.setState({fetchMetaDataErrors, result});
const flipperUrl = (result as DataExportResult).flipperUrl;
if (flipperUrl) {
clipboard.writeText(String(flipperUrl));
this.store.dispatch(setExportURL(flipperUrl));
new Notification('Shareable Flipper Export created', {
body: 'URL copied to clipboard',
requireInteraction: true,
});
if (this.state.runInBackground) {
clipboard.writeText(String(flipperUrl));
new Notification('Shareable Flipper Export created', {
body: 'URL copied to clipboard',
requireInteraction: true,
});
}
}
this.setState({fetchMetaDataErrors, result});
this.store.dispatch(unsetShare());
this.store.dispatch(resetSupportFormV2State());
this.props.logger.trackTimeSince(mark, 'export:url-success');
} catch (e) {