Merge branch 'implementTransactions'
This commit is contained in:
commit
21deb6b922
|
@ -1,4 +1,6 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:gecko/models/myWallets.dart';
|
||||||
|
import 'package:logger/logger.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
// Files paths
|
// Files paths
|
||||||
|
@ -7,14 +9,18 @@ Directory walletsDirectory;
|
||||||
File defaultWalletFile;
|
File defaultWalletFile;
|
||||||
File currentChestFile;
|
File currentChestFile;
|
||||||
|
|
||||||
String defaultWallet;
|
WalletData defaultWallet;
|
||||||
String appVersion;
|
String appVersion;
|
||||||
SharedPreferences prefs;
|
SharedPreferences prefs;
|
||||||
String endPointGVA;
|
String endPointGVA;
|
||||||
int ramSys;
|
int ramSys;
|
||||||
|
|
||||||
String cesiumPod = "https://g1.data.le-sou.org";
|
// String cesiumPod = "https://g1.data.le-sou.org";
|
||||||
|
String cesiumPod = "https://g1.data.e-is.pro";
|
||||||
|
|
||||||
// Responsive ratios
|
// Responsive ratios
|
||||||
bool isTall;
|
bool isTall;
|
||||||
double ratio;
|
double ratio;
|
||||||
|
|
||||||
|
// Logger
|
||||||
|
var log = Logger();
|
||||||
|
|
|
@ -44,6 +44,7 @@ Future<void> main() async {
|
||||||
await _homeProvider.getAppPath();
|
await _homeProvider.getAppPath();
|
||||||
await _homeProvider.createDefaultAvatar();
|
await _homeProvider.createDefaultAvatar();
|
||||||
await _walletsProvider.initWalletFolder();
|
await _walletsProvider.initWalletFolder();
|
||||||
|
_walletsProvider.getDefaultWallet();
|
||||||
appVersion = await _homeProvider.getAppVersion();
|
appVersion = await _homeProvider.getAppVersion();
|
||||||
prefs = await SharedPreferences.getInstance();
|
prefs = await SharedPreferences.getInstance();
|
||||||
// final HiveStore _store =
|
// final HiveStore _store =
|
||||||
|
|
|
@ -68,7 +68,6 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
final response = await http.post((Uri.parse(queryOptions[0])),
|
final response = await http.post((Uri.parse(queryOptions[0])),
|
||||||
body: queryOptions[1], headers: queryOptions[2]);
|
body: queryOptions[1], headers: queryOptions[2]);
|
||||||
// print('RESULT CESIUM QUERY: ${response.body}'); //For debug
|
|
||||||
final responseJson = json.decode(response.body);
|
final responseJson = json.decode(response.body);
|
||||||
if (responseJson['hits']['hits'].toString() == '[]') {
|
if (responseJson['hits']['hits'].toString() == '[]') {
|
||||||
return '';
|
return '';
|
||||||
|
@ -79,7 +78,6 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
_name = responseJson['hits']['hits'][0]['_source']['title'];
|
_name = responseJson['hits']['hits'][0]['_source']['title'];
|
||||||
print(_name);
|
|
||||||
|
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +86,6 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
final response = await http.post((Uri.parse(queryOptions[0])),
|
final response = await http.post((Uri.parse(queryOptions[0])),
|
||||||
body: queryOptions[1], headers: queryOptions[2]);
|
body: queryOptions[1], headers: queryOptions[2]);
|
||||||
// print('RESULT CESIUM QUERY: ${response.body}'); //For debug
|
|
||||||
final responseJson = json.decode(response.body);
|
final responseJson = json.decode(response.body);
|
||||||
if (responseJson['hits']['hits'].toString() == '[]') {
|
if (responseJson['hits']['hits'].toString() == '[]') {
|
||||||
return [File(appPath.path + '/default_avatar.png')];
|
return [File(appPath.path + '/default_avatar.png')];
|
||||||
|
@ -103,21 +100,10 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
|
|
||||||
var avatarFile =
|
var avatarFile =
|
||||||
File('${(await getTemporaryDirectory()).path}/avatar$iAvatar.png');
|
File('${(await getTemporaryDirectory()).path}/avatar$iAvatar.png');
|
||||||
// final bool _isAvatarExist = await avatarFile.exists();
|
|
||||||
// if (_isAvatarExist) {
|
|
||||||
// await avatarFile.delete();
|
|
||||||
// }
|
|
||||||
await avatarFile.writeAsBytes(base64.decode(_avatar));
|
await avatarFile.writeAsBytes(base64.decode(_avatar));
|
||||||
iAvatar++;
|
iAvatar++;
|
||||||
isComplete = true;
|
isComplete = true;
|
||||||
|
|
||||||
return [avatarFile];
|
return [avatarFile];
|
||||||
}
|
}
|
||||||
|
|
||||||
// isNameComplete() {
|
|
||||||
// while (isComplete == false) {
|
|
||||||
// print(isComplete);
|
|
||||||
// Duration(milliseconds: 50);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ChangePinProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return newWalletFile;
|
return newWalletFile;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Impossible de changer le code PIN.');
|
log.e('Impossible de changer le code PIN.');
|
||||||
return badWallet;
|
return badWallet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ class ChangePinProvider 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');
|
||||||
print(_newWalletFile);
|
|
||||||
|
|
||||||
walletFile.writeAsString('${_newWalletFile.dewif}');
|
walletFile.writeAsString('${_newWalletFile.dewif}');
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
|
@ -79,8 +79,6 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
final runesAsked = _mnemo.split(' ')[nbrWord].runes;
|
final runesAsked = _mnemo.split(' ')[nbrWord].runes;
|
||||||
List<int> runesAskedUnaccent = [];
|
List<int> runesAskedUnaccent = [];
|
||||||
print(runesAsked);
|
|
||||||
print(value.runes);
|
|
||||||
for (int i in runesAsked) {
|
for (int i in runesAsked) {
|
||||||
if (i == 768 || i == 769 || i == 770 || i == 771) {
|
if (i == 768 || i == 769 || i == 770 || i == 771) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -92,11 +90,11 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
utf8.decode(runesAskedUnaccent).toLowerCase();
|
utf8.decode(runesAskedUnaccent).toLowerCase();
|
||||||
final String unaccentedInputWord = removeDiacritics(value).toLowerCase();
|
final String unaccentedInputWord = removeDiacritics(value).toLowerCase();
|
||||||
|
|
||||||
print("Is $unaccentedAskedWord equal to input $unaccentedInputWord ?");
|
log.i("Is $unaccentedAskedWord equal to input $unaccentedInputWord ?");
|
||||||
if (unaccentedAskedWord == unaccentedInputWord ||
|
if (unaccentedAskedWord == unaccentedInputWord ||
|
||||||
value == 'triche' ||
|
value == 'triche' ||
|
||||||
value == '3.14') {
|
value == '3.14') {
|
||||||
print('Word is OK');
|
log.d('Word is OK');
|
||||||
isAskedWordValid = true;
|
isAskedWordValid = true;
|
||||||
askedWordColor = Colors.green[600];
|
askedWordColor = Colors.green[600];
|
||||||
// walletNameFocus.nextFocus();
|
// walletNameFocus.nextFocus();
|
||||||
|
@ -155,7 +153,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
this.actualWallet = await generateWallet(this.generatedMnemonic);
|
this.actualWallet = await generateWallet(this.generatedMnemonic);
|
||||||
walletIsGenerated = true;
|
walletIsGenerated = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
log.e(e);
|
||||||
}
|
}
|
||||||
return generatedMnemonic;
|
return generatedMnemonic;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +166,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
secretCodeType: SecretCodeType.letters,
|
secretCodeType: SecretCodeType.letters,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
log.e(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
mnemonicController.text = generatedMnemonic;
|
mnemonicController.text = generatedMnemonic;
|
||||||
|
@ -240,7 +238,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
cesiumPubkey.text = _walletPubkey;
|
cesiumPubkey.text = _walletPubkey;
|
||||||
pin.text = actualWallet.pin;
|
pin.text = actualWallet.pin;
|
||||||
isPinChanged = true;
|
isPinChanged = true;
|
||||||
print(_walletPubkey);
|
log.d(_walletPubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future importWallet(context, _cesiumID, _cesiumPWD) async {
|
Future importWallet(context, _cesiumID, _cesiumPWD) async {
|
||||||
|
@ -291,20 +289,13 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
int _nbr = 1;
|
int _nbr = 1;
|
||||||
|
|
||||||
for (word in _sentance.split(' ')) {
|
for (word in _sentance.split(' ')) {
|
||||||
// print(word);
|
|
||||||
_wordsList.add("$_nbr:$word");
|
_wordsList.add("$_nbr:$word");
|
||||||
_nbr++;
|
_nbr++;
|
||||||
}
|
}
|
||||||
// notifyListeners();
|
|
||||||
|
|
||||||
return _wordsList;
|
return _wordsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void makeError() {
|
|
||||||
// var tata = File(appPath.path + '/ddfhjftjfg');
|
|
||||||
// tata.readAsLinesSync();
|
|
||||||
// }
|
|
||||||
|
|
||||||
void reloadBuild() {
|
void reloadBuild() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -26,6 +29,8 @@ class HistoryProvider with ChangeNotifier {
|
||||||
bool isHistoryScreen = false;
|
bool isHistoryScreen = false;
|
||||||
String historySwitchButtun = "Voir l'historique";
|
String historySwitchButtun = "Voir l'historique";
|
||||||
String rawSvg;
|
String rawSvg;
|
||||||
|
TextEditingController payAmount = TextEditingController();
|
||||||
|
TextEditingController payComment = TextEditingController();
|
||||||
|
|
||||||
Future scan(context) async {
|
Future scan(context) async {
|
||||||
await Permission.camera.request();
|
await Permission.camera.request();
|
||||||
|
@ -33,7 +38,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
try {
|
try {
|
||||||
barcode = await scanner.scan();
|
barcode = await scanner.scan();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
log.e(e);
|
||||||
return 'false';
|
return 'false';
|
||||||
}
|
}
|
||||||
if (barcode != null) {
|
if (barcode != null) {
|
||||||
|
@ -45,6 +50,29 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return barcode;
|
return barcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> pay(BuildContext context, String pinCode) async {
|
||||||
|
// MyWalletsProvider _myWalletProvider = MyWalletsProvider();
|
||||||
|
List dewifList = await File(
|
||||||
|
walletsDirectory.path + '/${defaultWallet.chest}/wallet.dewif')
|
||||||
|
.readAsLines();
|
||||||
|
String dewif = dewifList[0];
|
||||||
|
try {
|
||||||
|
await DubpRust.simplePaymentFromTransparentAccount(
|
||||||
|
accountIndex: defaultWallet.derivation,
|
||||||
|
amount: double.parse(payAmount.text),
|
||||||
|
txComment: payComment.text,
|
||||||
|
dewif: dewif,
|
||||||
|
gvaEndpoint: endPointGVA,
|
||||||
|
secretCode: pinCode,
|
||||||
|
recipient: pubkey);
|
||||||
|
return "Success";
|
||||||
|
} catch (e) {
|
||||||
|
log.e("ERROR DUBP PAYMENTS");
|
||||||
|
log.e(e);
|
||||||
|
return "Payments errors: $e";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String isPubkey(context, pubkey, {bool goHistory}) {
|
String isPubkey(context, pubkey, {bool goHistory}) {
|
||||||
HomeProvider _homeProvider =
|
HomeProvider _homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
@ -57,7 +85,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
if (regExp.hasMatch(pubkey) == true &&
|
if (regExp.hasMatch(pubkey) == true &&
|
||||||
pubkey.length > 42 &&
|
pubkey.length > 42 &&
|
||||||
pubkey.length < 45) {
|
pubkey.length < 45) {
|
||||||
print("C'est une pubkey !!!");
|
log.d("C'est une pubkey !!!");
|
||||||
|
|
||||||
this.pubkey = pubkey;
|
this.pubkey = pubkey;
|
||||||
getShortPubkey(pubkey);
|
getShortPubkey(pubkey);
|
||||||
|
@ -105,6 +133,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
return pubkeyShort;
|
return pubkeyShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// poka: Do99s6wQR2JLfhirPdpAERSjNbmjjECzGxHNJMiNKT3P
|
||||||
// Pi: D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU // For debug
|
// Pi: D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU // For debug
|
||||||
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
|
// Boris: JE6mkuzSpT3ePciCPRTpuMT9fqPUVVLJz2618d33p7tn
|
||||||
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25.
|
// Matograine portefeuille: 9p5nHsES6xujFR7pw2yGy4PLKKHgWsMvsDHaHF64Uj25.
|
||||||
|
@ -142,8 +171,6 @@ class HistoryProvider with ChangeNotifier {
|
||||||
final date = formatter.format(dateBrut);
|
final date = formatter.format(dateBrut);
|
||||||
transBC[i].add(transaction['writtenTime']);
|
transBC[i].add(transaction['writtenTime']);
|
||||||
transBC[i].add(date);
|
transBC[i].add(date);
|
||||||
// print(
|
|
||||||
// "DEBUG date et comment: ${date.toString()} -- ${transaction['comment'].toString()}");
|
|
||||||
final int amountBrut = int.parse(output.split(':')[0]);
|
final int amountBrut = int.parse(output.split(':')[0]);
|
||||||
final base = int.parse(output.split(':')[1]);
|
final base = int.parse(output.split(':')[1]);
|
||||||
final int applyBase = base - currentBase;
|
final int applyBase = base - currentBase;
|
||||||
|
@ -176,9 +203,6 @@ class HistoryProvider with ChangeNotifier {
|
||||||
pageInfo = result.data['txsHistoryBc']['both']['pageInfo'];
|
pageInfo = result.data['txsHistoryBc']['both']['pageInfo'];
|
||||||
|
|
||||||
fetchMoreCursor = pageInfo['endCursor'];
|
fetchMoreCursor = pageInfo['endCursor'];
|
||||||
print('hasPreviousPage: ' + pageInfo['hasPreviousPage'].toString());
|
|
||||||
print('hasNextPage: ' + pageInfo['hasNextPage'].toString());
|
|
||||||
|
|
||||||
if (fetchMoreCursor != null) {
|
if (fetchMoreCursor != null) {
|
||||||
opts = FetchMoreOptions(
|
opts = FetchMoreOptions(
|
||||||
variables: {'cursor': fetchMoreCursor},
|
variables: {'cursor': fetchMoreCursor},
|
||||||
|
@ -196,12 +220,12 @@ class HistoryProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
print(
|
log.d(
|
||||||
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
||||||
if (fetchMoreCursor != null) {
|
if (fetchMoreCursor != null) {
|
||||||
transBC = parseHistory(blockchainTX, _pubkey);
|
transBC = parseHistory(blockchainTX, _pubkey);
|
||||||
} else {
|
} else {
|
||||||
print("###### DEBUG H - Début de l'historique");
|
log.i("###### DEBUG H - Début de l'historique");
|
||||||
}
|
}
|
||||||
|
|
||||||
return opts;
|
return opts;
|
||||||
|
|
|
@ -53,10 +53,10 @@ class HomeProvider with ChangeNotifier {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
i++;
|
i++;
|
||||||
print(i.toString() + ' ème essai de recherche de endpoint GVA.');
|
log.d(i.toString() + ' ème essai de recherche de endpoint GVA.');
|
||||||
print('Try GVA endpoint: ${_listEndpoints[i]}');
|
log.d('Try GVA endpoint: ${_listEndpoints[i]}');
|
||||||
if (i > 2) {
|
if (i > 2) {
|
||||||
print('NO VALID GVA ENDPOINT FOUND');
|
log.e('NO VALID GVA ENDPOINT FOUND');
|
||||||
_endpoint = 'HS';
|
_endpoint = 'HS';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -71,21 +71,21 @@ class HomeProvider with ChangeNotifier {
|
||||||
_endpoint = _listEndpoints[i];
|
_endpoint = _listEndpoints[i];
|
||||||
_statusCode = response.statusCode;
|
_statusCode = response.statusCode;
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
print('This endpoint is timeout, next');
|
log.e('This endpoint is timeout, next');
|
||||||
_statusCode = 50;
|
_statusCode = 50;
|
||||||
continue;
|
continue;
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
print('This endpoint is a bad endpoint, next');
|
log.e('This endpoint is a bad endpoint, next');
|
||||||
_statusCode = 70;
|
_statusCode = 70;
|
||||||
continue;
|
continue;
|
||||||
} on Exception {
|
} on Exception {
|
||||||
print('Unknown error');
|
log.e('Unknown error');
|
||||||
_statusCode = 60;
|
_statusCode = 60;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} while (_statusCode != 400);
|
} while (_statusCode != 400);
|
||||||
|
|
||||||
print('ENDPOINT: ' + _endpoint);
|
log.i('ENDPOINT: ' + _endpoint);
|
||||||
return _endpoint;
|
return _endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,12 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MyWalletsProvider with ChangeNotifier {
|
class MyWalletsProvider with ChangeNotifier {
|
||||||
String listWallets;
|
List<WalletData> listWallets = [];
|
||||||
|
String pinCode;
|
||||||
|
int pinLenght;
|
||||||
|
|
||||||
Future initWalletFolder() async {
|
Future initWalletFolder() async {
|
||||||
getDefaultWallet();
|
// getDefaultWallet();
|
||||||
|
|
||||||
final bool isWalletFolderExist = await walletsDirectory.exists();
|
final bool isWalletFolderExist = await walletsDirectory.exists();
|
||||||
if (!isWalletFolderExist) {
|
if (!isWalletFolderExist) {
|
||||||
|
@ -30,6 +32,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
await File('${walletsDirectory.path}/0/order.conf').create();
|
await File('${walletsDirectory.path}/0/order.conf').create();
|
||||||
await File('${walletsDirectory.path}/1/list.conf').create();
|
await File('${walletsDirectory.path}/1/list.conf').create();
|
||||||
await File('${walletsDirectory.path}/1/order.conf').create();
|
await File('${walletsDirectory.path}/1/order.conf').create();
|
||||||
|
getDefaultWallet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,67 +52,61 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String _walletList = getAllWalletsNames(0);
|
final List _walletList = readAllWallets(0);
|
||||||
|
|
||||||
if (_walletList == '') {
|
if (_walletList.isEmpty) {
|
||||||
print('No wallets detected');
|
log.i('No wallets detected');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
print('Some wallets have been detected.');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getAllWalletsNames(int _chest) {
|
List readAllWallets(int _chest) {
|
||||||
if (listWallets != null && listWallets.isNotEmpty) {
|
// log.d(walletsDirectory.path);
|
||||||
listWallets = '';
|
|
||||||
}
|
|
||||||
if (listWallets == null) {
|
|
||||||
listWallets = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
print(walletsDirectory.path);
|
listWallets = [];
|
||||||
|
|
||||||
// int i = 0;
|
|
||||||
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
|
File _walletConfig = File('${walletsDirectory.path}/$_chest/list.conf');
|
||||||
_walletConfig.readAsLinesSync().forEach((element) {
|
_walletConfig.readAsLinesSync().forEach((element) {
|
||||||
if (listWallets != '') {
|
listWallets.add(WalletData(element));
|
||||||
listWallets += '\n';
|
|
||||||
}
|
|
||||||
listWallets += element;
|
|
||||||
// listWallets += "${element.split(':')[0]}:${element.split(':')[1]}:${element.split(':')[2]}"
|
|
||||||
});
|
});
|
||||||
print(listWallets);
|
|
||||||
|
|
||||||
|
log.i(listWallets.toString());
|
||||||
return listWallets;
|
return listWallets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WalletData getWalletData(String _id) {
|
||||||
|
int chest = int.parse(_id.split(':')[0]);
|
||||||
|
final _walletConfig = File('${walletsDirectory.path}/$chest/list.conf');
|
||||||
|
|
||||||
|
return WalletData(_walletConfig
|
||||||
|
.readAsLinesSync()
|
||||||
|
.firstWhere((element) => element.startsWith(_id)));
|
||||||
|
}
|
||||||
|
|
||||||
void getDefaultWallet() {
|
void getDefaultWallet() {
|
||||||
defaultWalletFile = File('${appPath.path}/defaultWallet');
|
defaultWalletFile = File('${appPath.path}/defaultWallet');
|
||||||
|
|
||||||
bool isdefaultWalletFile = defaultWalletFile.existsSync();
|
if (!defaultWalletFile.existsSync()) {
|
||||||
|
|
||||||
if (!isdefaultWalletFile) {
|
|
||||||
File(defaultWalletFile.path).createSync();
|
File(defaultWalletFile.path).createSync();
|
||||||
|
defaultWalletFile.writeAsStringSync("0:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
defaultWallet = getWalletData(defaultWalletFile.readAsStringSync());
|
||||||
defaultWallet = defaultWalletFile.readAsStringSync();
|
|
||||||
} catch (e) {
|
|
||||||
defaultWallet = '0:0';
|
|
||||||
}
|
|
||||||
if (defaultWallet == '') defaultWallet = '0:0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteAllWallet(context) async {
|
Future<int> deleteAllWallet(context) async {
|
||||||
try {
|
try {
|
||||||
print('DELETE THAT ?: $walletsDirectory');
|
log.w('DELETE THAT ?: $walletsDirectory');
|
||||||
|
|
||||||
final bool _answer = await _confirmDeletingAllWallets(context);
|
final bool _answer = await _confirmDeletingAllWallets(context);
|
||||||
|
|
||||||
if (_answer) {
|
if (_answer) {
|
||||||
await walletsDirectory.delete(recursive: true);
|
await walletsDirectory.delete(recursive: true);
|
||||||
|
await defaultWalletFile.delete();
|
||||||
await walletsDirectory.create();
|
await walletsDirectory.create();
|
||||||
|
await defaultWalletFile.create();
|
||||||
await initWalletFolder();
|
await initWalletFolder();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@ -143,7 +140,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_myWalletProvider.listWallets =
|
_myWalletProvider.listWallets =
|
||||||
_myWalletProvider.getAllWalletsNames(getCurrentChest());
|
_myWalletProvider.readAllWallets(getCurrentChest());
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
});
|
});
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
|
@ -177,7 +174,6 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
'\n0:$_newWalletNbr:$_name:$_newDerivationNbr',
|
'\n0:$_newWalletNbr:$_name:$_newDerivationNbr',
|
||||||
mode: FileMode.append);
|
mode: FileMode.append);
|
||||||
|
|
||||||
print(await _walletConfig.readAsString());
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@ -187,3 +183,37 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wallet data contains elements identifying wallet
|
||||||
|
class WalletData {
|
||||||
|
int chest;
|
||||||
|
int number;
|
||||||
|
String name;
|
||||||
|
int derivation;
|
||||||
|
|
||||||
|
// constructor from ':'-separated string
|
||||||
|
WalletData(String element) {
|
||||||
|
List parts = element.split(':');
|
||||||
|
|
||||||
|
this.chest = int.parse(parts[0]);
|
||||||
|
this.number = int.parse(parts[1]);
|
||||||
|
this.name = parts[2];
|
||||||
|
this.derivation = int.parse(parts[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// representation of WalletData when debugging
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// creates the ':'-separated string from the WalletData
|
||||||
|
String inLine() {
|
||||||
|
return "${this.chest}:${this.number}:${this.name}:${this.derivation}";
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns only the id part of the ':'-separated string
|
||||||
|
String id() {
|
||||||
|
return "${this.chest}:${this.number}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// import 'dart:ffi';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
|
@ -7,6 +8,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:truncate/truncate.dart';
|
import 'package:truncate/truncate.dart';
|
||||||
import 'package:qrscan/qrscan.dart' as scanner;
|
import 'package:qrscan/qrscan.dart' as scanner;
|
||||||
|
@ -36,9 +38,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (regExp.hasMatch(_pin) == true && _pin.length == _pinLenght) {
|
if (regExp.hasMatch(_pin) == true && _pin.length == _pinLenght) {
|
||||||
print("Le format du code PIN est correct.");
|
|
||||||
} else {
|
} else {
|
||||||
print('Format de code PIN invalide');
|
|
||||||
return 'false';
|
return 'false';
|
||||||
}
|
}
|
||||||
if (derivation != -1) {
|
if (derivation != -1) {
|
||||||
|
@ -51,8 +51,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
return _pubkey;
|
return _pubkey;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Bad PIN code !');
|
log.w('Bad PIN code !\n' + e);
|
||||||
print(e);
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return 'false';
|
return 'false';
|
||||||
|
@ -64,8 +63,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return _pubkey;
|
return _pubkey;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Bad PIN code !');
|
log.w('Bad PIN code !\n' + e);
|
||||||
print(e);
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
return 'false';
|
return 'false';
|
||||||
|
@ -74,15 +72,17 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future readLocalWallet(
|
Future readLocalWallet(
|
||||||
int _walletNbr, String _pin, int _pinLenght, int derivation) async {
|
context, WalletData _wallet, String _pin, int _pinLenght) async {
|
||||||
isWalletUnlock = false;
|
isWalletUnlock = false;
|
||||||
try {
|
try {
|
||||||
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(_pin);
|
||||||
|
|
||||||
if ((_localPubkey = await _getPubkeyFromDewif(
|
if ((_localPubkey = await _getPubkeyFromDewif(
|
||||||
_localDewif, _pin, _pinLenght, derivation)) !=
|
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
|
||||||
'false') {
|
'false') {
|
||||||
this.pubkey.text = _localPubkey;
|
this.pubkey.text = _localPubkey;
|
||||||
isWalletUnlock = true;
|
isWalletUnlock = true;
|
||||||
|
@ -93,7 +93,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
throw 'Bad pubkey';
|
throw 'Bad pubkey';
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('ERROR READING FILE: $e');
|
log.e('ERROR READING FILE: $e');
|
||||||
this.pubkey.clear();
|
this.pubkey.clear();
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
return 'bad';
|
return 'bad';
|
||||||
|
@ -110,7 +110,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
throw false;
|
throw false;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('ERROR READING FILE: $e');
|
log.e('ERROR READING FILE: $e');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,27 +136,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
String newConfig =
|
String newConfig =
|
||||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||||
int nbrLines = lines.length;
|
int nbrLines = lines.length;
|
||||||
// print(lines);
|
|
||||||
// print(nbrLines);
|
|
||||||
// int _index = lines.indexOf('0:$_walletNbr:$_walletName:$_derivation');
|
|
||||||
if (nbrLines != 1) {
|
if (nbrLines != 1) {
|
||||||
for (String wLine in lines) {
|
for (String wLine in lines) {
|
||||||
String wID = "${wLine.split(':')[0]}:${wLine.split(':')[1]}";
|
String wID = "${wLine.split(':')[0]}:${wLine.split(':')[1]}";
|
||||||
print(
|
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
|
||||||
print(wLine);
|
|
||||||
String deri = wLine.split(':')[3];
|
String deri = wLine.split(':')[3];
|
||||||
print("($wID == $_walletID ???");
|
|
||||||
if (wID == _walletID) {
|
if (wID == _walletID) {
|
||||||
lines.remove(wLine);
|
lines.remove(wLine);
|
||||||
lines.add('$_walletID:$_newName:$deri');
|
lines.add('$_walletID:$_newName:$deri');
|
||||||
// return '$_walletID:$_newName:$deri';
|
|
||||||
print('OOUUUUUUUIIIIIIIIIIIIIIIIIII');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// lines.removeWhere((element) =>
|
|
||||||
// '${element.split(':')[0]}:${element.split(':')[1]}' == _walletID);
|
|
||||||
// lines.add('$_walletID:$_newName:$deri');
|
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
} else {
|
} else {
|
||||||
return 'true';
|
return 'true';
|
||||||
|
@ -229,17 +217,16 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
return nameState;
|
return nameState;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteWallet(context, _walletNbr, _name, _derivation) async {
|
Future<int> deleteWallet(context, wallet) async {
|
||||||
final bool _answer = await _confirmDeletingWallet(context, _name);
|
final bool _answer = await _confirmDeletingWallet(context, wallet.name);
|
||||||
|
|
||||||
if (_answer) {
|
if (_answer) {
|
||||||
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
final _walletConfig = File('${walletsDirectory.path}/0/list.conf');
|
||||||
|
|
||||||
if (_derivation != -1) {
|
if (wallet.derivation != -1) {
|
||||||
String newConfig =
|
String newConfig =
|
||||||
await _walletConfig.readAsLines().then((List<String> lines) {
|
await _walletConfig.readAsLines().then((List<String> lines) {
|
||||||
lines.removeWhere((element) =>
|
lines.removeWhere((element) => element.contains(wallet.inLine()));
|
||||||
element.contains('0:$_walletNbr:$_name:$_derivation'));
|
|
||||||
|
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
});
|
});
|
||||||
|
@ -247,7 +234,8 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
await _walletConfig.delete();
|
await _walletConfig.delete();
|
||||||
await _walletConfig.writeAsString(newConfig);
|
await _walletConfig.writeAsString(newConfig);
|
||||||
} else {
|
} else {
|
||||||
final _walletFile = Directory('${walletsDirectory.path}/$_walletNbr');
|
final _walletFile =
|
||||||
|
Directory('${walletsDirectory.path}/${wallet.number}');
|
||||||
await _walletFile.delete(recursive: true);
|
await _walletFile.delete(recursive: true);
|
||||||
}
|
}
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
|
@ -308,7 +296,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
return newWalletFile;
|
return newWalletFile;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Impossible de changer le code PIN.');
|
log.e('Impossible de changer le code PIN.');
|
||||||
return badWallet;
|
return badWallet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +305,6 @@ class WalletOptionsProvider 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');
|
||||||
print(_newWalletFile);
|
|
||||||
|
|
||||||
walletFile.writeAsString('${_newWalletFile.dewif}');
|
walletFile.writeAsString('${_newWalletFile.dewif}');
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@ -374,7 +361,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
_image = File(pickedFile.path);
|
_image = File(pickedFile.path);
|
||||||
return _image;
|
return _image;
|
||||||
} else {
|
} else {
|
||||||
print('No image selected.');
|
log.w('No image selected.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/history.dart';
|
import 'package:gecko/models/history.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/unlockingWallet.dart';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -33,8 +34,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
this._outputPubkey.text = _historyProvider.pubkey;
|
this._outputPubkey.text = _historyProvider.pubkey;
|
||||||
print('Build pubkey : ' + _historyProvider.pubkey);
|
log.i('Build pubkey : ' + _historyProvider.pubkey);
|
||||||
// _historyProvider.snackNode(context);
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -57,7 +57,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _homeProvider.searchQuery,
|
controller: _homeProvider.searchQuery,
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
print("Clé tappé: $text");
|
log.d("Clé tappé: $text");
|
||||||
final String searchResult =
|
final String searchResult =
|
||||||
_historyProvider.isPubkey(context, text);
|
_historyProvider.isPubkey(context, text);
|
||||||
if (searchResult != '') {
|
if (searchResult != '') {
|
||||||
|
@ -113,7 +113,6 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context);
|
Provider.of<CesiumPlusProvider>(context);
|
||||||
print("I'M HERE 1");
|
|
||||||
bool _isFirstExec = true;
|
bool _isFirstExec = true;
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -130,18 +129,14 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||||
print("I'M HERE 2 ! $_isFirstExec");
|
|
||||||
// print(result.source.isEager);
|
|
||||||
|
|
||||||
if (result.isLoading && result.data == null) {
|
if (result.isLoading && result.data == null) {
|
||||||
print("I'M HERE 3 !");
|
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.hasException) {
|
if (result.hasException) {
|
||||||
print('Error GVA: ' + result.exception.toString());
|
log.e('Error GVA: ' + result.exception.toString());
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
Text(
|
Text(
|
||||||
|
@ -315,7 +310,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
// ),
|
// ),
|
||||||
_historyProvider.isHistoryScreen
|
_historyProvider.isHistoryScreen
|
||||||
? historyView(context, result)
|
? historyView(context, result)
|
||||||
: payView(context),
|
: payView(context, _historyProvider),
|
||||||
],
|
],
|
||||||
))),
|
))),
|
||||||
onNotification: (t) {
|
onNotification: (t) {
|
||||||
|
@ -332,9 +327,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget payView(context) {
|
Widget payView(context, HistoryProvider _historyProvider) {
|
||||||
TextEditingController payComment = new TextEditingController();
|
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -344,26 +337,34 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
Text('Commentaire:'),
|
Text('Commentaire:', style: TextStyle(fontSize: 20.0)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: payComment,
|
controller: _historyProvider.payComment,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
decoration: InputDecoration(),
|
decoration: InputDecoration(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontSize: 22,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.bold))),
|
fontWeight: FontWeight.bold))),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
Text('Montant (Ğ1):'),
|
Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
style: TextStyle(fontSize: 22),
|
||||||
|
controller: _historyProvider.payAmount,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0)),
|
||||||
|
),
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
FilteringTextInputFormatter.allow(RegExp(r'(^\d*\.?\d*)'))
|
FilteringTextInputFormatter.allow(RegExp(r'(^\d*\.?\d*)'))
|
||||||
],
|
],
|
||||||
|
@ -375,9 +376,15 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
style: OutlinedButton.styleFrom(
|
style: OutlinedButton.styleFrom(
|
||||||
side: BorderSide(width: 2, color: Color(0xffD28928))),
|
side: BorderSide(width: 2, color: Color(0xffD28928))),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState.validate()) {
|
// if (_formKey.currentState.validate()) {
|
||||||
_formKey.currentState.save();
|
// _formKey.currentState.save();
|
||||||
}
|
// }
|
||||||
|
// _historyProvider.pay(payAmount.text, payComment.text);
|
||||||
|
Navigator.push(context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return UnlockingWallet(
|
||||||
|
wallet: defaultWallet, action: "pay");
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:gecko/models/history.dart';
|
||||||
import 'package:gecko/models/home.dart';
|
import 'package:gecko/models/home.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/unlockingWallet.dart';
|
||||||
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:gecko/screens/settings.dart';
|
import 'package:gecko/screens/settings.dart';
|
||||||
|
@ -97,7 +98,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: _homeProvider.searchQuery,
|
controller: _homeProvider.searchQuery,
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
print("Clé tappé: $text");
|
log.d("Clé tappé: $text");
|
||||||
final String searchResult =
|
final String searchResult =
|
||||||
_historyProvider.isPubkey(context, text);
|
_historyProvider.isPubkey(context, text);
|
||||||
if (searchResult != '') {
|
if (searchResult != '') {
|
||||||
|
@ -270,8 +271,17 @@ class HomeScreen extends StatelessWidget {
|
||||||
height: 57)),
|
height: 57)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
isWalletsExists
|
isWalletsExists
|
||||||
? Navigator.pushNamed(
|
? Navigator.push(context,
|
||||||
context, '/mywallets')
|
MaterialPageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
return UnlockingWallet(
|
||||||
|
wallet: defaultWallet,
|
||||||
|
action: "mywallets",
|
||||||
|
);
|
||||||
|
}))
|
||||||
|
|
||||||
|
// Navigator.pushNamed(
|
||||||
|
// context, '/mywallets')
|
||||||
: Navigator.push(context,
|
: Navigator.push(context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
|
|
@ -138,8 +138,8 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
WidgetsBinding.instance
|
WidgetsBinding.instance
|
||||||
.addPostFrameCallback((_) {
|
.addPostFrameCallback((_) {
|
||||||
_myWalletProvider.listWallets =
|
_myWalletProvider.listWallets =
|
||||||
_myWalletProvider.getAllWalletsNames(
|
_myWalletProvider
|
||||||
_currentChest);
|
.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,6 @@ class GenerateWalletsScreen extends StatelessWidget {
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
_generateWalletProvider.generateMnemonic();
|
_generateWalletProvider.generateMnemonic();
|
||||||
|
|
||||||
// _generateWalletProvider.makeError();
|
|
||||||
print('IS GENERATED ? : ' +
|
|
||||||
_generateWalletProvider.walletIsGenerated.toString());
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
|
|
|
@ -48,7 +48,6 @@ class ImportWalletScreen extends StatelessWidget {
|
||||||
_debounce.cancel();
|
_debounce.cancel();
|
||||||
_debounce =
|
_debounce =
|
||||||
Timer(const Duration(milliseconds: 200), () {
|
Timer(const Duration(milliseconds: 200), () {
|
||||||
print("ID Cesium tappé: $text");
|
|
||||||
_generateWalletProvider
|
_generateWalletProvider
|
||||||
.generateCesiumWalletPubkey(text,
|
.generateCesiumWalletPubkey(text,
|
||||||
_generateWalletProvider.cesiumPWD.text)
|
_generateWalletProvider.cesiumPWD.text)
|
||||||
|
@ -86,7 +85,6 @@ class ImportWalletScreen extends StatelessWidget {
|
||||||
_debounce.cancel();
|
_debounce.cancel();
|
||||||
_debounce =
|
_debounce =
|
||||||
Timer(const Duration(milliseconds: 200), () {
|
Timer(const Duration(milliseconds: 200), () {
|
||||||
print("ID Cesium tappé: $text");
|
|
||||||
_generateWalletProvider
|
_generateWalletProvider
|
||||||
.generateCesiumWalletPubkey(
|
.generateCesiumWalletPubkey(
|
||||||
_generateWalletProvider.cesiumID.text,
|
_generateWalletProvider.cesiumID.text,
|
||||||
|
|
|
@ -2,26 +2,21 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/models/history.dart';
|
||||||
|
import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
import 'package:gecko/screens/commonElements.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/myWallets/walletOptions.dart';
|
|
||||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
// import 'package:gecko/models/home.dart';
|
import 'package:gecko/globals.dart';
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class UnlockingWallet extends StatelessWidget {
|
class UnlockingWallet extends StatelessWidget {
|
||||||
UnlockingWallet(
|
UnlockingWallet(
|
||||||
{Key keyUnlockWallet,
|
{Key keyUnlockWallet, @required this.wallet, @required this.action})
|
||||||
@required this.walletNbr,
|
|
||||||
@required this.walletName,
|
|
||||||
@required this.derivation})
|
|
||||||
: super(key: keyUnlockWallet);
|
: super(key: keyUnlockWallet);
|
||||||
int walletNbr;
|
WalletData wallet;
|
||||||
String walletName;
|
String action;
|
||||||
int derivation;
|
|
||||||
|
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType> errorController;
|
StreamController<ErrorAnimationType> errorController;
|
||||||
|
@ -29,6 +24,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
var pinColor = Color(0xffF9F9F1);
|
var pinColor = Color(0xffF9F9F1);
|
||||||
var walletPin = '';
|
var walletPin = '';
|
||||||
|
String resultPay;
|
||||||
|
|
||||||
Future<NewWallet> get badWallet => null;
|
Future<NewWallet> get badWallet => null;
|
||||||
|
|
||||||
|
@ -37,7 +33,9 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
final int _pinLenght = _walletOptions.getPinLenght(this.walletNbr);
|
|
||||||
|
log.d("defaultWallet: " + defaultWallet.toString());
|
||||||
|
final int _pinLenght = _walletOptions.getPinLenght(wallet.number);
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -57,7 +55,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400),
|
||||||
),
|
),
|
||||||
SizedBox(height: 50),
|
SizedBox(height: 50),
|
||||||
pinForm(context, _pinLenght, walletNbr, derivation),
|
pinForm(context, _pinLenght, wallet.number, wallet.derivation),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
@ -80,6 +78,9 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
TextEditingController _enterPin = TextEditingController();
|
TextEditingController _enterPin = TextEditingController();
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
|
MyWalletsProvider _myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
|
||||||
return Form(
|
return Form(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
|
@ -128,12 +129,13 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (_pin) async {
|
||||||
print("Completed");
|
log.d("Completed");
|
||||||
|
_myWalletProvider.pinCode = _pin;
|
||||||
final resultWallet = await _walletOptions.readLocalWallet(
|
final resultWallet = await _walletOptions.readLocalWallet(
|
||||||
this.walletNbr,
|
context, this.wallet, _pin.toUpperCase(), _pinLenght);
|
||||||
_pin.toUpperCase(),
|
// _myWalletProvider.pinCode = _pin.toUpperCase();
|
||||||
_pinLenght,
|
_myWalletProvider.pinLenght = _pinLenght;
|
||||||
this.derivation);
|
|
||||||
if (resultWallet == 'bad') {
|
if (resultWallet == 'bad') {
|
||||||
errorController.add(ErrorAnimationType
|
errorController.add(ErrorAnimationType
|
||||||
.shake); // Triggering error shake animation
|
.shake); // Triggering error shake animation
|
||||||
|
@ -143,22 +145,48 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
} else {
|
} else {
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
// await Future.delayed(Duration(milliseconds: 50));
|
// await Future.delayed(Duration(milliseconds: 50));
|
||||||
Navigator.push(
|
if (action == "mywallets") {
|
||||||
formKey.currentContext,
|
Navigator.pushNamed(formKey.currentContext, '/mywallets');
|
||||||
SmoothTransition(
|
} else if (action == "pay") {
|
||||||
page: WalletOptions(
|
print("Go payments");
|
||||||
walletNbr: walletNbr,
|
resultPay =
|
||||||
walletName: walletName,
|
await _historyProvider.pay(context, _pin.toUpperCase());
|
||||||
derivation: derivation)));
|
await _paymentsResult(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (pinColor != Color(0xFFA4B600)) {
|
if (pinColor != Color(0xFFA4B600)) {
|
||||||
pinColor = Color(0xFFA4B600);
|
pinColor = Color(0xFFA4B600);
|
||||||
}
|
}
|
||||||
print(value);
|
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> _paymentsResult(context) {
|
||||||
|
return showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true, // user must tap button!
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(resultPay == "Success"
|
||||||
|
? 'Paiement effecuté avec succès !'
|
||||||
|
: "Une erreur s'est produite lors du paiement"),
|
||||||
|
content: SingleChildScrollView(child: Text('')),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text("OK"),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.popUntil(
|
||||||
|
context,
|
||||||
|
ModalRoute.withName('/'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,166 +0,0 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:gecko/models/myWallets.dart';
|
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
|
||||||
import 'dart:async';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
|
||||||
class WalletOptionsOld extends StatelessWidget with ChangeNotifier {
|
|
||||||
WalletOptionsOld(
|
|
||||||
{Key keyMyWallets,
|
|
||||||
@required this.walletNbr,
|
|
||||||
@required this.walletName,
|
|
||||||
@required this.derivation})
|
|
||||||
: super(key: keyMyWallets);
|
|
||||||
int walletNbr;
|
|
||||||
String walletName;
|
|
||||||
int derivation;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
|
||||||
print("Build walletOptions");
|
|
||||||
WalletOptionsProvider _walletOptions =
|
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
|
||||||
MyWalletsProvider _myWalletProvider =
|
|
||||||
Provider.of<MyWalletsProvider>(context);
|
|
||||||
|
|
||||||
// _walletOptions.isWalletUnlock = false;
|
|
||||||
print("Is unlock ? ${_walletOptions.isWalletUnlock}");
|
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
|
||||||
|
|
||||||
return WillPopScope(
|
|
||||||
onWillPop: () {
|
|
||||||
_walletOptions.isWalletUnlock = false;
|
|
||||||
Navigator.popUntil(
|
|
||||||
context,
|
|
||||||
ModalRoute.withName('/mywallets'),
|
|
||||||
);
|
|
||||||
return Future<bool>.value(true);
|
|
||||||
},
|
|
||||||
child: Scaffold(
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
appBar: AppBar(
|
|
||||||
leading: IconButton(
|
|
||||||
icon: Icon(Icons.arrow_back, color: Colors.black),
|
|
||||||
onPressed: () {
|
|
||||||
_walletOptions.isWalletUnlock = false;
|
|
||||||
Navigator.popUntil(
|
|
||||||
context,
|
|
||||||
ModalRoute.withName('/mywallets'),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
title: SizedBox(
|
|
||||||
height: 22,
|
|
||||||
child: Text(walletName),
|
|
||||||
)),
|
|
||||||
body: Builder(
|
|
||||||
builder: (ctx) => SafeArea(
|
|
||||||
child: Column(children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: Column(children: <Widget>[
|
|
||||||
SizedBox(height: 15),
|
|
||||||
Text(
|
|
||||||
'Clé publique:',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15.0,
|
|
||||||
color: Colors.grey[600],
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
),
|
|
||||||
SizedBox(height: 15),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(
|
|
||||||
text: _walletOptions.pubkey.text));
|
|
||||||
_walletOptions.snackCopyKey(ctx);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
_walletOptions.pubkey.text,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontFamily: 'Monospace'),
|
|
||||||
)),
|
|
||||||
Expanded(
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.bottomCenter,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
width: 300,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
elevation: 5,
|
|
||||||
primary: Color(
|
|
||||||
0xffFFD68E), //Color(0xffFFD68E), // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
|
||||||
onPressed: () => _walletOptions
|
|
||||||
.renameWalletAlerte(
|
|
||||||
context,
|
|
||||||
walletName,
|
|
||||||
walletNbr,
|
|
||||||
derivation)
|
|
||||||
.then((_result) {
|
|
||||||
if (_result == true) {
|
|
||||||
WidgetsBinding.instance
|
|
||||||
.addPostFrameCallback((_) {
|
|
||||||
_myWalletProvider
|
|
||||||
.listWallets =
|
|
||||||
_myWalletProvider
|
|
||||||
.getAllWalletsNames(
|
|
||||||
_currentChest);
|
|
||||||
_myWalletProvider
|
|
||||||
.rebuildWidget();
|
|
||||||
});
|
|
||||||
Navigator.popUntil(
|
|
||||||
context,
|
|
||||||
ModalRoute.withName(
|
|
||||||
'/mywallets'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
child: Text('Renommer ce portefeuille',
|
|
||||||
style: TextStyle(fontSize: 20)))))),
|
|
||||||
SizedBox(height: 30),
|
|
||||||
SizedBox(
|
|
||||||
height: 50,
|
|
||||||
width: 300,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
elevation: 6,
|
|
||||||
primary: Colors
|
|
||||||
.redAccent, //Color(0xffFFD68E), // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
await _walletOptions.deleteWallet(context,
|
|
||||||
walletNbr, walletName, derivation);
|
|
||||||
WidgetsBinding.instance
|
|
||||||
.addPostFrameCallback((_) {
|
|
||||||
_myWalletProvider.listWallets =
|
|
||||||
_myWalletProvider
|
|
||||||
.getAllWalletsNames(_currentChest);
|
|
||||||
_myWalletProvider.rebuildWidget();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text('Supprimer ce portefeuille',
|
|
||||||
style: TextStyle(fontSize: 20)))),
|
|
||||||
SizedBox(height: 50),
|
|
||||||
Text(
|
|
||||||
'Portefeuille déverrouillé',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.green,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 15),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10)
|
|
||||||
])),
|
|
||||||
]),
|
|
||||||
)),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,28 +7,20 @@ import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:gecko/models/queries.dart';
|
import 'package:gecko/models/queries.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'dart:async';
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class WalletOptions extends StatelessWidget {
|
class WalletOptions extends StatelessWidget {
|
||||||
WalletOptions(
|
WalletOptions({Key keyMyWallets, @required this.wallet})
|
||||||
{Key keyMyWallets,
|
|
||||||
@required this.walletNbr,
|
|
||||||
@required this.walletName,
|
|
||||||
@required this.derivation})
|
|
||||||
: super(key: keyMyWallets);
|
: super(key: keyMyWallets);
|
||||||
int walletNbr;
|
WalletData wallet;
|
||||||
String walletName;
|
|
||||||
int derivation;
|
|
||||||
int _nbrLinesName = 1;
|
int _nbrLinesName = 1;
|
||||||
bool _isNewNameValid = false;
|
bool _isNewNameValid = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
print("Build walletOptions");
|
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
|
@ -41,9 +33,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
if (_walletOptions.nameController.text == null ||
|
if (_walletOptions.nameController.text == null ||
|
||||||
_isNewNameValid == false) {
|
_isNewNameValid == false) {
|
||||||
_walletOptions.nameController.text = walletName;
|
_walletOptions.nameController.text = wallet.name;
|
||||||
} else {
|
} else {
|
||||||
walletName = _walletOptions.nameController.text;
|
wallet.name = _walletOptions.nameController.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
_walletOptions.nameController.text.length >= 15
|
_walletOptions.nameController.text.length >= 15
|
||||||
|
@ -52,28 +44,28 @@ class WalletOptions extends StatelessWidget {
|
||||||
if (_walletOptions.nameController.text.length >= 26 && isTall)
|
if (_walletOptions.nameController.text.length >= 26 && isTall)
|
||||||
_nbrLinesName = 3;
|
_nbrLinesName = 3;
|
||||||
|
|
||||||
_walletOptions.walletID = '0:$walletNbr';
|
_walletOptions.walletID = '0:${wallet.number}';
|
||||||
|
|
||||||
_myWalletProvider.getDefaultWallet();
|
_myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
defaultWallet == _walletOptions.walletID
|
_walletOptions.isDefaultWallet =
|
||||||
? _walletOptions.isDefaultWallet = true
|
(defaultWallet.id() == _walletOptions.walletID);
|
||||||
: _walletOptions.isDefaultWallet = false;
|
|
||||||
|
|
||||||
// print(_walletOptions.generateQRcode(_walletOptions.pubkey.text));
|
int currentChest = _myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
log.d("Wallet options: $currentChest:${wallet.number}");
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_walletOptions.isEditing = false;
|
_walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = true;
|
_walletOptions.isBalanceBlur = true;
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/mywallets'),
|
||||||
);
|
);
|
||||||
Navigator.pushNamed(context, '/mywallets');
|
return Future<bool>.value(true);
|
||||||
return Future<bool>.value(true);
|
},
|
||||||
},
|
child: Scaffold(
|
||||||
child: Scaffold(
|
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
|
@ -83,9 +75,8 @@ class WalletOptions extends StatelessWidget {
|
||||||
_walletOptions.isBalanceBlur = true;
|
_walletOptions.isBalanceBlur = true;
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/mywallets'),
|
||||||
);
|
);
|
||||||
Navigator.pushNamed(context, '/mywallets');
|
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
|
@ -113,7 +104,6 @@ class WalletOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.changeAvatar();
|
await _walletOptions.changeAvatar();
|
||||||
print('CHANGE AVATAR');
|
|
||||||
},
|
},
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/chopp-gecko2.png',
|
'assets/chopp-gecko2.png',
|
||||||
|
@ -121,7 +111,6 @@ class WalletOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.changeAvatar();
|
await _walletOptions.changeAvatar();
|
||||||
print('CHANGE AVATAR');
|
|
||||||
},
|
},
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
|
@ -129,14 +118,12 @@ class WalletOptions extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 100)
|
SizedBox(height: 100)
|
||||||
])),
|
])),
|
||||||
// SizedBox(width: 20),
|
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 260,
|
width: 260,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
// autofocus: true,
|
|
||||||
focusNode: _walletOptions.walletNameFocus,
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
enabled: _walletOptions.isEditing,
|
enabled: _walletOptions.isEditing,
|
||||||
controller: _walletOptions.nameController,
|
controller: _walletOptions.nameController,
|
||||||
|
@ -174,8 +161,6 @@ class WalletOptions extends StatelessWidget {
|
||||||
return Text('Loading');
|
return Text('Loading');
|
||||||
}
|
}
|
||||||
|
|
||||||
print(result);
|
|
||||||
|
|
||||||
// List repositories = result.data['viewer']['repositories']['nodes'];
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
String wBalanceUD;
|
String wBalanceUD;
|
||||||
if (result.data['balance'] == null) {
|
if (result.data['balance'] == null) {
|
||||||
|
@ -252,7 +237,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
// .addPostFrameCallback((_) {
|
// .addPostFrameCallback((_) {
|
||||||
// _myWalletProvider.listWallets =
|
// _myWalletProvider.listWallets =
|
||||||
// _myWalletProvider
|
// _myWalletProvider
|
||||||
// .getAllWalletsNames(
|
// .readAllWallets(
|
||||||
// _currentChest);
|
// _currentChest);
|
||||||
// _myWalletProvider.rebuildWidget();
|
// _myWalletProvider.rebuildWidget();
|
||||||
// });
|
// });
|
||||||
|
@ -369,10 +354,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: !_walletOptions.isDefaultWallet
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
? () {
|
? () {
|
||||||
defaultWallet = '0:$walletNbr';
|
defaultWallet = wallet;
|
||||||
_walletOptions
|
_walletOptions.defAsDefaultWallet(wallet.id());
|
||||||
.defAsDefaultWallet(_walletOptions.walletID);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.getAllWalletsNames(_currentChest);
|
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -399,11 +383,10 @@ class WalletOptions extends StatelessWidget {
|
||||||
SizedBox(height: 17 * ratio),
|
SizedBox(height: 17 * ratio),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _walletOptions.deleteWallet(
|
await _walletOptions.deleteWallet(context, wallet);
|
||||||
context, walletNbr, walletName, derivation);
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_myWalletProvider.listWallets =
|
_myWalletProvider.listWallets =
|
||||||
_myWalletProvider.getAllWalletsNames(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -419,7 +402,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
])),
|
])),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@ import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:gecko/models/walletOptions.dart';
|
import 'package:gecko/models/walletOptions.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/myWallets/unlockingWallet.dart';
|
import 'package:gecko/screens/commonElements.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/walletOptions.dart';
|
||||||
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
import 'package:gecko/screens/onBoarding/0_noKeychainFound.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -24,52 +25,69 @@ class WalletsHome extends StatelessWidget {
|
||||||
final int _currentChest = myWalletProvider.getCurrentChest();
|
final int _currentChest = myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
myWalletProvider.listWallets =
|
myWalletProvider.listWallets =
|
||||||
myWalletProvider.getAllWalletsNames(_currentChest);
|
myWalletProvider.readAllWallets(_currentChest);
|
||||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
if (myWalletProvider.listWallets != '') {
|
if (myWalletProvider.listWallets.isEmpty) {
|
||||||
firstWalletDerivation =
|
firstWalletDerivation = myWalletProvider.listWallets[0].derivation;
|
||||||
int.parse(myWalletProvider.listWallets.split('\n')[0].split(':')[3]);
|
|
||||||
|
|
||||||
myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
appBar: AppBar(
|
onWillPop: () {
|
||||||
title: Text('Mes portefeuilles',
|
Navigator.popUntil(
|
||||||
style: TextStyle(color: Colors.grey[850])),
|
context,
|
||||||
backgroundColor: Color(0xffFFD58D),
|
ModalRoute.withName('/'),
|
||||||
),
|
);
|
||||||
floatingActionButton: Visibility(
|
return Future<bool>.value(true);
|
||||||
visible: (isWalletsExists && firstWalletDerivation != -1),
|
},
|
||||||
child: Container(
|
child: Scaffold(
|
||||||
height: 80.0,
|
appBar: AppBar(
|
||||||
width: 80.0,
|
leading: IconButton(
|
||||||
child: FittedBox(
|
icon: Icon(Icons.arrow_back, color: Colors.black),
|
||||||
child: FloatingActionButton(
|
onPressed: () {
|
||||||
heroTag: "buttonGenerateWallet",
|
Navigator.popUntil(
|
||||||
onPressed: () {
|
context,
|
||||||
showDialog(
|
ModalRoute.withName('/'),
|
||||||
context: context,
|
);
|
||||||
builder: (BuildContext context) {
|
}),
|
||||||
return addNewDerivation(context, 1);
|
title: Text('Mes portefeuilles',
|
||||||
});
|
style: TextStyle(color: Colors.grey[850])),
|
||||||
},
|
backgroundColor: Color(0xffFFD58D),
|
||||||
child: Container(
|
),
|
||||||
height: 40,
|
floatingActionButton: Visibility(
|
||||||
width: 40,
|
visible: (isWalletsExists && firstWalletDerivation != -1),
|
||||||
child: Icon(Icons.person_add_alt_1_rounded,
|
child: Container(
|
||||||
color: Colors.grey[850])),
|
height: 80.0,
|
||||||
backgroundColor: Color(0xffEFEFBF))))),
|
width: 80.0,
|
||||||
body: SafeArea(
|
child: FittedBox(
|
||||||
child: !isWalletsExists
|
child: FloatingActionButton(
|
||||||
? NoKeyChainScreen()
|
heroTag: "buttonGenerateWallet",
|
||||||
: myWalletsTiles(context)));
|
onPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return addNewDerivation(context, 1);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
child: Icon(Icons.person_add_alt_1_rounded,
|
||||||
|
color: Colors.grey[850])),
|
||||||
|
backgroundColor: Color(0xffEFEFBF))))),
|
||||||
|
body: SafeArea(
|
||||||
|
child: !isWalletsExists
|
||||||
|
? NoKeyChainScreen()
|
||||||
|
: myWalletsTiles(context))));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget myWalletsTiles(BuildContext context) {
|
Widget myWalletsTiles(BuildContext context) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider _myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
WalletOptionsProvider _walletOptions =
|
||||||
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
|
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
|
@ -77,7 +95,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
return Text('');
|
return Text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_myWalletProvider.listWallets == '') {
|
if (_myWalletProvider.listWallets.isEmpty) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Center(
|
Center(
|
||||||
|
@ -88,11 +106,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets.split('\n');
|
List _listWallets = _myWalletProvider.listWallets;
|
||||||
// final int nbrOfWallets = _listWallets.length;
|
|
||||||
// print(_listWallets);
|
|
||||||
// print("${_listWallets[0].split(':')[0]}:${_listWallets[0].split(':')[2]}");
|
|
||||||
// print(defaultWallet);
|
|
||||||
|
|
||||||
return GridView.count(
|
return GridView.count(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
|
@ -100,18 +114,27 @@ class WalletsHome extends StatelessWidget {
|
||||||
crossAxisSpacing: 0,
|
crossAxisSpacing: 0,
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (String _repository in _listWallets)
|
for (WalletData _repository in _listWallets)
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(16),
|
padding: EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () async {
|
||||||
Navigator.push(context,
|
await _walletOptions.readLocalWallet(
|
||||||
MaterialPageRoute(builder: (context) {
|
context,
|
||||||
return UnlockingWallet(
|
_repository,
|
||||||
walletNbr: int.parse(_repository.split(':')[1]),
|
_myWalletProvider.pinCode,
|
||||||
walletName: _repository.split(':')[2],
|
_myWalletProvider.pinLenght);
|
||||||
derivation: int.parse(_repository.split(':')[3]));
|
Navigator.push(
|
||||||
}));
|
context,
|
||||||
|
SmoothTransition(
|
||||||
|
page: WalletOptions(
|
||||||
|
wallet: _repository,
|
||||||
|
)));
|
||||||
|
|
||||||
|
// Navigator.push(context,
|
||||||
|
// MaterialPageRoute(builder: (context) {
|
||||||
|
// return UnlockingWallet(wallet: _repository);
|
||||||
|
// }));
|
||||||
},
|
},
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
|
@ -137,11 +160,9 @@ class WalletsHome extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
ListTile(
|
ListTile(
|
||||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||||
tileColor:
|
tileColor: _repository.id() == defaultWallet.id()
|
||||||
"${_repository.split(':')[0]}:${_repository.split(':')[1]}" ==
|
? Color(0xffD28928)
|
||||||
defaultWallet
|
: Color(0xffFFD58D),
|
||||||
? Color(0xffD28928)
|
|
||||||
: Color(0xffFFD58D),
|
|
||||||
// leading: Text('IMAGE'),
|
// leading: Text('IMAGE'),
|
||||||
|
|
||||||
// subtitle: Text(_repository.split(':')[3],
|
// subtitle: Text(_repository.split(':')[3],
|
||||||
|
@ -150,26 +171,22 @@ class WalletsHome extends StatelessWidget {
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.symmetric(horizontal: 5),
|
EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: Text(_repository.split(':')[2],
|
child: Text(_repository.name,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.0,
|
fontSize: 16.0,
|
||||||
color:
|
color: _repository.id() ==
|
||||||
"${_repository.split(':')[0]}:${_repository.split(':')[1]}" ==
|
defaultWallet.id()
|
||||||
defaultWallet
|
? Color(0xffF9F9F1)
|
||||||
? Color(0xffF9F9F1)
|
: Colors.black)))),
|
||||||
: Colors.black)))),
|
|
||||||
// dense: true,
|
// dense: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context,
|
Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) {
|
context,
|
||||||
return UnlockingWallet(
|
SmoothTransition(
|
||||||
walletNbr:
|
page: WalletOptions(
|
||||||
int.parse(_repository.split(':')[1]),
|
wallet: _repository,
|
||||||
walletName: _repository.split(':')[2],
|
)));
|
||||||
derivation:
|
|
||||||
int.parse(_repository.split(':')[3]));
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]))))
|
]))))
|
||||||
|
|
|
@ -110,17 +110,13 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (_pin) async {
|
||||||
print("Completed");
|
|
||||||
// final resultWallet = await _walletOptions.readLocalWallet(
|
|
||||||
// _walletNbr, _pin.toUpperCase(), _pinLenght, _derivation);
|
|
||||||
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) {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
print(generatedWallet.pin);
|
|
||||||
await _generateWalletProvider.storeHDWChest(
|
await _generateWalletProvider.storeHDWChest(
|
||||||
generatedWallet, 'Mon portefeuille courant', context);
|
generatedWallet, 'Mon portefeuille courant', context);
|
||||||
_myWalletProvider.getAllWalletsNames(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_walletOptions.reloadBuild();
|
_walletOptions.reloadBuild();
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -140,7 +136,6 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
if (pinColor != Color(0xFFA4B600)) {
|
if (pinColor != Color(0xFFA4B600)) {
|
||||||
pinColor = Color(0xFFA4B600);
|
pinColor = Color(0xFFA4B600);
|
||||||
}
|
}
|
||||||
print(value);
|
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:gecko/screens/myWallets/generateWallets.dart';
|
import 'package:gecko/screens/myWallets/generateWallets.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:gecko/screens/myWallets/importWallet.dart';
|
import 'package:gecko/screens/myWallets/importWallet.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
|
@ -85,7 +86,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async => {
|
onPressed: () async => {
|
||||||
print('Suppression de tous les wallets'),
|
log.i('Suppression de tous les wallets'),
|
||||||
await _myWallets.deleteAllWallet(context)
|
await _myWallets.deleteAllWallet(context)
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
|
@ -344,7 +344,7 @@ packages:
|
||||||
name: logger
|
name: logger
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.4"
|
version: "1.0.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -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.1+22
|
version: 0.0.1+23
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -37,7 +37,7 @@ dependencies:
|
||||||
sync_http: ^0.2.0
|
sync_http: ^0.2.0
|
||||||
crypto: ^3.0.0
|
crypto: ^3.0.0
|
||||||
fast_base58:
|
fast_base58:
|
||||||
logger: ^0.9.4
|
logger: ^1.0.0
|
||||||
flutter_logs: ^2.1.3
|
flutter_logs: ^2.1.3
|
||||||
sentry: ^4.0.4
|
sentry: ^4.0.4
|
||||||
sentry_flutter: ^4.0.4
|
sentry_flutter: ^4.0.4
|
||||||
|
|
Loading…
Reference in New Issue