Open file import
Summary: This change only adds the PWA as capable of handling files with the ".flipper" extension. Reviewed By: aigoncharov Differential Revision: D48353437 fbshipit-source-id: fd78942ac4dffb7d26d5ca5be826290018465b93
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9728155cbf
commit
ce13ee426f
@@ -10,7 +10,7 @@
|
||||
import {Store} from '../reducers/index';
|
||||
import {Logger} from 'flipper-common';
|
||||
import {
|
||||
importFileToStore,
|
||||
importDataToStore,
|
||||
IMPORT_FLIPPER_TRACE_EVENT,
|
||||
} from '../utils/exportData';
|
||||
import {tryCatchReportPlatformFailures} from 'flipper-common';
|
||||
@@ -67,9 +67,9 @@ export default (store: Store, logger: Logger) => {
|
||||
});
|
||||
});
|
||||
|
||||
renderHost.onIpcEvent('open-flipper-file', (url: string) => {
|
||||
renderHost.onIpcEvent('open-flipper-file', (name: string, data: string) => {
|
||||
tryCatchReportPlatformFailures(() => {
|
||||
return importFileToStore(url, store);
|
||||
return importDataToStore(name, data, store);
|
||||
}, `${IMPORT_FLIPPER_TRACE_EVENT}:Deeplink`);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -26,7 +26,10 @@ import {Store} from '../reducers/index';
|
||||
import {Dispatcher} from './types';
|
||||
import {notNull} from '../utils/typeUtils';
|
||||
|
||||
export default function (store: Store, logger: Logger): () => Promise<void> {
|
||||
export default async function (
|
||||
store: Store,
|
||||
logger: Logger,
|
||||
): Promise<() => Promise<void>> {
|
||||
// This only runs in development as when the reload
|
||||
// kicks in it doesn't unregister the shortcuts
|
||||
const dispatchers: Array<Dispatcher> = [
|
||||
@@ -43,10 +46,11 @@ export default function (store: Store, logger: Logger): () => Promise<void> {
|
||||
pluginChangeListener,
|
||||
pluginsSourceUpdateListener,
|
||||
].filter(notNull);
|
||||
const globalCleanup = dispatchers
|
||||
.map((dispatcher) => dispatcher(store, logger))
|
||||
.filter(Boolean);
|
||||
return () => {
|
||||
return Promise.all(globalCleanup).then(() => {});
|
||||
const globalCleanup = await Promise.all(
|
||||
dispatchers.map((dispatcher) => dispatcher(store, logger)).filter(Boolean),
|
||||
);
|
||||
|
||||
return async () => {
|
||||
await Promise.all(globalCleanup);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user