Merge branch 'bugFixesAgain' into 'master'
Bug fixes again See merge request clients/gecko!14
This commit is contained in:
commit
20b42742a4
|
@ -53,6 +53,12 @@ Future<void> main() async {
|
||||||
// Get a valid GVA endpoint
|
// Get a valid GVA endpoint
|
||||||
endPointGVA = await _homeProvider.getValidEndpoint();
|
endPointGVA = await _homeProvider.getValidEndpoint();
|
||||||
|
|
||||||
|
if (endPointGVA == 'HS') {
|
||||||
|
_homeProvider.playSound('faché', 0.8);
|
||||||
|
} else {
|
||||||
|
_homeProvider.playSound('start', 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
if (kReleaseMode && enableSentry) {
|
if (kReleaseMode && enableSentry) {
|
||||||
// CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
// CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
||||||
// SentryHandler(SentryClient(SentryOptions(
|
// SentryHandler(SentryClient(SentryOptions(
|
||||||
|
|
|
@ -61,11 +61,8 @@ class HomeProvider with ChangeNotifier {
|
||||||
int listLenght = _listEndpoints.length - 1;
|
int listLenght = _listEndpoints.length - 1;
|
||||||
if (i > listLenght) {
|
if (i > listLenght) {
|
||||||
log.e('NO VALID GVA ENDPOINT FOUND');
|
log.e('NO VALID GVA ENDPOINT FOUND');
|
||||||
playSound('faché');
|
|
||||||
_endpoint = 'HS';
|
_endpoint = 'HS';
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
playSound('start');
|
|
||||||
}
|
}
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
@ -128,9 +125,9 @@ class HomeProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void playSound(String customSound) async {
|
void playSound(String customSound, double volume) async {
|
||||||
await player.play('$customSound.wav',
|
await player.play('$customSound.wav',
|
||||||
volume: 1, mode: PlayerMode.LOW_LATENCY, stayAwake: false);
|
volume: volume, mode: PlayerMode.LOW_LATENCY, stayAwake: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleSearchEnd() {
|
void handleSearchEnd() {
|
||||||
|
@ -146,4 +143,8 @@ class HomeProvider with ChangeNotifier {
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rebuildWidget() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,10 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
List configLines = await _walletConfig.readAsLines();
|
List configLines = await _walletConfig.readAsLines();
|
||||||
log.d(configLines);
|
log.d(configLines);
|
||||||
|
|
||||||
|
if (configLines.isEmpty) {
|
||||||
|
return WalletData('');
|
||||||
|
}
|
||||||
|
|
||||||
return WalletData(
|
return WalletData(
|
||||||
configLines.firstWhere((element) => element.startsWith(_id)));
|
configLines.firstWhere((element) => element.startsWith(_id)));
|
||||||
}
|
}
|
||||||
|
@ -125,20 +129,24 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteAllWallet(context) async {
|
Future<int> deleteAllWallet(context) async {
|
||||||
|
MyWalletsProvider _myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
try {
|
try {
|
||||||
log.w('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 defaultWalletFile.delete();
|
||||||
await walletsDirectory.create();
|
await walletsDirectory.create();
|
||||||
// await defaultWalletFile.create();
|
|
||||||
await initWalletFolder();
|
await initWalletFolder();
|
||||||
await Future.delayed(Duration(milliseconds: 100));
|
// await Future.delayed(Duration(milliseconds: 500));
|
||||||
|
// scheduleMicrotask(() {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
rebuildWidget();
|
rebuildWidget();
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
// });
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -152,8 +160,6 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
|
||||||
Provider.of<MyWalletsProvider>(context);
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title:
|
title:
|
||||||
Text('Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
|
Text('Êtes-vous sûr de vouloir supprimer tous vos trousseaux ?'),
|
||||||
|
@ -168,11 +174,6 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text("Oui"),
|
child: Text("Oui"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_myWalletProvider.listWallets =
|
|
||||||
_myWalletProvider.readAllWallets(getCurrentChest());
|
|
||||||
_myWalletProvider.rebuildWidget();
|
|
||||||
});
|
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,8 +8,10 @@ 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/home.dart';
|
||||||
import 'package:gecko/models/myWallets.dart';
|
import 'package:gecko/models/myWallets.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
import 'package:provider/provider.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;
|
||||||
|
|
||||||
|
@ -73,29 +75,28 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Future readLocalWallet(
|
Future readLocalWallet(
|
||||||
context, WalletData _wallet, String _pin, int _pinLenght) async {
|
context, WalletData _wallet, String _pin, int _pinLenght) async {
|
||||||
|
HomeProvider _homeProvider =
|
||||||
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
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("$_localDewif $_pin $_pinLenght ${_wallet.derivation}");
|
||||||
log.d(_pin);
|
|
||||||
|
|
||||||
if ((_localPubkey = await _getPubkeyFromDewif(
|
if ((_localPubkey = await _getPubkeyFromDewif(
|
||||||
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
|
_localDewif, _pin, _pinLenght, _wallet.derivation)) !=
|
||||||
'false') {
|
'false') {
|
||||||
this.pubkey.text = _localPubkey;
|
this.pubkey.text = _localPubkey;
|
||||||
isWalletUnlock = true;
|
isWalletUnlock = true;
|
||||||
// notifyListeners();
|
|
||||||
|
|
||||||
return _localDewif;
|
return _localDewif;
|
||||||
} else {
|
} else {
|
||||||
throw 'Bad pubkey';
|
throw 'Bad pubkey';
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
_homeProvider.playSound('non', 0.6);
|
||||||
log.e('ERROR READING FILE: $e');
|
log.e('ERROR READING FILE: $e');
|
||||||
this.pubkey.clear();
|
this.pubkey.clear();
|
||||||
// notifyListeners();
|
|
||||||
return 'bad';
|
return 'bad';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +161,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
context, _walletName, _walletNbr, _derivation) async {
|
context, _walletName, _walletNbr, _derivation) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('Choisissez un nouveau nom pour ce portefeuille'),
|
title: Text('Choisissez un nouveau nom pour ce portefeuille'),
|
||||||
|
@ -320,6 +321,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getShortPubkey(String pubkey) {
|
String getShortPubkey(String pubkey) {
|
||||||
|
log.d(pubkey);
|
||||||
List<int> pubkeyByte = Base58Decode(pubkey);
|
List<int> pubkeyByte = Base58Decode(pubkey);
|
||||||
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
|
||||||
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);
|
String pubkeyCheksum = Base58Encode(pubkeyS256.bytes);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -140,8 +142,12 @@ class ConfirmStoreWallet extends StatelessWidget with ChangeNotifier {
|
||||||
_myWalletProvider.listWallets =
|
_myWalletProvider.listWallets =
|
||||||
_myWalletProvider
|
_myWalletProvider
|
||||||
.readAllWallets(_currentChest);
|
.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
scheduleMicrotask(() {
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Navigator.popUntil(
|
||||||
|
context, ModalRoute.withName('/'));
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: Text('Confirmer',
|
child: Text('Confirmer',
|
||||||
|
|
|
@ -18,9 +18,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
|
||||||
_walletOptions.isWalletUnlock = false;
|
|
||||||
|
|
||||||
final int _currentChest = myWalletProvider.getCurrentChest();
|
final int _currentChest = myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
|
@ -34,6 +31,8 @@ class WalletsHome extends StatelessWidget {
|
||||||
myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.d("${myWalletProvider.pinCode},${myWalletProvider.pinLenght}");
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
|
|
|
@ -110,6 +110,8 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (_pin) async {
|
||||||
|
_myWalletProvider.pinCode = _pin;
|
||||||
|
_myWalletProvider.pinLenght = _pinLenght;
|
||||||
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) {
|
||||||
|
@ -117,9 +119,11 @@ class OnboardingStepFourteen extends StatelessWidget {
|
||||||
await _generateWalletProvider.storeHDWChest(
|
await _generateWalletProvider.storeHDWChest(
|
||||||
generatedWallet, 'Mon portefeuille courant', context);
|
generatedWallet, 'Mon portefeuille courant', context);
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_walletOptions.reloadBuild();
|
|
||||||
_myWalletProvider.rebuildWidget();
|
|
||||||
await _myWalletProvider.getDefaultWalletAsync();
|
await _myWalletProvider.getDefaultWalletAsync();
|
||||||
|
scheduleMicrotask(() {
|
||||||
|
_walletOptions.reloadBuild();
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
});
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
|
|
46
pubspec.lock
46
pubspec.lock
|
@ -387,6 +387,48 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.3+2"
|
version: "0.4.3+2"
|
||||||
|
package_info_plus:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_macos
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -561,14 +603,14 @@ packages:
|
||||||
name: sentry
|
name: sentry
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0-nullsafety.0"
|
version: "5.0.0"
|
||||||
sentry_flutter:
|
sentry_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: sentry_flutter
|
name: sentry_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.4"
|
version: "5.0.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
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.2+1
|
version: 0.0.2+6
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -39,14 +39,14 @@ dependencies:
|
||||||
fast_base58:
|
fast_base58:
|
||||||
logger: ^1.0.0
|
logger: ^1.0.0
|
||||||
flutter_logs: ^2.1.3
|
flutter_logs: ^2.1.3
|
||||||
sentry: ^4.0.4
|
sentry: ^5.0.0
|
||||||
sentry_flutter: ^4.0.4
|
sentry_flutter: ^5.0.0
|
||||||
bubble: ^1.1.9+1
|
bubble: ^1.1.9+1
|
||||||
flutter_svg: ^0.20.0-nullsafety
|
flutter_svg: ^0.20.0-nullsafety
|
||||||
responsive_framework: ^0.0.14
|
responsive_framework: ^0.0.14
|
||||||
responsive_builder: ^0.3.0
|
responsive_builder: ^0.3.0
|
||||||
jdenticon_dart: ^2.0.0
|
jdenticon_dart: ^2.0.0
|
||||||
audioplayers: ^0.18.3
|
audioplayers: ^0.18.1
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "ic_launcher"
|
android: "ic_launcher"
|
||||||
|
|
Loading…
Reference in New Issue