Skip to content
Snippets Groups Projects
Commit 20b42742 authored by poka's avatar poka
Browse files

Merge branch 'bugFixesAgain' into 'master'

Bug fixes again

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