gnosis / safe-ios-legacy

Gnosis Safe is a multi signature (2FA) wallet for personal usage.
GNU General Public License v3.0
41 stars 17 forks source link

WC Deep link support #904

Closed sche closed 5 years ago

sche commented 5 years ago

Opening a deeplink should WalletConnect_SessionsList screen. The logic of opening a wc:// deepling is the same as scanning a qr code from WalletConnect_SessionsList screen.

DmitryBespalov commented 5 years ago

// url key in the did finish launching (https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622921-application) // https://developer.apple.com/documentation/uikit/uiapplication/launchoptionskey

// https://developer.apple.com/documentation/uikit/uiapplication/1648685-open // test cases: launching when app killed; when app in bacgkround; when app in foreground?

rmeissner commented 5 years ago

This is not necessarily required for the first iteration, since for iOS the WalletConnect library might use a different scheme. If you do this please check with @pedrouid

pedrouid commented 5 years ago

For iOS it might be better to listen to different schemes. Ideally we would all use the same deeplinking scheme wc like on Android but it's not as simple on iOS because the user doesn't get to choose the Wallet they want to connect. Although you could still register that wc scheme, you should also register a universal link for gnosis safe specifically. Then we can list the supported modals on a UI library like Web3Connect.

Here is an example of we tested it with Metamask Mobile and Rainbow Wallet. We listed the "supported wallets" with a universal link. Demo available here

Screenshot 2019-06-26 13 52 10

We plan to maintain a list of supporting wallets for deep linking on Github similar to that demo on L172

const deepLinkSupportedWallets = [
  {
    name: "Metamask",
    color: "orange",
    universalLink: "https://metamask.io",
    deepLink: "metamask:",
    chromeIntent: ""
  },
  {
    name: "Rainbow",
    color: "purple",
    universalLink: "https://rainbow.me",
    deepLink: "rainbow:",
    chromeIntent: ""
  }
];

Let me know how we could test this out with Gnosis Safe iOS, happy to assist more.

sche commented 5 years ago

@pedrouid universal links are supposed to be unique per app, but they are not so stable as deeplinks. Universal links don't guarantee that the app will handle the request. So for the proper support of universal links we need to implement logic on our site "safe.gnosis.io" to handle cases when app refused to open the link. Deeplinks, on the other hand, are more stable. We could add support for both "wc:" and "gnosissafe:" deeplinks. @tschubotz @rmeissner what deeplink name is it better to use for safe? ("safe:", "gnosissafe:")

pedrouid commented 5 years ago

Yes, that's true. You would need to handle the use-case where the user clicks on Gnosis Safe wallet but doesn't have it installed by displaying a web page to have them download it. You can have integrate deferred links to allow users to open the session after they download.

The reason we wanted to use universal links instead of deep links is to reduce the number of clicks the user has to click. Whenever you click a deep link, the user is asked "Do you want to open Gnosis Safe". Which becomes cumbersome every time you connect since you also have to approve the session on the Wallet side.

However you can see the logic on the deep linking example on L282 where we will default to a deep link if the universal link is not present. For example:

  {
    name: "Gnosis Safe",
    color: "blue",
    universalLink: "",
    deepLink: "gnosissafe:",
    chromeIntent: ""
  }
rmeissner commented 5 years ago

@sche for the deeplink I would use gnosissafe or gs and we should be able to implement a universalLink handling in the future (maybe we should create a ticket in the safe repo for that, to keep track of it)