Fix bug after creating keystore; fix bug when deleting wallet
This commit is contained in:
parent
140dd5206e
commit
ca85a45dd6
|
@ -97,6 +97,10 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
List configLines = await _walletConfig.readAsLines();
|
List configLines = await _walletConfig.readAsLines();
|
||||||
log.d(configLines);
|
log.d(configLines);
|
||||||
|
|
||||||
|
if (configLines.isEmpty) {
|
||||||
|
return WalletData('');
|
||||||
|
}
|
||||||
|
|
||||||
return WalletData(
|
return WalletData(
|
||||||
configLines.firstWhere((element) => element.startsWith(_id)));
|
configLines.firstWhere((element) => element.startsWith(_id)));
|
||||||
}
|
}
|
||||||
|
@ -136,7 +140,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
await walletsDirectory.create();
|
await walletsDirectory.create();
|
||||||
// await defaultWalletFile.create();
|
// await defaultWalletFile.create();
|
||||||
await initWalletFolder();
|
await initWalletFolder();
|
||||||
await Future.delayed(Duration(milliseconds: 100));
|
await Future.delayed(Duration(milliseconds: 500));
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
rebuildWidget();
|
rebuildWidget();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
|
@ -78,15 +78,13 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
|
File _walletFile = File('${walletsDirectory.path}/0/wallet.dewif');
|
||||||
String _localDewif = await _walletFile.readAsString();
|
String _localDewif = await _walletFile.readAsString();
|
||||||
String _localPubkey;
|
String _localPubkey;
|
||||||
// log.d("_wallet:");
|
// log.d("$_localDewif $_pin $_pinLenght ${_wallet.derivation}");
|
||||||
log.d(_pin);
|
|
||||||
|
|
||||||
if ((_localPubkey = await _getPubkeyFromDewif(
|
if ((_localPubkey = await _getPubkeyFromDewif(
|
||||||
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
|
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
|
||||||
'false') {
|
'false') {
|
||||||
this.pubkey.text = _localPubkey;
|
this.pubkey.text = _localPubkey;
|
||||||
isWalletUnlock = true;
|
isWalletUnlock = true;
|
||||||
// notifyListeners();
|
|
||||||
|
|
||||||
return _localDewif;
|
return _localDewif;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +93,6 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.e('ERROR READING FILE: $e');
|
log.e('ERROR READING FILE: $e');
|
||||||
this.pubkey.clear();
|
this.pubkey.clear();
|
||||||
// notifyListeners();
|
|
||||||
return 'bad';
|
return 'bad';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,6 +317,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShortPubkey(String pubkey) {
|
String getShortPubkey(String pubkey) {
|
||||||
|
log.d(pubkey);
|
||||||
List<int> pubkeyByte = Base58Decode(pubkey);
|
List<int> pubkeyByte = Base58Decode(pubkey);
|
||||||
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
||||||
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);
|
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);
|
||||||
|
|
|
@ -18,9 +18,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
|
||||||
_walletOptions.isWalletUnlock = false;
|
|
||||||
|
|
||||||
final int _currentChest = myWalletProvider.getCurrentChest();
|
final int _currentChest = myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,7 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (_pin) async {
|
||||||
|
_myWalletProvider.pinCode = _pin;
|
||||||
final bool resultWallet = await _walletOptions.checkPinOK(
|
final bool resultWallet = await _walletOptions.checkPinOK(
|
||||||
generatedWallet.dewif, _pin.toUpperCase(), _pinLenght);
|
generatedWallet.dewif, _pin.toUpperCase(), _pinLenght);
|
||||||
if (resultWallet) {
|
if (resultWallet) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# 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
|
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:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in New Issue