forked from cerc-io/laconic-wallet
Update intent URL (#2)
Part of https://www.notion.so/WalletConnect-integration-84b2f7377d514d7ead698bebd84f1e31 - Update intent URL to https://wallet.laconic.com/ - Move navigation to index.js Co-authored-by: Adw8 <adwait@deepstacksoft.com> Reviewed-on: cerc-io/laconic-wallet#2
This commit is contained in:
parent
4b0ed0ba9f
commit
59be46c5f0
28
App.tsx
28
App.tsx
@ -2,8 +2,11 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { Snackbar } from 'react-native-paper';
|
||||
|
||||
import { SignClientTypes } from '@walletconnect/types';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import {
|
||||
NativeStackNavigationProp,
|
||||
createNativeStackNavigator,
|
||||
} from '@react-navigation/native-stack';
|
||||
|
||||
import SignMessage from './components/SignMessage';
|
||||
import HomeScreen from './components/HomeScreen';
|
||||
@ -18,7 +21,6 @@ import useInitialization, {
|
||||
import { EIP155_SIGNING_METHODS } from './utils/wallet-connect/EIP155Lib';
|
||||
import { useAccounts } from './context/AccountsContext';
|
||||
import { getSignParamsMessage } from './utils/wallet-connect/Helpers';
|
||||
import { navigationRef, navigateTo } from './utils/RootNavigation';
|
||||
import { useRequests } from './context/RequestContext';
|
||||
|
||||
const Stack = createNativeStackNavigator<StackParamsList>();
|
||||
@ -26,6 +28,9 @@ const Stack = createNativeStackNavigator<StackParamsList>();
|
||||
const App = (): React.JSX.Element => {
|
||||
useInitialization();
|
||||
|
||||
const navigation =
|
||||
useNavigation<NativeStackNavigationProp<StackParamsList>>();
|
||||
|
||||
const { accounts } = useAccounts();
|
||||
|
||||
const { requestSession, setRequestSession } = useRequests();
|
||||
@ -65,7 +70,7 @@ const App = (): React.JSX.Element => {
|
||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||
setRequestSession(requestSessionData);
|
||||
if (address && message) {
|
||||
navigateTo('SignRequest', {
|
||||
navigation.navigate('SignRequest', {
|
||||
network: 'eth',
|
||||
address,
|
||||
message,
|
||||
@ -89,19 +94,8 @@ const App = (): React.JSX.Element => {
|
||||
//TODO: Investigate dependencies
|
||||
});
|
||||
|
||||
const linking = {
|
||||
prefixes: ['https://www.laconic-wallet.com'],
|
||||
config: {
|
||||
screens: {
|
||||
SignRequest: {
|
||||
path: 'sign/:network/:address/:message',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<NavigationContainer linking={linking} ref={navigationRef}>
|
||||
<>
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen
|
||||
name="Laconic"
|
||||
@ -161,7 +155,7 @@ const App = (): React.JSX.Element => {
|
||||
}}>
|
||||
Session approved
|
||||
</Snackbar>
|
||||
</NavigationContainer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data
|
||||
android:host="www.laconic-wallet.com"
|
||||
android:host="wallet.laconic.com"
|
||||
android:pathPrefix="/sign"
|
||||
android:scheme="https"/>
|
||||
</intent-filter>
|
||||
|
14
index.js
14
index.js
@ -3,17 +3,31 @@ import 'text-encoding-polyfill';
|
||||
import { AppRegistry } from 'react-native';
|
||||
import { PaperProvider } from 'react-native-paper';
|
||||
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
|
||||
import App from './App';
|
||||
import { AccountsProvider } from './context/AccountsContext';
|
||||
import { RequestProvider } from './context/RequestContext';
|
||||
import { name as appName } from './app.json';
|
||||
|
||||
export default function Main() {
|
||||
const linking = {
|
||||
prefixes: ['https://wallet.laconic.com'],
|
||||
config: {
|
||||
screens: {
|
||||
SignRequest: {
|
||||
path: 'sign/:network/:address/:message',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return (
|
||||
<PaperProvider>
|
||||
<AccountsProvider>
|
||||
<RequestProvider>
|
||||
<NavigationContainer linking={linking}>
|
||||
<App />
|
||||
</NavigationContainer>
|
||||
</RequestProvider>
|
||||
</AccountsProvider>
|
||||
</PaperProvider>
|
||||
|
@ -1,14 +0,0 @@
|
||||
import {
|
||||
CommonActions,
|
||||
createNavigationContainerRef,
|
||||
} from '@react-navigation/native';
|
||||
|
||||
import { StackParamsList } from '../types';
|
||||
|
||||
export const navigationRef = createNavigationContainerRef<StackParamsList>();
|
||||
|
||||
export function navigateTo(routeName: string, params?: object) {
|
||||
if (navigationRef.isReady()) {
|
||||
navigationRef.dispatch(CommonActions.navigate(routeName, params));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user