Improve refresh rename wallet; Clean code; Clean logs; Improve build script
This commit is contained in:
parent
aa320a1587
commit
ba95a262e0
|
@ -64,23 +64,6 @@ class Gecko extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// FutureBuilder<dynamic>(
|
||||
// future: getAppPath(), // async work
|
||||
// builder: (BuildContext context, AsyncSnapshot snapshot) {
|
||||
// // switch (snapshot.connectionState) {
|
||||
// // case ConnectionState.waiting:
|
||||
// // return Text('Loading....');
|
||||
// // default:
|
||||
// // if (snapshot.hasError)
|
||||
// // return Text('Error: ${snapshot.error}');
|
||||
// // else
|
||||
// // return Text('Result: ${snapshot.data}');
|
||||
// // }
|
||||
|
||||
// print('FutureBuilder: ' + appPath.path);
|
||||
// return;
|
||||
// },
|
||||
// );
|
||||
final _httpLink = HttpLink(
|
||||
// 'http://192.168.1.91:10060/gva',
|
||||
randomEndpoint,
|
||||
|
@ -97,7 +80,6 @@ class Gecko extends StatelessWidget {
|
|||
return MultiProvider(
|
||||
providers: [
|
||||
// Provider(create: (context) => HistoryProvider()),
|
||||
// Provider(create: (context) => MyWalletsProvider()),
|
||||
ChangeNotifierProvider(create: (_) => HomeProvider()),
|
||||
ChangeNotifierProvider(create: (_) => HistoryProvider('')),
|
||||
ChangeNotifierProvider(create: (_) => MyWalletsProvider()),
|
||||
|
@ -116,7 +98,6 @@ class Gecko extends StatelessWidget {
|
|||
bodyText2: TextStyle(),
|
||||
).apply(
|
||||
bodyColor: Color(0xff855F2D),
|
||||
// displayColor: Colors.blue,
|
||||
),
|
||||
),
|
||||
home: HomeScreen(),
|
||||
|
|
|
@ -35,7 +35,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
|||
return 'Exist: DENY';
|
||||
}
|
||||
|
||||
walletNameDirectory.createSync();
|
||||
await walletNameDirectory.create();
|
||||
walletFile.writeAsString('${wallet.dewif}');
|
||||
|
||||
Navigator.pop(context, true);
|
||||
|
|
|
@ -15,26 +15,18 @@ class HomeProvider with ChangeNotifier {
|
|||
|
||||
set currentIndex(int index) {
|
||||
_currentIndex = index;
|
||||
print('current index setter: ' + index.toString());
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future getAppVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
String appName = packageInfo.appName;
|
||||
String version = packageInfo.version;
|
||||
String buildNumber = packageInfo.buildNumber;
|
||||
print(appName);
|
||||
|
||||
notifyListeners();
|
||||
return version + '+' + buildNumber;
|
||||
}
|
||||
|
||||
// void onTabTapped(int index) {
|
||||
// currentIndex = index;
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
Future<String> getRandomEndpoint() async {
|
||||
// TODO: Improve implemention of getRandomEndpoint()
|
||||
// final _json = json.decode(await getJsonEndpoints());
|
||||
|
@ -50,7 +42,6 @@ class HomeProvider with ChangeNotifier {
|
|||
final response = await http.post(_endpoint);
|
||||
if (response.statusCode != 400) {
|
||||
print('Endpoint statutcode: ' + response.statusCode.toString());
|
||||
// _endpoint = getRandomElement(_list);
|
||||
return 'HS';
|
||||
}
|
||||
|
||||
|
@ -60,7 +51,6 @@ class HomeProvider with ChangeNotifier {
|
|||
Future getAppPath() async {
|
||||
appPath = await getApplicationDocumentsDirectory();
|
||||
walletsDirectory = Directory('${appPath.path}/wallets');
|
||||
print('AAAAPPPATH: ' + appPath.path);
|
||||
}
|
||||
|
||||
T getRandomElement<T>(List<T> list) {
|
||||
|
|
|
@ -26,10 +26,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
print('No wallets detected');
|
||||
return false;
|
||||
} else {
|
||||
print('Some wallets have been detected:');
|
||||
for (var _wallets in contents) {
|
||||
print(_wallets);
|
||||
}
|
||||
print('Some wallets have been detected.');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +35,7 @@ class MyWalletsProvider with ChangeNotifier {
|
|||
|
||||
List getAllWalletsNames() {
|
||||
listWallets.clear();
|
||||
print('1');
|
||||
print(walletsDirectory.path);
|
||||
print('2');
|
||||
|
||||
walletsDirectory
|
||||
.listSync(recursive: false, followLinks: false)
|
||||
|
|
|
@ -51,6 +51,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
}
|
||||
|
||||
Future readLocalWallet(String _name, String _pin) async {
|
||||
isWalletUnlock = false;
|
||||
print('NOM: ' + _name);
|
||||
try {
|
||||
File _walletFile = File('${walletsDirectory.path}/$_name/wallet.dewif');
|
||||
|
@ -113,7 +114,8 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_renameWallet(_walletName, this._newWalletName.text);
|
||||
});
|
||||
notifyListeners();
|
||||
// notifyListeners();
|
||||
Navigator.pop(context, true);
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
|
@ -131,8 +133,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
final bool _answer = await _confirmDeletingWallet(context, _name);
|
||||
|
||||
if (_answer) {
|
||||
_walletFile.deleteSync(recursive: true);
|
||||
isWalletUnlock = false;
|
||||
await _walletFile.delete(recursive: true);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -28,7 +28,6 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
|||
Provider.of<GenerateWalletsProvider>(context);
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
print("JE BUILD !!!");
|
||||
|
||||
this._mnemonicController.text = generatedMnemonic;
|
||||
this._pubkey.text = generatedWallet.publicKey;
|
||||
|
@ -142,8 +141,8 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
|||
onPressed: (_generateWalletProvider
|
||||
.isAskedWordValid &&
|
||||
this.walletName.text != '')
|
||||
? () {
|
||||
_generateWalletProvider.storeWallet(
|
||||
? () async {
|
||||
await _generateWalletProvider.storeWallet(
|
||||
generatedWallet,
|
||||
walletName.text,
|
||||
context);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dubp/dubp.dart';
|
||||
import 'package:gecko/models/myWallets.dart';
|
||||
import 'package:gecko/models/walletOptions.dart';
|
||||
import 'package:gecko/screens/myWallets/changePin.dart';
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -15,11 +15,9 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
String walletName;
|
||||
|
||||
StreamController<ErrorAnimationType> errorController;
|
||||
Directory appPath;
|
||||
TextEditingController _enterPin = new TextEditingController();
|
||||
final formKey = GlobalKey<FormState>();
|
||||
bool hasError = false;
|
||||
String validPin = 'NO PIN';
|
||||
var pinColor = Color(0xffF9F9F1);
|
||||
var walletPin = '';
|
||||
|
||||
|
@ -27,8 +25,11 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("Build walletOptions");
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
MyWalletsProvider _myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
errorController = StreamController<ErrorAnimationType>();
|
||||
// _walletOptions.isWalletUnlock = false;
|
||||
return WillPopScope(
|
||||
|
@ -88,8 +89,16 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
onPressed: () => _walletOptions
|
||||
.renameWalletAlerte(
|
||||
context, walletName)
|
||||
.then((_) {
|
||||
notifyListeners();
|
||||
.then((_result) {
|
||||
if (_result == true) {
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider
|
||||
.getAllWalletsNames();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
}
|
||||
}),
|
||||
child: Text('Renommer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))))),
|
||||
|
@ -128,8 +137,14 @@ class WalletOptions extends StatelessWidget with ChangeNotifier {
|
|||
.redAccent, //Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () {
|
||||
_walletOptions.deleteWallet(context, walletName);
|
||||
onPressed: () async {
|
||||
await _walletOptions.deleteWallet(
|
||||
context, walletName);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_myWalletProvider.listWallets =
|
||||
_myWalletProvider.getAllWalletsNames();
|
||||
_myWalletProvider.rebuildWidget();
|
||||
});
|
||||
},
|
||||
child: Text('Supprimer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20)))),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:gecko/models/myWallets.dart';
|
||||
import 'package:gecko/models/walletOptions.dart';
|
||||
import 'package:gecko/screens/myWallets/generateWallets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/screens/myWallets/walletOptions.dart';
|
||||
|
@ -10,13 +11,16 @@ class WalletsHome extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
MyWalletsProvider myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context);
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
print('BUILD: WalletsHome');
|
||||
myWalletProvider.checkIfWalletExist();
|
||||
_walletOptions.isWalletUnlock = false;
|
||||
myWalletProvider.listWallets = myWalletProvider.getAllWalletsNames();
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
|
||||
return Scaffold(
|
||||
floatingActionButton: Visibility(
|
||||
visible: (myWalletProvider.checkIfWalletExist()),
|
||||
visible: (isWalletsExists),
|
||||
child: Container(
|
||||
height: 80.0,
|
||||
width: 80.0,
|
||||
|
@ -40,7 +44,7 @@ class WalletsHome extends StatelessWidget {
|
|||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
Visibility(
|
||||
visible: (!myWalletProvider.checkIfWalletExist()),
|
||||
visible: (!isWalletsExists),
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 120),
|
||||
Center(
|
||||
|
@ -78,9 +82,7 @@ class WalletsHome extends StatelessWidget {
|
|||
child: Text('Importer un portefeuille existant',
|
||||
style: TextStyle(fontSize: 20))),
|
||||
])),
|
||||
Visibility(
|
||||
visible: myWalletProvider.checkIfWalletExist(),
|
||||
child: myWalletsList(context))
|
||||
Visibility(visible: isWalletsExists, child: myWalletsList(context))
|
||||
])));
|
||||
}
|
||||
|
||||
|
|
47
pubspec.lock
47
pubspec.lock
|
@ -21,42 +21,42 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety.3"
|
||||
version: "2.5.0-nullsafety.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version: "2.1.0-nullsafety.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.5"
|
||||
version: "1.1.0-nullsafety.3"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.3"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.1.0-nullsafety.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.5"
|
||||
version: "1.15.0-nullsafety.3"
|
||||
connectivity:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -112,7 +112,7 @@ packages:
|
|||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.3"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -282,27 +282,20 @@ 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.3"
|
||||
version: "0.12.10-nullsafety.1"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.6"
|
||||
version: "1.3.0-nullsafety.3"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -330,7 +323,7 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.3"
|
||||
version: "1.8.0-nullsafety.1"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -468,28 +461,28 @@ packages:
|
|||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.4"
|
||||
version: "1.8.0-nullsafety.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.6"
|
||||
version: "1.10.0-nullsafety.1"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version: "2.1.0-nullsafety.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.1.0-nullsafety.1"
|
||||
super_tooltip:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -503,14 +496,14 @@ packages:
|
|||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.3"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety.6"
|
||||
version: "0.2.19-nullsafety.2"
|
||||
truncate:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -524,7 +517,7 @@ packages:
|
|||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.5"
|
||||
version: "1.3.0-nullsafety.3"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -545,7 +538,7 @@ packages:
|
|||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.5"
|
||||
version: "2.1.0-nullsafety.3"
|
||||
websocket:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -582,5 +575,5 @@ packages:
|
|||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.12.0-0.0 <3.0.0"
|
||||
flutter: ">=1.22.0"
|
||||
dart: ">=2.10.0-110 <2.11.0"
|
||||
flutter: ">=1.22.0 <2.0.0"
|
||||
|
|
|
@ -12,8 +12,12 @@ echo "Nom du build final: ${APPNAME}-${VERSION}+${BUILD}.apk"
|
|||
|
||||
#flutter build apk --split-per-abi --build-name $VERSION --build-number $BUILD
|
||||
flutter clean
|
||||
flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
||||
|
||||
if [[ $1 == "bundle" ]]; then
|
||||
flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
||||
else
|
||||
# flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
||||
flutter build apk --release --build-name $VERSION --build-number $BUILD
|
||||
fi
|
||||
|
||||
if [[ -d $HOME/Téléchargements ]]; then
|
||||
DL="$HOME/Téléchargements"
|
||||
|
|
Loading…
Reference in New Issue