Make dispatcher/application.tsx strict

Summary: _typescript_

Reviewed By: jknoxville

Differential Revision: D17258139

fbshipit-source-id: d1ab484e981b2802a22c2fc92ac52c75970ee3d2
This commit is contained in:
Pascal Hartig
2019-09-09 09:56:45 -07:00
committed by Facebook Github Bot
parent 962bd03785
commit c506cc57b1

View File

@@ -51,39 +51,42 @@ export default (store: Store, logger: Logger) => {
});
});
ipcRenderer.on('flipper-protocol-handler', (event, query: string) => {
if (query.startsWith('flipper://import')) {
const {search} = new URL(query);
const {url} = qs.parse(search);
store.dispatch(toggleAction('downloadingImportData', true));
return (
typeof url === 'string' &&
fetch(url)
.then(res => res.text())
.then(data => importDataToStore(data, store))
.then(() => {
store.dispatch(toggleAction('downloadingImportData', false));
})
.catch((e: Error) => {
console.error(e);
store.dispatch(toggleAction('downloadingImportData', false));
})
);
}
const match = uriComponents(query);
if (match.length > 1) {
// flipper://<client>/<pluginId>/<payload>
return store.dispatch(
selectPlugin({
selectedApp: match[0],
selectedPlugin: match[1],
deepLinkPayload: match[2],
}),
);
}
});
ipcRenderer.on(
'flipper-protocol-handler',
(_event: string, query: string) => {
if (query.startsWith('flipper://import')) {
const {search} = new URL(query);
const {url} = qs.parse(search);
store.dispatch(toggleAction('downloadingImportData', true));
return (
typeof url === 'string' &&
fetch(url)
.then(res => res.text())
.then(data => importDataToStore(data, store))
.then(() => {
store.dispatch(toggleAction('downloadingImportData', false));
})
.catch((e: Error) => {
console.error(e);
store.dispatch(toggleAction('downloadingImportData', false));
})
);
}
const match = uriComponents(query);
if (match.length > 1) {
// flipper://<client>/<pluginId>/<payload>
return store.dispatch(
selectPlugin({
selectedApp: match[0],
selectedPlugin: match[1],
deepLinkPayload: match[2],
}),
);
}
},
);
ipcRenderer.on('open-flipper-file', (event, url) => {
ipcRenderer.on('open-flipper-file', (_event: string, url: string) => {
tryCatchReportPlatformFailures(() => {
return importFileToStore(url, store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:Deeplink`);