Set up deeplink handling for open-plugin deeplink
Summary: Introduce open-plugin deeplink protocol. Implementation steps will follow in rest of this diff Reviewed By: jknoxville Differential Revision: D29761801 fbshipit-source-id: 47070c063df2cb3286e418b2fb20f9d8855a95d5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
860f723521
commit
226cf8ccf9
@@ -20,6 +20,7 @@ import {selectPlugin} from './reducers/connections';
|
||||
import {Layout, renderReactRoot} from 'flipper-plugin';
|
||||
import React, {useState} from 'react';
|
||||
import {Alert, Input, Modal} from 'antd';
|
||||
import {handleOpenPluginDeeplink} from './dispatcher/handleOpenPluginDeeplink';
|
||||
|
||||
const UNKNOWN = 'Unknown deeplink';
|
||||
/**
|
||||
@@ -33,6 +34,9 @@ export async function handleDeeplink(
|
||||
if (uri.protocol !== 'flipper:') {
|
||||
throw new Error(UNKNOWN);
|
||||
}
|
||||
if (uri.href.startsWith('flipper://open-plugin')) {
|
||||
return handleOpenPluginDeeplink(store, query);
|
||||
}
|
||||
if (uri.pathname.match(/^\/*import\/*$/)) {
|
||||
const url = uri.searchParams.get('url');
|
||||
store.dispatch(toggleAction('downloadingImportData', true));
|
||||
@@ -68,7 +72,14 @@ export async function handleDeeplink(
|
||||
}
|
||||
const match = uriComponents(query);
|
||||
if (match.length > 1) {
|
||||
// deprecated, use the open-plugin format instead, which is more flexible
|
||||
// and will guide the user through any necessary set up steps
|
||||
// flipper://<client>/<pluginId>/<payload>
|
||||
console.warn(
|
||||
`Deprecated deeplink format: '${query}', use 'flipper://open-plugin?plugin-id=${
|
||||
match[1]
|
||||
}&client=${match[0]}&payload=${encodeURIComponent(match[2])}' instead.`,
|
||||
);
|
||||
store.dispatch(
|
||||
selectPlugin({
|
||||
selectedApp: match[0],
|
||||
|
||||
Reference in New Issue
Block a user