Fix bug after creating keystore; fix bug when deleting wallet

This commit is contained in:
poka 2021-04-04 18:53:32 +02:00
parent 140dd5206e
commit ca85a45dd6
5 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -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<int> pubkeyByte = Base58Decode(pubkey);
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);

View File

@ -18,9 +18,6 @@ class WalletsHome extends StatelessWidget {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
MyWalletsProvider myWalletProvider =
Provider.of<MyWalletsProvider>(context);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context);
_walletOptions.isWalletUnlock = false;
final int _currentChest = myWalletProvider.getCurrentChest();

View File

@ -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) {

View File

@ -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"