All pubkey in monospace everywhere; Fix delete all derivations; Fix delete all pubkey refresh
This commit is contained in:
parent
6891df981e
commit
c4d774e256
|
@ -46,7 +46,14 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
|
||||
if (isHD) {
|
||||
final int _derivationNbr = 3;
|
||||
await configFile.writeAsString('$nbrWallet:$_name:$_derivationNbr');
|
||||
List _pubkeysTmp = await DubpRust.getBip32DewifAccountsPublicKeys(
|
||||
dewif: wallet.dewif,
|
||||
secretCode: wallet.pin,
|
||||
accountsIndex: [_derivationNbr]);
|
||||
String _pubkey = _pubkeysTmp[0];
|
||||
|
||||
await configFile
|
||||
.writeAsString('$nbrWallet:$_name:$_derivationNbr:$_pubkey');
|
||||
} else {
|
||||
await configFile.writeAsString('$nbrWallet:$_name');
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
Future importWallet() async {}
|
||||
|
||||
String getAllWalletsNames() {
|
||||
final bool _isWalletsExists = checkIfWalletExist();
|
||||
if (!_isWalletsExists) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (listWallets != null && listWallets.isNotEmpty) {
|
||||
listWallets = '';
|
||||
}
|
||||
|
@ -42,8 +47,8 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
if (listWallets != '') {
|
||||
listWallets += '\n';
|
||||
}
|
||||
listWallets +=
|
||||
"${element.split(':')[0]}:${element.split(':')[1]}:${element.split(':')[2]}";
|
||||
listWallets += element;
|
||||
// listWallets += "${element.split(':')[0]}:${element.split(':')[1]}:${element.split(':')[2]}"
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -59,6 +64,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
if (_answer) {
|
||||
await walletsDirectory.delete(recursive: true);
|
||||
await walletsDirectory.create();
|
||||
notifyListeners();
|
||||
Navigator.pop(context);
|
||||
}
|
||||
return 0;
|
||||
|
@ -104,14 +110,18 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
Future<void> generateNewDerivation(
|
||||
context, String _name, int _walletNbr) async {
|
||||
int _newDerivationNbr;
|
||||
final _walletConfig =
|
||||
File('${walletsDirectory.path}/$_walletNbr/config.txt');
|
||||
|
||||
String _lastWallet =
|
||||
await _walletConfig.readAsLines().then((value) => value.last);
|
||||
int _lastDerivation = int.parse(_lastWallet.split(':')[2]);
|
||||
// print(_lastDerivation);
|
||||
int _newDerivationNbr = _lastDerivation + 3;
|
||||
if (await _walletConfig.readAsString() == '') {
|
||||
_newDerivationNbr = 3;
|
||||
} else {
|
||||
String _lastWallet =
|
||||
await _walletConfig.readAsLines().then((value) => value.last);
|
||||
int _lastDerivation = int.parse(_lastWallet.split(':')[2]);
|
||||
_newDerivationNbr = _lastDerivation + 3;
|
||||
}
|
||||
|
||||
await _walletConfig.writeAsString('\n$_walletNbr:$_name:$_newDerivationNbr',
|
||||
mode: FileMode.append);
|
||||
|
|
|
@ -161,7 +161,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
String newConfig =
|
||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||
lines.removeWhere(
|
||||
(element) => element == '$_walletNbr:$_name:$_derivation');
|
||||
(element) => element.contains('$_walletNbr:$_name:$_derivation'));
|
||||
|
||||
return lines.join('\n');
|
||||
});
|
||||
|
|
|
@ -78,7 +78,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
errorBorder: InputBorder.none,
|
||||
disabledBorder: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace')),
|
||||
if (_historyProvider.pubkey != '')
|
||||
historyQuery(context, _historyProvider),
|
||||
]));
|
||||
|
@ -273,7 +276,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
subtitle: Text(
|
||||
truncate(repository[2], 20,
|
||||
omission: "...", position: TruncatePosition.end),
|
||||
style: TextStyle(fontSize: 11.0),
|
||||
style: TextStyle(fontSize: 11.0, fontFamily: 'Monospace'),
|
||||
textAlign: TextAlign.center),
|
||||
trailing: Text("${repository[3]} Ğ1",
|
||||
style: TextStyle(fontSize: 14.0),
|
||||
|
|
|
@ -8,7 +8,6 @@ import 'package:provider/provider.dart';
|
|||
// ignore: must_be_immutable
|
||||
class WalletsHome extends StatelessWidget {
|
||||
final _derivationKey = GlobalKey<FormState>();
|
||||
final TextEditingController _newDerivationName = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -88,20 +87,37 @@ class WalletsHome extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget myWalletsList(BuildContext context) {
|
||||
MyWalletsProvider myWalletProvider =
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
List _listWallets = myWalletProvider.listWallets.split('\n');
|
||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||
|
||||
if (!isWalletsExists) {
|
||||
return Text('');
|
||||
}
|
||||
|
||||
if (_myWalletProvider.listWallets == '') {
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Veuillez générer votre premier portefeuille',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w500),
|
||||
)));
|
||||
}
|
||||
|
||||
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
||||
|
||||
return Expanded(
|
||||
child: ListView(children: <Widget>[
|
||||
SizedBox(height: 8),
|
||||
for (String _repository in _listWallets)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.all(5.0),
|
||||
contentPadding: const EdgeInsets.only(left: 7.0),
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text("0 Ğ1", style: TextStyle(fontSize: 14.0))),
|
||||
// subtitle: Text(_repository.split(':')[3],
|
||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||
title:
|
||||
Text(_repository.split(':')[1], style: TextStyle(fontSize: 16.0)),
|
||||
dense: true,
|
||||
|
@ -118,8 +134,10 @@ class WalletsHome extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget addNewDerivation(context, int _walletNbr) {
|
||||
final TextEditingController _newDerivationName = TextEditingController();
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
|
||||
return AlertDialog(
|
||||
content: Stack(
|
||||
overflow: Overflow.visible,
|
||||
|
|
|
@ -42,9 +42,9 @@ class SettingsScreen extends StatelessWidget {
|
|||
.redAccent, //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () => {
|
||||
onPressed: () async => {
|
||||
print('Suppression de tous les wallets'),
|
||||
_myWallets.deleteAllWallet(context)
|
||||
await _myWallets.deleteAllWallet(context)
|
||||
},
|
||||
child: Text(
|
||||
"EFFACER TOUS MES PORTEFEUILLES, LE TEMPS DE L'ALPHA",
|
||||
|
|
Loading…
Reference in New Issue