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
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/cesium_plus.dart';
@ -103,6 +104,8 @@ Future<void> main() async {
} else {
print('Debug mode enabled: No sentry alerte');
HttpOverrides.global = MyHttpOverrides();
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);
notifyListeners();
Navigator.pop(context);
}
void rebuildWidget() {

View File

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

View File

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

View File

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