Serialize Store

Summary:
This diff adds the capability to export the flipper data to a file. With this diff you can click on the "Export Flipper" option from the "Edit" menu in menubar. It will export it in the file at this location

`~/.flipper/MessageLogs.json`

We do not exactly export the store, but just the important part of it. We export in the following format

```
{
fileVersion: '1.0',
device: {
   os: 'iOS',
   title: 'iPhone 7',
   serial: '',
   deviceType: 'physical',
  },
clients: [
   {
    query: {
       app: 'Facebook',
      },
      d: '12345678'
     },
   {
    query: {
       app: 'Instagram',
      },
    id: '12345678'
   }
],
store: {
   pluginState: {},
   notifications: {}
  }
}

```

In next diff I will add the capability to select the folder to export the file too.

Reviewed By: danielbuechele

Differential Revision: D13751963

fbshipit-source-id: 7d3d49c6adf8145b2181d2332c7dbd589155cec3
This commit is contained in:
Pritesh Nandgaonkar
2019-01-28 15:33:56 -08:00
committed by Facebook Github Bot
parent fc1d32a3f9
commit 5ef970e5b5
7 changed files with 118 additions and 11 deletions

View File

@@ -59,10 +59,13 @@ export default (store: Store, logger: Logger) => {
store.subscribe(() => {
const newState = store.getState().plugins;
if (state !== newState) {
setupMenuBar([
...newState.devicePlugins.values(),
...newState.clientPlugins.values(),
]);
setupMenuBar(
[
...newState.devicePlugins.values(),
...newState.clientPlugins.values(),
],
store,
);
}
state = newState;
});