Fix bad certificat for Duniter node on old Android version

This commit is contained in:
poka 2021-11-15 21:04:06 +01:00
parent 6d69d039d1
commit 4f316c40f5
5 changed files with 23 additions and 9 deletions

View File

@ -16,6 +16,7 @@
// ignore_for_file: avoid_print // ignore_for_file: avoid_print
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/cesium_plus.dart'; import 'package:gecko/models/cesium_plus.dart';
@ -103,6 +104,8 @@ Future<void> main() async {
} else { } else {
print('Debug mode enabled: No sentry alerte'); print('Debug mode enabled: No sentry alerte');
HttpOverrides.global = MyHttpOverrides();
runApp(Gecko(endPointGVA)); runApp(Gecko(endPointGVA));
} }
} }
@ -177,3 +180,13 @@ class Gecko extends StatelessWidget {
)); ));
} }
} }
// This http overriding is needed to fix fail certifcat checking for Duniter node on old Android version
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}

View File

@ -133,7 +133,6 @@ class MyWalletsProvider with ChangeNotifier {
await walletBox.add(newWallet); await walletBox.add(newWallet);
notifyListeners(); notifyListeners();
Navigator.pop(context);
} }
void rebuildWidget() { void rebuildWidget() {

View File

@ -58,7 +58,7 @@ class UnlockingWallet extends StatelessWidget {
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
Image.asset( Image.asset(
'assets/chests/${currentChest.imageName}', 'assets/chests/${currentChest.imageName}',
height: 120 * ratio, height: isTall ? 130 : 100,
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
SizedBox( SizedBox(

View File

@ -315,6 +315,11 @@ class WalletsHome extends StatelessWidget {
} }
Widget addNewDerivation(context) { Widget addNewDerivation(context) {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
String _newDerivationName =
'Portefeuille ${_myWalletProvider.listWallets.last.number + 2}';
return Padding( return Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: ClipRRect( child: ClipRRect(
@ -323,12 +328,9 @@ class WalletsHome extends StatelessWidget {
Expanded( Expanded(
child: InkWell( child: InkWell(
key: const Key('addDerivation'), key: const Key('addDerivation'),
onTap: () { onTap: () async {
showDialog( await _myWalletProvider.generateNewDerivation(
context: context, context, _newDerivationName);
builder: (BuildContext context) {
return addNewDerivationPopup(context);
});
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,

View File

@ -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+9 version: 0.0.2+10
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"