Add close button to the export share sheet

Summary: Adds close button to the dialog box which appears while exporting a flipper trace. To implement this I had to first see what is the bottle neck of the export process. The major bottle neck turned out to be the serialization step. So to make the export process interruptible, I have put in a call `await idler.idle()` which resolves when the main thread is idle. I have also added the tests for the idler.

Reviewed By: passy

Differential Revision: D16183582

fbshipit-source-id: 4ec0c985e216fd9d41e91cdcd8b4cca66d2cb04d
This commit is contained in:
Pritesh Nandgaonkar
2019-07-15 03:58:35 -07:00
committed by Facebook Github Bot
parent c63e6cffeb
commit 7f2709e1a5
9 changed files with 169 additions and 72 deletions

View File

@@ -272,7 +272,7 @@ async function startFlipper(userArguments: UserArguments) {
> = [
(userArguments: UserArguments) => {
if (userArguments.listDevices) {
return listDevices().then((devices: Array<BaseDevice>) => {
return listDevices().then(async (devices: Array<BaseDevice>) => {
const mapped = devices.map(device => {
return {
os: device.os,
@@ -281,7 +281,7 @@ async function startFlipper(userArguments: UserArguments) {
serial: device.serial,
};
});
return {exit: true, result: serialize(mapped)};
return {exit: true, result: await serialize(mapped)};
});
}
return Promise.resolve({exit: false});
@@ -332,12 +332,14 @@ async function startFlipper(userArguments: UserArguments) {
const exitActionClosures: Array<
(userArguments: UserArguments, store: Store) => Promise<Action>,
> = [
(userArguments: UserArguments, store: Store) => {
async (userArguments: UserArguments, store: Store) => {
const {listPlugins} = userArguments;
if (listPlugins) {
return Promise.resolve({
exit: true,
result: serialize(getActivePluginNames(store.getState().plugins)),
result: await serialize(
getActivePluginNames(store.getState().plugins),
),
});
}
return Promise.resolve({