Add listener in the renderer process for deeplink

Summary:
- Set userPrefferedPlugin for external deeplink
- Listen for deeplink in renderer process and navigate accordingly

Reviewed By: passy

Differential Revision: D10339035

fbshipit-source-id: 4de6249a0672f9ce02b0dfb78a4563302c308578
This commit is contained in:
Pritesh Nandgaonkar
2018-10-17 06:17:55 -07:00
committed by Facebook Github Bot
parent 4f914a655e
commit ce996ba8af
5 changed files with 91 additions and 7 deletions

View File

@@ -45,6 +45,10 @@ export type Action =
selectedApp: ?string,
},
}
| {
type: 'SELECT_USER_PREFERRED_PLUGIN',
payload: string,
}
| {
type: 'SERVER_ERROR',
payload: ?string,
@@ -178,7 +182,10 @@ export default function reducer(
userPreferredPlugin: selectedPlugin,
};
}
case 'SELECT_USER_PREFERRED_PLUGIN': {
const {payload} = action;
return {...state, userPreferredPlugin: payload};
}
case 'NEW_CLIENT': {
const {payload} = action;
const {userPreferredApp, userPreferredPlugin} = state;
@@ -249,3 +256,7 @@ export const selectPlugin = (payload: {
type: 'SELECT_PLUGIN',
payload,
});
export const userPreferredPlugin = (payload: string): Action => ({
type: 'SELECT_USER_PREFERRED_PLUGIN',
payload,
});