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:
committed by
Facebook Github Bot
parent
73b816de16
commit
029377a849
10
package.json
10
package.json
@@ -23,7 +23,15 @@
|
||||
"win": {
|
||||
"publisherName": "Facebook, Inc."
|
||||
},
|
||||
"asar": false
|
||||
"asar": false,
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": [".flipper"],
|
||||
"name": "Flipper Data",
|
||||
"role": "Viewer",
|
||||
"icon": "document-icons/document.icns"
|
||||
}
|
||||
]
|
||||
},
|
||||
"resolutions": {
|
||||
"@jest-runner/electron/electron": "3.0.0"
|
||||
|
||||
@@ -326,7 +326,7 @@ function getTemplate(
|
||||
null,
|
||||
{
|
||||
title: 'FlipperExport',
|
||||
defaultPath: path.join(os.homedir(), 'FlipperExport.json'),
|
||||
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
|
||||
},
|
||||
file => {
|
||||
exportStoreToFile(file, store);
|
||||
|
||||
@@ -9,7 +9,7 @@ import {remote, ipcRenderer} from 'electron';
|
||||
import type {Store} from '../reducers/index.js';
|
||||
import type Logger from '../fb-stubs/Logger.js';
|
||||
import {parseFlipperPorts} from '../utils/environmentVariables';
|
||||
|
||||
import {importFileToStore} from '../utils/exportData';
|
||||
import {selectPlugin, userPreferredPlugin} from '../reducers/connections';
|
||||
export const uriComponents = (url: string) => {
|
||||
if (!url) {
|
||||
@@ -55,6 +55,11 @@ export default (store: Store, logger: Logger) => {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
ipcRenderer.on('open-flipper-file', (event, url) => {
|
||||
importFileToStore(url, store);
|
||||
});
|
||||
|
||||
ipcRenderer.on('flipper-deeplink-preferred-plugin', (event, url) => {
|
||||
// flipper://<client>/<pluginId>/<payload>
|
||||
const match = uriComponents(url);
|
||||
|
||||
BIN
static/document-icons/document.icns
Normal file
BIN
static/document-icons/document.icns
Normal file
Binary file not shown.
BIN
static/document-icons/document.ico
Normal file
BIN
static/document-icons/document.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
BIN
static/document-icons/document.png
Normal file
BIN
static/document-icons/document.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user