-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LIVE-3254 - LLM - Wallet connect as live app feature flag
replaced scan: true by mode: "scan" tweaked react-native webview prevent undefined params to be passed to the live app (dangerous) fix: wallet connect deeplink update uri instead of pushing a new screen fix: handle wallet connect invalid links
- Loading branch information
Showing
18 changed files
with
365 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": minor | ||
--- | ||
|
||
feat(LLM): Wallet connect as live app feature flag [LIVE-3254] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const setWallectConnectUri = (uri?: string) => ({ | ||
type: "WALLET_CONNECT_SET_URI", | ||
uri, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
apps/ledger-live-mobile/src/components/RootNavigator/WalletConnectLiveAppNavigator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import React, { useEffect, useMemo } from "react"; | ||
import { createStackNavigator } from "@react-navigation/stack"; | ||
import { useTheme } from "styled-components/native"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
|
||
import useFeature from "@ledgerhq/live-common/featureFlags/useFeature"; | ||
import { Flex, Icons } from "@ledgerhq/native-ui"; | ||
import { ScreenName } from "../../const"; | ||
import { getStackNavigatorConfig } from "../../navigation/navigatorConfig"; | ||
import styles from "../../navigation/styles"; | ||
|
||
import PlatformApp from "../../screens/Platform/App"; | ||
import { uriSelector } from "../../reducers/walletconnect"; | ||
import { setWallectConnectUri } from "../../actions/walletconnect"; | ||
|
||
const options = { | ||
headerBackImage: () => ( | ||
<Flex pl="16px"> | ||
<Icons.CloseMedium color="neutral.c100" size="20px" /> | ||
</Flex> | ||
), | ||
headerStyle: styles.headerNoShadow, | ||
headerTitle: () => null, | ||
}; | ||
|
||
export default function WalletConnectLiveAppNavigator({ route }: any) { | ||
const dispatch = useDispatch(); | ||
const { colors } = useTheme(); | ||
const walletConnectLiveApp = useFeature("walletConnectLiveApp"); | ||
const stackNavigationConfig = useMemo( | ||
() => getStackNavigatorConfig(colors, true), | ||
[colors], | ||
); | ||
|
||
const uri = useSelector(uriSelector); | ||
|
||
useEffect(() => { | ||
return () => { | ||
dispatch(setWallectConnectUri()); | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
const { params: routeParams } = route; | ||
|
||
const platform = walletConnectLiveApp?.params?.liveAppId || "wallet-connect"; | ||
|
||
return ( | ||
<Stack.Navigator screenOptions={stackNavigationConfig}> | ||
<Stack.Screen name={ScreenName.WalletConnectScan} options={options}> | ||
{(_props: any) => ( | ||
<PlatformApp | ||
{..._props} | ||
{...routeParams} | ||
route={{ | ||
..._props.route, | ||
params: { | ||
platform, | ||
mode: "scan", | ||
uri: uri || _props.route.params?.uri, | ||
account: _props.route.params?.accountId, | ||
}, | ||
}} | ||
/> | ||
)} | ||
</Stack.Screen> | ||
<Stack.Screen | ||
name={ScreenName.WalletConnectDeeplinkingSelectAccount} | ||
options={options} | ||
> | ||
{(_props: any) => ( | ||
<PlatformApp | ||
{..._props} | ||
{...routeParams} | ||
route={{ | ||
..._props.route, | ||
params: { | ||
platform, | ||
uri: uri || _props.route.params?.uri, | ||
account: _props.route.params?.accountId, | ||
}, | ||
}} | ||
/> | ||
)} | ||
</Stack.Screen> | ||
<Stack.Screen name={ScreenName.WalletConnectConnect} options={options}> | ||
{(_props: any) => ( | ||
<PlatformApp | ||
{..._props} | ||
{...routeParams} | ||
route={{ | ||
..._props.route, | ||
params: { | ||
platform, | ||
uri: uri || _props.route.params?.uri, | ||
account: _props.route.params?.accountId, | ||
}, | ||
}} | ||
/> | ||
)} | ||
</Stack.Screen> | ||
</Stack.Navigator> | ||
); | ||
} | ||
|
||
const Stack = createStackNavigator(); |
Oops, something went wrong.