Fix unlock wallet path; Fix null boolean; WIP: Try differents way to update wallets list;
This commit is contained in:
parent
0e8b1cad44
commit
2b053226a7
|
@ -6,9 +6,10 @@ import 'package:sentry_flutter/sentry_flutter.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
// void main() => runApp(Gecko());
|
||||
final bool enableSentry = true;
|
||||
|
||||
Future<void> main() async {
|
||||
if (kReleaseMode) {
|
||||
if (kReleaseMode && enableSentry) {
|
||||
await SentryFlutter.init(
|
||||
(options) {
|
||||
options.dsn =
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:gecko/ui/myWallets.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dubp/dubp.dart';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:sentry/sentry.dart' as sentry;
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
@ -16,6 +15,7 @@ class GenerateWalletScreen extends StatefulWidget {
|
|||
|
||||
class GenerateWalletState extends State<GenerateWalletScreen> {
|
||||
GlobalKey<MyWalletState> _keyWallets = GlobalKey();
|
||||
GlobalKey<ValidStoreWalletState> _keyValidWallets = GlobalKey();
|
||||
void initState() {
|
||||
super.initState();
|
||||
DubpRust.setup();
|
||||
|
@ -174,19 +174,25 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
|||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ValidStoreWalletScreen(
|
||||
validationKey: _keyValidWallets,
|
||||
generatedMnemonic: this.generatedMnemonic,
|
||||
generatedWallet: this.actualWallet);
|
||||
}),
|
||||
).then((value) => setState(() {
|
||||
print(
|
||||
'TODO: Fix error null boolean ?'); //TODO: Fix error null boolean
|
||||
if (value) {
|
||||
if (value != null) {
|
||||
print(
|
||||
'TODO: Fix resetWalletState()'); //TODO: Fix resetWalletState()
|
||||
_pin.clear();
|
||||
_mnemonicController.clear();
|
||||
_pubkey.clear();
|
||||
this.generatedMnemonic = null;
|
||||
this.actualWallet = null;
|
||||
this.walletIsGenerated = false;
|
||||
resetWalletState();
|
||||
// setState(() {});
|
||||
// getAllWalletsNames();
|
||||
// checkIfWalletExist('tata');
|
||||
// _keyWallets.currentState.getAllWalletsNames();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -209,6 +215,17 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
|||
])));
|
||||
}
|
||||
|
||||
Future resetWalletState() async {
|
||||
final bool _isExist = await checkIfWalletExist('tata');
|
||||
print('The wallet exist in resetWalletState(): ' + _isExist.toString());
|
||||
// initState();
|
||||
// _keyWallets.currentState.setState(() {});
|
||||
setState(() {
|
||||
// getAllWalletsNames();
|
||||
// this.walletIsGenerated = true;
|
||||
});
|
||||
}
|
||||
|
||||
Future generateMnemonic() async {
|
||||
try {
|
||||
this.generatedMnemonic =
|
||||
|
@ -259,10 +276,10 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
|||
|
||||
// deleteWallet();
|
||||
print(_walletFile.path);
|
||||
final isExist = await File(_walletFile.path).exists();
|
||||
final bool isExist = await File(_walletFile.path).exists();
|
||||
print('Wallet existe ? : ' + isExist.toString());
|
||||
print('Is wallet generated ? : ' + walletIsGenerated.toString());
|
||||
if (isExist == true) {
|
||||
if (isExist) {
|
||||
print('Un wallet existe !');
|
||||
return true;
|
||||
} else {
|
||||
|
@ -270,6 +287,28 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<List> getAllWalletsNames() async {
|
||||
print('Je suis getAllWalletsNames() !!');
|
||||
final _appPath = await getApplicationDocumentsDirectory();
|
||||
// List _listWallets = [];
|
||||
// _listWallets.add('tortuuue');
|
||||
_keyValidWallets.currentState._listWallets
|
||||
.clear(); //TODO: Fix: The getter '_listWallets' was called on null.
|
||||
print(_appPath);
|
||||
print('Je suis getAllWalletsNames() !! 2');
|
||||
|
||||
_appPath
|
||||
.list(recursive: false, followLinks: false)
|
||||
.listen((FileSystemEntity entity) {
|
||||
print(entity.path.split('/').last);
|
||||
_keyValidWallets.currentState._listWallets
|
||||
.add(entity.path.split('/').last);
|
||||
});
|
||||
|
||||
return _keyValidWallets.currentState._listWallets;
|
||||
// final _local = await _appPath.path.list().toList();
|
||||
}
|
||||
|
||||
Future importWallet() async {}
|
||||
|
||||
Future<String> get _localPath async {
|
||||
|
@ -291,10 +330,11 @@ class ValidStoreWalletScreen extends StatefulWidget {
|
|||
: super(key: validationKey);
|
||||
|
||||
@override
|
||||
_ValidStoreWalletScreen createState() => _ValidStoreWalletScreen();
|
||||
ValidStoreWalletState createState() => ValidStoreWalletState();
|
||||
}
|
||||
|
||||
class _ValidStoreWalletScreen extends State<ValidStoreWalletScreen> {
|
||||
class ValidStoreWalletState extends State<ValidStoreWalletScreen> {
|
||||
GlobalKey<ValidStoreWalletState> _keyValidWallets = GlobalKey();
|
||||
void initState() {
|
||||
super.initState();
|
||||
// DubpRust.setup();
|
||||
|
|
|
@ -235,7 +235,7 @@ class MyWalletState extends State<MyWalletsScreen> {
|
|||
Future readLocalWallet(String _pin) async {
|
||||
// print(pin);
|
||||
try {
|
||||
final file = await _localWallet;
|
||||
final file = await _localWallet('tata');
|
||||
String _localDewif = await file.readAsString();
|
||||
String _localPubkey;
|
||||
|
||||
|
@ -275,8 +275,8 @@ class MyWalletState extends State<MyWalletsScreen> {
|
|||
return directory.path;
|
||||
}
|
||||
|
||||
Future<File> get _localWallet async {
|
||||
Future<File> _localWallet(_name) async {
|
||||
final path = await _localPath;
|
||||
return File('$path/wallet.dewif');
|
||||
return File('$path/wallets/$_name/wallet.dewif');
|
||||
}
|
||||
}
|
||||
|
|
45
pubspec.lock
45
pubspec.lock
|
@ -21,42 +21,42 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety.1"
|
||||
version: "2.5.0-nullsafety.3"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0-nullsafety.3"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.1.0-nullsafety.5"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0-nullsafety.3"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0-nullsafety.3"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.3"
|
||||
version: "1.15.0-nullsafety.5"
|
||||
connectivity:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -112,7 +112,7 @@ packages:
|
|||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0-nullsafety.3"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -282,20 +282,27 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3-nullsafety.3"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10-nullsafety.1"
|
||||
version: "0.12.10-nullsafety.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.3.0-nullsafety.6"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -323,7 +330,7 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.1"
|
||||
version: "1.8.0-nullsafety.3"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -461,42 +468,42 @@ packages:
|
|||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.2"
|
||||
version: "1.8.0-nullsafety.4"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.1"
|
||||
version: "1.10.0-nullsafety.6"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0-nullsafety.3"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0-nullsafety.3"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0-nullsafety.3"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety.2"
|
||||
version: "0.2.19-nullsafety.6"
|
||||
truncate:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -510,7 +517,7 @@ packages:
|
|||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.3.0-nullsafety.5"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -531,7 +538,7 @@ packages:
|
|||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version: "2.1.0-nullsafety.5"
|
||||
websocket:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -568,5 +575,5 @@ packages:
|
|||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.10.0-110 <2.11.0"
|
||||
dart: ">=2.12.0-0.0 <3.0.0"
|
||||
flutter: ">=1.22.0 <2.0.0"
|
||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
|||
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 0.0.0+8
|
||||
version: 0.0.0+9
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
|
Loading…
Reference in New Issue