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';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
// void main() => runApp(Gecko());
|
// void main() => runApp(Gecko());
|
||||||
|
final bool enableSentry = true;
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
if (kReleaseMode) {
|
if (kReleaseMode && enableSentry) {
|
||||||
await SentryFlutter.init(
|
await SentryFlutter.init(
|
||||||
(options) {
|
(options) {
|
||||||
options.dsn =
|
options.dsn =
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'package:gecko/ui/myWallets.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
|
||||||
import 'package:sentry/sentry.dart' as sentry;
|
import 'package:sentry/sentry.dart' as sentry;
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
@ -16,6 +15,7 @@ class GenerateWalletScreen extends StatefulWidget {
|
||||||
|
|
||||||
class GenerateWalletState extends State<GenerateWalletScreen> {
|
class GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
GlobalKey<MyWalletState> _keyWallets = GlobalKey();
|
GlobalKey<MyWalletState> _keyWallets = GlobalKey();
|
||||||
|
GlobalKey<ValidStoreWalletState> _keyValidWallets = GlobalKey();
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
DubpRust.setup();
|
DubpRust.setup();
|
||||||
|
@ -174,19 +174,25 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return ValidStoreWalletScreen(
|
return ValidStoreWalletScreen(
|
||||||
|
validationKey: _keyValidWallets,
|
||||||
generatedMnemonic: this.generatedMnemonic,
|
generatedMnemonic: this.generatedMnemonic,
|
||||||
generatedWallet: this.actualWallet);
|
generatedWallet: this.actualWallet);
|
||||||
}),
|
}),
|
||||||
).then((value) => setState(() {
|
).then((value) => setState(() {
|
||||||
print(
|
if (value != null) {
|
||||||
'TODO: Fix error null boolean ?'); //TODO: Fix error null boolean
|
print(
|
||||||
if (value) {
|
'TODO: Fix resetWalletState()'); //TODO: Fix resetWalletState()
|
||||||
_pin.clear();
|
_pin.clear();
|
||||||
_mnemonicController.clear();
|
_mnemonicController.clear();
|
||||||
_pubkey.clear();
|
_pubkey.clear();
|
||||||
this.generatedMnemonic = null;
|
this.generatedMnemonic = null;
|
||||||
this.actualWallet = null;
|
this.actualWallet = null;
|
||||||
this.walletIsGenerated = false;
|
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 {
|
Future generateMnemonic() async {
|
||||||
try {
|
try {
|
||||||
this.generatedMnemonic =
|
this.generatedMnemonic =
|
||||||
|
@ -259,10 +276,10 @@ class GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
|
|
||||||
// deleteWallet();
|
// deleteWallet();
|
||||||
print(_walletFile.path);
|
print(_walletFile.path);
|
||||||
final isExist = await File(_walletFile.path).exists();
|
final bool isExist = await File(_walletFile.path).exists();
|
||||||
print('Wallet existe ? : ' + isExist.toString());
|
print('Wallet existe ? : ' + isExist.toString());
|
||||||
print('Is wallet generated ? : ' + walletIsGenerated.toString());
|
print('Is wallet generated ? : ' + walletIsGenerated.toString());
|
||||||
if (isExist == true) {
|
if (isExist) {
|
||||||
print('Un wallet existe !');
|
print('Un wallet existe !');
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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 importWallet() async {}
|
||||||
|
|
||||||
Future<String> get _localPath async {
|
Future<String> get _localPath async {
|
||||||
|
@ -291,10 +330,11 @@ class ValidStoreWalletScreen extends StatefulWidget {
|
||||||
: super(key: validationKey);
|
: super(key: validationKey);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ValidStoreWalletScreen createState() => _ValidStoreWalletScreen();
|
ValidStoreWalletState createState() => ValidStoreWalletState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ValidStoreWalletScreen extends State<ValidStoreWalletScreen> {
|
class ValidStoreWalletState extends State<ValidStoreWalletScreen> {
|
||||||
|
GlobalKey<ValidStoreWalletState> _keyValidWallets = GlobalKey();
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
// DubpRust.setup();
|
// DubpRust.setup();
|
||||||
|
|
|
@ -235,7 +235,7 @@ class MyWalletState extends State<MyWalletsScreen> {
|
||||||
Future readLocalWallet(String _pin) async {
|
Future readLocalWallet(String _pin) async {
|
||||||
// print(pin);
|
// print(pin);
|
||||||
try {
|
try {
|
||||||
final file = await _localWallet;
|
final file = await _localWallet('tata');
|
||||||
String _localDewif = await file.readAsString();
|
String _localDewif = await file.readAsString();
|
||||||
String _localPubkey;
|
String _localPubkey;
|
||||||
|
|
||||||
|
@ -275,8 +275,8 @@ class MyWalletState extends State<MyWalletsScreen> {
|
||||||
return directory.path;
|
return directory.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> get _localWallet async {
|
Future<File> _localWallet(_name) async {
|
||||||
final path = await _localPath;
|
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
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0-nullsafety.1"
|
version: "2.5.0-nullsafety.3"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.1"
|
version: "2.1.0-nullsafety.3"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.3"
|
version: "1.1.0-nullsafety.5"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: charcode
|
name: charcode
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.1"
|
version: "1.2.0-nullsafety.3"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.1"
|
version: "1.1.0-nullsafety.3"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0-nullsafety.3"
|
version: "1.15.0-nullsafety.5"
|
||||||
connectivity:
|
connectivity:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -112,7 +112,7 @@ packages:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.1"
|
version: "1.2.0-nullsafety.3"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -282,20 +282,27 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.3"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.3-nullsafety.3"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10-nullsafety.1"
|
version: "0.12.10-nullsafety.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.3"
|
version: "1.3.0-nullsafety.6"
|
||||||
nested:
|
nested:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -323,7 +330,7 @@ packages:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0-nullsafety.1"
|
version: "1.8.0-nullsafety.3"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -461,42 +468,42 @@ packages:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0-nullsafety.2"
|
version: "1.8.0-nullsafety.4"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0-nullsafety.1"
|
version: "1.10.0-nullsafety.6"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.1"
|
version: "2.1.0-nullsafety.3"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.1"
|
version: "1.1.0-nullsafety.3"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.1"
|
version: "1.2.0-nullsafety.3"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.19-nullsafety.2"
|
version: "0.2.19-nullsafety.6"
|
||||||
truncate:
|
truncate:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -510,7 +517,7 @@ packages:
|
||||||
name: typed_data
|
name: typed_data
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.3"
|
version: "1.3.0-nullsafety.5"
|
||||||
uuid:
|
uuid:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -531,7 +538,7 @@ packages:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
version: "2.1.0-nullsafety.5"
|
||||||
websocket:
|
websocket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -568,5 +575,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
sdks:
|
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"
|
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.
|
# 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.0+8
|
version: 0.0.0+9
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
Loading…
Reference in New Issue