From 4e5ede6d37b8923f3aa21e21d9b281b004a24371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Mon, 23 Sep 2019 06:39:17 -0700 Subject: [PATCH] Allow navigation to URI in Wilde via Flipper Summary: Here I add functionality to Wilde that allows navigation to internal deeplinks via Flipper. I beleive this was once a feature by allowing access to non whitelisted URL's but this has since been removed. The Flipper plugin can now receive a navigate_to command which then emits a url over the navigateTo socket. This is picked up by the FBNavigationFlipperLogger plugin where it gets an instance of the NavigationCoordinator and opens the url. Reviewed By: kolinkrewinkel Differential Revision: D17282530 fbshipit-source-id: 0ba29aeac2a32d5464e8fa1dfa4e53af7cf94159 --- src/plugins/navigation/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/navigation/index.tsx b/src/plugins/navigation/index.tsx index d8c5c5550..0f13aa7de 100644 --- a/src/plugins/navigation/index.tsx +++ b/src/plugins/navigation/index.tsx @@ -124,14 +124,20 @@ export default class extends FlipperPlugin { }); }; - navigateTo = (query: string) => { + navigateTo = async (query: string) => { const filteredQuery = filterOptionalParameters(query); this.props.setPersistedState({currentURI: filteredQuery}); const requiredParameters = getRequiredParameters(filteredQuery); if (requiredParameters.length === 0) { - this.getDevice().then(device => { + const device = await this.getDevice(); + if (this.realClient.query.app === 'Facebook' && device.os === 'iOS') { + // use custom navigate_to event for Wilde + this.client.send('navigate_to', { + url: filterOptionalParameters(filteredQuery), + }); + } else { device.navigateToLocation(filterOptionalParameters(filteredQuery)); - }); + } } else { this.setState({ requiredParameters,