WalletConnect / Web3ModalFlutter

The Web3Modal for WalletConnect built using Flutter.
https://pub.dev/packages/web3modal_flutter
Apache License 2.0
27 stars 30 forks source link

Lost SharedPreference data when disconnected from wallet #92

Closed TGVRock closed 3 months ago

TGVRock commented 3 months ago

Describe the bug When I disconnect from the wallet, the data stored in SharedPreference is lost. Can you please consider making it so that the data is not lost even if the session with the wallet is disconnected?

To Reproduce Steps to reproduce the behavior:

  1. Use the example app in the repository.
  2. Modify the _MyHomePageState class as follows:

    
    --- a/example/lib/home_page.dart
    +++ b/example/lib/home_page.dart
    @@ -1,3 +1,5 @@
    +import 'dart:async';
    +
    import 'package:flutter/material.dart';
    
    import 'package:web3modal_flutter/web3modal_flutter.dart';
    @@ -22,10 +24,26 @@ class MyHomePage extends StatefulWidget {
    class _MyHomePageState extends State<MyHomePage> {
    late W3MService _w3mService;

Expected behavior The data stored in SharedPreference should not disappear even after the wallet is disconnected.

Desktop (please complete the following information): Unconfirmed

Smartphone (please complete the following information):

quetool commented 3 months ago

Hello @TGVRock! This is indeed a very good point! I'll try to prepare a fix ASAP! Thanks!

quetool commented 3 months ago

To be clear, the bug here is that our calling for clearing our shared preferences it is clearing also your host app's shared preferences, which it shouldn't. (Our shared preferences must be still cleared upon disconnection)

TGVRock commented 3 months ago

Thank you for addressing the issue! Best regards.

quetool commented 3 months ago

Hello @TGVRock! This fix has been included in latest beta version. Please check! https://pub.dev/packages/web3modal_flutter/versions/3.1.1-beta02/changelog

Thanks for reporting it!