Change the export file extension type

Summary: This diff imports and exports data in a `.flipper` file extension. This diff also adds the support to open flipper app by double clicking on the `.flipper` file.

Reviewed By: danielbuechele

Differential Revision: D14042846

fbshipit-source-id: 17e6b55bf2796d9abdf985411fce799600f7792b
This commit is contained in:
Pritesh Nandgaonkar
2019-02-12 06:45:07 -08:00
committed by Facebook Github Bot
parent 73b816de16
commit 029377a849
7 changed files with 31 additions and 3 deletions

View File

@@ -66,6 +66,7 @@ let win;
let appReady = false;
let pluginsCompiled = false;
let deeplinkURL = null;
let filePath = null;
// tracking
setInterval(() => {
@@ -122,6 +123,15 @@ app.on('will-finish-launching', () => {
win.webContents.send('flipper-deeplink', deeplinkURL);
}
});
app.on('open-file', (event, path) => {
// When flipper app is running, and someone double clicks the import file, `componentDidMount` will not be called again and windows object will exist in that case. That's why calling `win.webContents.send('open-flipper-file', filePath);` again.
event.preventDefault();
filePath = path;
if (win) {
win.webContents.send('open-flipper-file', filePath);
filePath = null;
}
});
});
app.on('ready', function() {
@@ -145,6 +155,11 @@ ipcMain.on('componentDidMount', event => {
win.webContents.send('flipper-deeplink-preferred-plugin', deeplinkURL);
deeplinkURL = null;
}
if (filePath) {
// When flipper app is not running, the windows object might not exist in the callback of `open-file`, but after ``componentDidMount` it will definitely exist.
win.webContents.send('open-flipper-file', filePath);
filePath = null;
}
});
ipcMain.on('getLaunchTime', event => {