Remove pubkey from HD wallet infos; Rename portefeuille to trousseau
This commit is contained in:
parent
12d2f98672
commit
4bbb7e3915
|
@ -33,7 +33,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
final Directory walletNameDirectory =
|
final Directory walletNameDirectory =
|
||||||
Directory('${walletsDirectory.path}/$_name');
|
Directory('${walletsDirectory.path}/$_name');
|
||||||
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
|
final walletFile = File('${walletNameDirectory.path}/wallet.dewif');
|
||||||
final walletPubkey = File('${walletNameDirectory.path}/pubkey');
|
|
||||||
|
|
||||||
if (await walletNameDirectory.exists()) {
|
if (await walletNameDirectory.exists()) {
|
||||||
print('Ce wallet existe déjà, impossible de le créer.');
|
print('Ce wallet existe déjà, impossible de le créer.');
|
||||||
|
@ -43,10 +42,9 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
await walletNameDirectory.create();
|
await walletNameDirectory.create();
|
||||||
await walletFile.writeAsString('${wallet.dewif}');
|
await walletFile.writeAsString('${wallet.dewif}');
|
||||||
await walletPubkey.writeAsString('${wallet.publicKey}');
|
|
||||||
|
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
Navigator.pop(context, wallet.publicKey);
|
Navigator.pop(context, true);
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
|
|
||||||
return _name;
|
return _name;
|
||||||
|
@ -173,7 +171,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
mnemonicController.text = generatedMnemonic;
|
mnemonicController.text = generatedMnemonic;
|
||||||
pubkey.text = this.actualWallet.publicKey;
|
|
||||||
pin.text = this.actualWallet.pin;
|
pin.text = this.actualWallet.pin;
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
|
|
||||||
|
@ -190,7 +187,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List> printWallet(String _title, String _pubkey) async {
|
Future<Uint8List> printWallet(String _title) async {
|
||||||
final ByteData fontData =
|
final ByteData fontData =
|
||||||
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
||||||
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
||||||
|
@ -204,12 +201,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
pageFormat: PdfPageFormat.a4,
|
pageFormat: PdfPageFormat.a4,
|
||||||
build: (context) {
|
build: (context) {
|
||||||
return pw.Column(children: <pw.Widget>[
|
return pw.Column(children: <pw.Widget>[
|
||||||
pw.Text("Clé publique:",
|
|
||||||
style: pw.TextStyle(fontSize: 20, font: ttf)),
|
|
||||||
pw.SizedBox(height: 10),
|
|
||||||
pw.Text(_pubkey,
|
|
||||||
style: pw.TextStyle(fontSize: 15, font: ttf),
|
|
||||||
textAlign: pw.TextAlign.center),
|
|
||||||
pw.SizedBox(height: 20),
|
pw.SizedBox(height: 20),
|
||||||
pw.Text("Phrase de restauration:",
|
pw.Text("Phrase de restauration:",
|
||||||
style: pw.TextStyle(fontSize: 20, font: ttf)),
|
style: pw.TextStyle(fontSize: 20, font: ttf)),
|
||||||
|
|
|
@ -73,7 +73,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Êtes-vous sûr de vouloir supprimer tous vos portefeuilles ?'),
|
'Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
|
||||||
content: SingleChildScrollView(child: Text('')),
|
content: SingleChildScrollView(child: Text('')),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
|
@ -17,7 +17,6 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
NewWallet generatedWallet;
|
NewWallet generatedWallet;
|
||||||
|
|
||||||
TextEditingController _mnemonicController = TextEditingController();
|
TextEditingController _mnemonicController = TextEditingController();
|
||||||
TextEditingController _pubkey = TextEditingController();
|
|
||||||
TextEditingController _inputRestoreWord = TextEditingController();
|
TextEditingController _inputRestoreWord = TextEditingController();
|
||||||
TextEditingController walletName = TextEditingController();
|
TextEditingController walletName = TextEditingController();
|
||||||
FocusNode _wordFocus = FocusNode();
|
FocusNode _wordFocus = FocusNode();
|
||||||
|
@ -30,7 +29,6 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
this._mnemonicController.text = generatedMnemonic;
|
this._mnemonicController.text = generatedMnemonic;
|
||||||
this._pubkey.text = generatedWallet.publicKey;
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_generateWalletProvider.isAskedWordValid = false;
|
_generateWalletProvider.isAskedWordValid = false;
|
||||||
|
@ -49,38 +47,21 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text('Enregistrer ce portefeuille'),
|
child: Text('Enregistrer ce trousseau'),
|
||||||
)),
|
)),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Text(
|
Container(
|
||||||
'Votre clé publique est :',
|
width: 360,
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
style: TextStyle(
|
'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?',
|
||||||
fontSize: 17.0,
|
textAlign: TextAlign.center,
|
||||||
color: Colors.grey[600],
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w400),
|
fontSize: 17.0,
|
||||||
),
|
color: Colors.grey[600],
|
||||||
TextField(
|
fontWeight: FontWeight.w400),
|
||||||
enabled: false,
|
)),
|
||||||
controller: this._pubkey,
|
|
||||||
maxLines: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: InputDecoration(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
SizedBox(height: 12),
|
|
||||||
Text(
|
|
||||||
'Quel est le ${_generateWalletProvider.nbrWord + 1}ème mot de votre phrase de restauration ?',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 17.0,
|
|
||||||
color: Colors.grey[600],
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
TextFormField(
|
TextFormField(
|
||||||
focusNode: _wordFocus,
|
focusNode: _wordFocus,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -99,14 +80,16 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
color: _generateWalletProvider.askedWordColor,
|
color: _generateWalletProvider.askedWordColor,
|
||||||
fontWeight: FontWeight.w500)),
|
fontWeight: FontWeight.w500)),
|
||||||
SizedBox(height: 12),
|
SizedBox(height: 12),
|
||||||
Text(
|
Container(
|
||||||
'Choisissez un nom pour votre portefeuille :',
|
width: 360,
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
style: TextStyle(
|
'Choisissez un nom pour votre premier portefeuille :',
|
||||||
fontSize: 17.0,
|
textAlign: TextAlign.center,
|
||||||
color: Colors.grey[600],
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.w400),
|
fontSize: 17.0,
|
||||||
),
|
color: Colors.grey[600],
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
)),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
focusNode: _generateWalletProvider.walletNameFocus,
|
focusNode: _generateWalletProvider.walletNameFocus,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:gecko/models/generateWallets.dart';
|
import 'package:gecko/models/generateWallets.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
|
||||||
import 'package:gecko/screens/myWallets/confirmWalletStorage.dart';
|
import 'package:gecko/screens/myWallets/confirmWalletStorage.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:printing/printing.dart';
|
import 'package:printing/printing.dart';
|
||||||
|
@ -15,7 +13,6 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
String currentText = "";
|
String currentText = "";
|
||||||
var pinColor = Colors.grey[300];
|
var pinColor = Colors.grey[300];
|
||||||
|
|
||||||
GlobalKey _toolTipPubkey = GlobalKey();
|
|
||||||
GlobalKey _toolTipSentence = GlobalKey();
|
GlobalKey _toolTipSentence = GlobalKey();
|
||||||
GlobalKey _toolTipSecret = GlobalKey();
|
GlobalKey _toolTipSecret = GlobalKey();
|
||||||
|
|
||||||
|
@ -23,8 +20,6 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider _generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
|
||||||
_generateWalletProvider.generateMnemonic();
|
_generateWalletProvider.generateMnemonic();
|
||||||
print('IS GENERATED ? : ' +
|
print('IS GENERATED ? : ' +
|
||||||
_generateWalletProvider.walletIsGenerated.toString());
|
_generateWalletProvider.walletIsGenerated.toString());
|
||||||
|
@ -32,7 +27,7 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text('Générer un portefeuille'),
|
child: Text('Générer un trousseau'),
|
||||||
)),
|
)),
|
||||||
floatingActionButton: Container(
|
floatingActionButton: Container(
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
|
@ -53,26 +48,6 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
toolTips(_toolTipPubkey, 'Clé publique:',
|
|
||||||
"C'est votre RIB en Ğ1, les gens l'utiliseront pour vous payer"),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(
|
|
||||||
text: _generateWalletProvider.pubkey.text));
|
|
||||||
_walletOptions.snackCopyKey(ctx);
|
|
||||||
},
|
|
||||||
child: TextField(
|
|
||||||
enabled: false,
|
|
||||||
controller: _generateWalletProvider.pubkey,
|
|
||||||
maxLines: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: InputDecoration(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontFamily: 'Monospace'))),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
||||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
||||||
TextField(
|
TextField(
|
||||||
|
@ -137,7 +112,7 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Text('Enregistrer ce portefeuille',
|
child: Text('Enregistrer ce trousseau',
|
||||||
style: TextStyle(fontSize: 20))),
|
style: TextStyle(fontSize: 20))),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
@ -146,9 +121,7 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return PrintWallet(
|
return PrintWallet(
|
||||||
_generateWalletProvider.generatedMnemonic,
|
_generateWalletProvider.generatedMnemonic);
|
||||||
_generateWalletProvider
|
|
||||||
.actualWallet.publicKey);
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -194,10 +167,9 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class PrintWallet extends StatelessWidget {
|
class PrintWallet extends StatelessWidget {
|
||||||
PrintWallet(this.sentence, this.pubkey);
|
PrintWallet(this.sentence);
|
||||||
|
|
||||||
final String sentence;
|
final String sentence;
|
||||||
final String pubkey;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -205,10 +177,9 @@ class PrintWallet extends StatelessWidget {
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
appBar: AppBar(title: Text('Imprimer ce portefeuille')),
|
appBar: AppBar(title: Text('Imprimer ce trousseau')),
|
||||||
body: PdfPreview(
|
body: PdfPreview(
|
||||||
build: (format) =>
|
build: (format) => _generateWalletProvider.printWallet(sentence),
|
||||||
_generateWalletProvider.printWallet(sentence, pubkey),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
return GenerateWalletsScreen();
|
return GenerateWalletsScreen();
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
child: Text('Générer un portefeuille',
|
child: Text('Générer un trousseau',
|
||||||
style: TextStyle(fontSize: 20))),
|
style: TextStyle(fontSize: 20))),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
Center(
|
Center(
|
||||||
|
|
Loading…
Reference in New Issue