Skip to content

Commit a91a795

Browse files
committed
chore: only redirect on android if connected via deeplink
1 parent cfd845a commit a91a795

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

wallets/rn_cli_wallet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"@reown/walletkit": "1.1.1-canary-ca-10",
3737
"@sentry/react-native": "5.32.0",
3838
"@walletconnect/core": "2.17.2",
39-
"@walletconnect/react-native-compat": "2.17.2-canary-ca-6",
39+
"@walletconnect/react-native-compat": "2.17.2-canary-ca-7",
4040
"dayjs": "1.11.11",
4141
"ethers": "5.7.2",
4242
"patch-package": "8.0.0",

wallets/rn_cli_wallet/src/screens/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const App = () => {
7575
({url}: {url: string}) => {
7676
const isLinkMode = url.includes('wc_ev');
7777
SettingsStore.setIsLinkModeRequest(isLinkMode);
78+
SettingsStore.setConnectionViaDeepLink(true);
7879

7980
if (isLinkMode) {
8081
return;

wallets/rn_cli_wallet/src/store/SettingsStore.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface State {
2424
socketStatus: 'connected' | 'disconnected' | 'stalled' | 'unknown';
2525
logs: string[];
2626
isLinkModeRequest: boolean;
27+
connectionViaDeepLink: boolean;
2728
}
2829

2930
/**
@@ -40,6 +41,7 @@ const state = proxy<State>({
4041
socketStatus: 'unknown',
4142
logs: [],
4243
isLinkModeRequest: false,
44+
connectionViaDeepLink: false,
4345
});
4446

4547
/**
@@ -98,6 +100,9 @@ const SettingsStore = {
98100
AsyncStorage.removeItem('TEST_NETS');
99101
}
100102
},
103+
setConnectionViaDeepLink(value: State['connectionViaDeepLink']) {
104+
state.connectionViaDeepLink = value;
105+
},
101106
};
102107

103108
export default SettingsStore;

wallets/rn_cli_wallet/src/utils/LinkingUtils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Linking, Platform} from 'react-native';
22
import Toast from 'react-native-toast-message';
33
import Minimizer from '@kangfenmao/react-native-minimizer';
4+
import SettingsStore from '@/store/SettingsStore';
45

56
interface redirect {
67
native?: string;
@@ -18,9 +19,13 @@ const goBackOrToast = () => {
1819
Toast.show({
1920
type: 'success',
2021
text1: 'Success!',
21-
text2: 'Redirecting to the dapp',
22+
text2: SettingsStore.state.connectionViaDeepLink
23+
? 'Redirecting to the dapp'
24+
: 'Please go back to the dapp',
2225
});
23-
Minimizer.goBack();
26+
if (SettingsStore.state.connectionViaDeepLink) {
27+
Minimizer.goBack();
28+
}
2429
} else {
2530
Toast.show({
2631
type: 'success',

wallets/rn_cli_wallet/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4431,9 +4431,9 @@ __metadata:
44314431
languageName: node
44324432
linkType: hard
44334433

4434-
"@walletconnect/react-native-compat@npm:2.17.2-canary-ca-6":
4435-
version: 2.17.2-canary-ca-6
4436-
resolution: "@walletconnect/react-native-compat@npm:2.17.2-canary-ca-6"
4434+
"@walletconnect/react-native-compat@npm:2.17.2-canary-ca-7":
4435+
version: 2.17.2-canary-ca-7
4436+
resolution: "@walletconnect/react-native-compat@npm:2.17.2-canary-ca-7"
44374437
dependencies:
44384438
events: 3.3.0
44394439
fast-text-encoding: 1.0.6
@@ -4447,7 +4447,7 @@ __metadata:
44474447
peerDependenciesMeta:
44484448
expo-application:
44494449
optional: true
4450-
checksum: 4a9c4c7b5f07429f5439f254fa519371f10436119ecf6af5e56e7fb0dfd2472c79a612ef3d97a345cacc1897c9ae9a0cdfd5d0ff09c0859ad377a1d42c2d2cff
4450+
checksum: 6557d927b15201c502e5b88b88b98b53d7e9aa882396874e57562ffc2c115f624ebce59b9f11f27bb7bd1e2361bbf3bfe2f118b8855011f131ecea8af37845b1
44514451
languageName: node
44524452
linkType: hard
44534453

@@ -13311,7 +13311,7 @@ __metadata:
1331113311
"@types/react": ^18.2.6
1331213312
"@types/react-test-renderer": ^18.0.0
1331313313
"@walletconnect/core": 2.17.2
13314-
"@walletconnect/react-native-compat": 2.17.2-canary-ca-6
13314+
"@walletconnect/react-native-compat": 2.17.2-canary-ca-7
1331513315
babel-jest: ^29.6.3
1331613316
babel-plugin-module-resolver: ^5.0.0
1331713317
dayjs: 1.11.11

0 commit comments

Comments
 (0)