Parse deeplink uri and update the check

Summary: Parse the deeplink url and update the checks by comparing particular components.

Reviewed By: jknoxville

Differential Revision: D18093494

fbshipit-source-id: c79c1974a7e50b61724dedd7fd3303093fac944b
This commit is contained in:
Pritesh Nandgaonkar
2019-10-24 03:50:16 -07:00
committed by Facebook Github Bot
parent 0077f4c9f2
commit 652ffd43d6

View File

@@ -58,6 +58,7 @@ export default (store: Store, logger: Logger) => {
ipcRenderer.on(
'flipper-protocol-handler',
(_event: string, query: string) => {
const uri = new URL(query);
if (query.startsWith('flipper://import')) {
const {search} = new URL(query);
const {url} = qs.parse(search);
@@ -75,10 +76,18 @@ export default (store: Store, logger: Logger) => {
store.dispatch(toggleAction('downloadingImportData', false));
})
);
} else if (query === 'flipper://support-form?form=Litho') {
} else if (
uri.protocol === 'flipper:' &&
uri.pathname.includes('support-form')
) {
const formParam = uri.searchParams.get('form');
if (formParam && formParam.toUpperCase() === 'litho'.toUpperCase()) {
// Right now we just support Litho
logger.track('usage', 'support-form-source', {source: 'deeplink'});
store.dispatch(setStaticView(SupportRequestFormManager));
}
return;
}
const match = uriComponents(query);
if (match.length > 1) {
// flipper://<client>/<pluginId>/<payload>