diff --git a/lib/models/myWallets.dart b/lib/models/myWallets.dart index 350c052..5f43a1b 100644 --- a/lib/models/myWallets.dart +++ b/lib/models/myWallets.dart @@ -97,6 +97,10 @@ class MyWalletsProvider with ChangeNotifier { List configLines = await _walletConfig.readAsLines(); log.d(configLines); + if (configLines.isEmpty) { + return WalletData(''); + } + return WalletData( configLines.firstWhere((element) => element.startsWith(_id))); } @@ -136,7 +140,7 @@ class MyWalletsProvider with ChangeNotifier { await walletsDirectory.create(); // await defaultWalletFile.create(); await initWalletFolder(); - await Future.delayed(Duration(milliseconds: 100)); + await Future.delayed(Duration(milliseconds: 500)); notifyListeners(); rebuildWidget(); Navigator.pop(context); diff --git a/lib/models/walletOptions.dart b/lib/models/walletOptions.dart index 3ee1d97..4381cd0 100644 --- a/lib/models/walletOptions.dart +++ b/lib/models/walletOptions.dart @@ -78,15 +78,13 @@ class WalletOptionsProvider with ChangeNotifier { File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif'); String _localDewif = await _walletFile.readAsString(); String _localPubkey; - // log.d("_wallet:"); - log.d(_pin); + // log.d("$_localDewif $_pin $_pinLenght ${_wallet.derivation}"); if ((_localPubkey = await _getPubkeyFromDewif( _localDewif, _pin, _pinLenght, _wallet.derivation)) != 'false') { this.pubkey.text = _localPubkey; isWalletUnlock = true; - // notifyListeners(); return _localDewif; } else { @@ -95,7 +93,6 @@ class WalletOptionsProvider with ChangeNotifier { } catch (e) { log.e('ERROR READING FILE: $e'); this.pubkey.clear(); - // notifyListeners(); return 'bad'; } } @@ -320,6 +317,7 @@ class WalletOptionsProvider with ChangeNotifier { } String getShortPubkey(String pubkey) { + log.d(pubkey); List pubkeyByte = Base58Decode(pubkey); Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes); String pubkeyCheksum = Base58Encode(pubkeyS256.bytes); diff --git a/lib/screens/myWallets/walletsHome.dart b/lib/screens/myWallets/walletsHome.dart index ef02103..db25c18 100644 --- a/lib/screens/myWallets/walletsHome.dart +++ b/lib/screens/myWallets/walletsHome.dart @@ -18,9 +18,6 @@ class WalletsHome extends StatelessWidget { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); MyWalletsProvider myWalletProvider = Provider.of(context); - WalletOptionsProvider _walletOptions = - Provider.of(context); - _walletOptions.isWalletUnlock = false; final int _currentChest = myWalletProvider.getCurrentChest(); diff --git a/lib/screens/onBoarding/12.dart b/lib/screens/onBoarding/12.dart index 25cceb1..1999b09 100644 --- a/lib/screens/onBoarding/12.dart +++ b/lib/screens/onBoarding/12.dart @@ -110,6 +110,7 @@ class OnboardingStepFourteen extends StatelessWidget { ) ], onCompleted: (_pin) async { + _myWalletProvider.pinCode = _pin; final bool resultWallet = await _walletOptions.checkPinOK( generatedWallet.dewif, _pin.toUpperCase(), _pinLenght); if (resultWallet) { diff --git a/pubspec.yaml b/pubspec.yaml index 2eee357..8d692e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: Pay with G1. # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.2+1 +version: 0.0.2+2 environment: sdk: ">=2.7.0 <3.0.0"