RootSoft / walletconnect-dart-sdk

Open protocol for connecting dApps to mobile wallets with QR code scanning or deep linking.
MIT License
102 stars 61 forks source link

need help about deep linking #27

Closed text4lilac closed 2 years ago

text4lilac commented 2 years ago

awsome package,can any one tell me how to add deep linking using this package??

RootSoft commented 2 years ago

We use deeplinking together with url_launcher. Once you create a session with createSession, you can launch the uri with the launch method of url_launcher.

final session = await connector.createSession(
      chainId: 4160,
      onDisplayUri: (uri) async {
        print(uri);
        try {
          if (!await launch(uri)) {
            emit(WalletConnectNotInstalled());
            return;
          }
        } catch (ex) {
          emit(WalletConnectFailure(code: 1, message: ''));
        }
      },
    );
ekasetiawans commented 2 years ago

on iOS you can use universal link of wallet and make sure you call launch like this:

 launch(
        deepLink,
        universalLinksOnly: true,
        forceSafariVC: false,
      );
text4lilac commented 2 years ago

thank you.working properly

We use deeplinking together with url_launcher. Once you create a session with createSession, you can launch the uri with the launch method of url_launcher.

final session = await connector.createSession(
      chainId: 4160,
      onDisplayUri: (uri) async {
        print(uri);
        try {
          if (!await launch(uri)) {
            emit(WalletConnectNotInstalled());
            return;
          }
        } catch (ex) {
          emit(WalletConnectFailure(code: 1, message: ''));
        }
      },
    );

thank you (working proper)