Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][Android]Cannot disconnect wallet after use killSession #84

Open
WingCH opened this issue Nov 4, 2022 · 10 comments · May be fixed by #85
Open

[iOS][Android]Cannot disconnect wallet after use killSession #84

WingCH opened this issue Nov 4, 2022 · 10 comments · May be fixed by #85

Comments

@WingCH
Copy link

WingCH commented Nov 4, 2022

versions: walletconnect_dart: ^0.0.11

I just want to get the wallet address, so I use killSession after createSession returns the result, but I still see a connection in the wallet app.

i have tried this MR #75 , but not work.

Reproduce step

  1. run sample code
  2. click Get Addresses button
  3. choose trust wallet (you can choose other wallet, i believe have same behavior)
  4. the wallet app will show authorize popup, click connect
  5. wallet app will back to sample app automatically and return some information including waller address
  6. After received the waller address, killSession will be executed
  7. back to wallet app manually
  8. find WalletConnect page, check connecting list

Expected result:
not find sample app, since already killSession

Actual result:
sample app in connecting list

Video

document_6282579707053475856.mp4

Sample code

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  final WalletConnect connector = WalletConnect(
    bridge: 'https://bridge.walletconnect.org',
    clientMeta: const PeerMeta(
      name: 'My App',
      // if description is null, trust wallet (iOS 7.20 (691)) will not show the connection request
      description: 'An app for converting pictures to NFT',
      url: 'https://walletconnect.org',
      icons: ['https://files.gitbook.com/v0/b/gitbook-legacy-files/o/spaces%2F-LJJeCjcLrr53DcT1Ml7%2Favatar.png?alt=media'],
    ),
  );

  void getAddresses() async {
    try {
      var session = await connector.createSession(
        onDisplayUri: (uri) async {
          await launchUrlString(
            uri.toString(),
            mode: LaunchMode.externalApplication,
          );
        },
      );

      print('address: ${session.accounts}');

      // kill session
      await connector.killSession();
    } catch (e) {}
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: TextButton(
          onPressed: getAddresses,
          child: const Text('Get Addresses'),
        ),
      ),
    );
  }
}

flutter doctor

[✓] Flutter (Channel stable, 3.3.7, on macOS 13.0 22A380 darwin-arm, locale zh-Hant-HK)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.72.2)
[✓] Connected device (4 available)
[✓] HTTP Host Availability

@WingCH WingCH changed the title Cannot disconnect wallet after use killSession [iOS][Android]Cannot disconnect wallet after use killSession Nov 4, 2022
@RootSoft
Copy link
Owner

RootSoft commented Nov 4, 2022

Can you try to add a delay or separate button to kill the session?

@WingCH
Copy link
Author

WingCH commented Nov 4, 2022

i tried separate button to kill the session, but still not work.

TextButton(
  onPressed: () async {
    await connector.killSession();
  },
  child: const Text('Disconnect wallet'),
),

also i tried another wallet exodus, issue can be reproduce

@WingCH
Copy link
Author

WingCH commented Nov 4, 2022

@RootSoft thanks for your reply, do you have the same issue? Maybe there is something wrong with the way I am using it

WingCH added a commit to WingCH/walletconnect-dart-sdk that referenced this issue Nov 5, 2022
@WingCH WingCH linked a pull request Nov 5, 2022 that will close this issue
@WingCH
Copy link
Author

WingCH commented Nov 5, 2022

@RootSoft I fix this bug and create PR #85 , please take a look, thanks🙏🏻

@RootSoft
Copy link
Owner

RootSoft commented Nov 7, 2022

@WingCH Thanks for this, and good catch!
I'll do some additional testing as well this week and merge the changes asap

@WingCH
Copy link
Author

WingCH commented Nov 7, 2022

Looking forward to your update!

@gray-seven
Copy link

Please update

@ledoandailoc
Copy link

Waiting for update!

@RootSoft
Copy link
Owner

Sorry for the delays everyone, been quite a few busy weeks lately.
I'll update the package first thing next week.

@buivanday96
Copy link

Please update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants