Skip to content

Commit

Permalink
update router section
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed Mar 7, 2024
1 parent 132ed48 commit 508159f
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions docs/web3wallet/mobileLinking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,17 @@ These are the known workarounds for avoiding app linking issues on iOS when usin

### Overview

WalletConnectRouter framework can make the redirection back to the dapp even more convenient.
WalletConnectRouter simplifies navigation by automatically redirecting users back to the DApp after they've interacted with a wallet via a deep link. This eliminates the need for users to manually navigate back after approving a session or confirming a transaction.

For example you are interacting with a DApp that redirects to your wallet through a deeplink to approve a session or confirm a transaction. After response, you need to return to the DApp by yourself. WalletConnectRouter eliminates this unnecessary step.
#### Key Features

By calling `WalletConnectRouter.goBack(uri: "example://")` (where `example://` is the custom scheme of the dapp declared in their `redirect` field for `AppMetadata`) you can return to DApp automatically.
**Automatic Redirection:** By invoking WalletConnectRouter.goBack(uri: "example://")where "example://" is the DApp's custom scheme as declared in their AppMetadata redirect field—users are seamlessly returned to the DApp.

:::info Note

Starting from WalletConnect SDK version 1.9.5, the `redirect` field in the `AppMetadata` object is mandatory. Ensure that the provided value matches your app's URL scheme to prevent redirection-related issues.
#### Important Consideration

:::
**Mandatory redirect Field:** Starting with WalletConnect SDK version 1.9.5, specifying the redirect field in the AppMetadata object is mandatory to avoid redirection issues.

### Installation example
### Installation and Usage

```swift
import WalletConnectRouter
Expand All @@ -195,16 +193,12 @@ try await Sign.instance.approve(proposalId: <proposalId>, namespaces: <namespace
if let uri = proposal.proposer.redirect?.native {
WalletConnectRouter.goBack(uri: uri)
} else {
// Please inform the user to return to the browser
// Inform the user to manually return to the DApp
}
```
### Limitations

Unfortunately, if you are interacting with a DApp from your browser, it's not possible to automatically redirect a user back since iOS 17.
It is highly recommended to modify your app's UI to inform the user about the necessity of manually returning to the browser.

:::info Note
If your iOS version is lower than 17, calling `WalletConnectRouter.goBack(uri: uri)` will trigger the automatic redirect. Additionally, you can manually trigger the automatic redirect using the old API call `Router.goBack()` within the `WalletConnectRouter` package.
:::
Automatic redirection to browser-based DApps after wallet interaction is not possible from iOS 17 onwards. Developers should adjust their app's UI to inform users about manual navigation back to the browser. For iOS versions below 17, WalletConnectRouter.goBack(uri: uri) facilitates automatic redirection.

![Redirect](/img/ios-redirect.png)

Expand Down

0 comments on commit 508159f

Please sign in to comment.