Catch DubpRust.setup errors on startup; Change Home tab to Explorer tab with icon

This commit is contained in:
poka 2021-02-18 07:54:35 +01:00
parent bde1028c70
commit 4373e95cbf
7 changed files with 80 additions and 69 deletions

BIN
assets/blockchain.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -24,7 +24,6 @@ import 'package:catcher/catcher.dart';
final bool enableSentry = true; final bool enableSentry = true;
Future<void> main() async { Future<void> main() async {
try {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// var downloadsDirectory = DownloadsPathProvider.downloadsDirectory; // var downloadsDirectory = DownloadsPathProvider.downloadsDirectory;
@ -64,8 +63,7 @@ Future<void> main() async {
// CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [ // CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [
// EmailManualHandler(["poka@p2p.legal"]) // EmailManualHandler(["poka@p2p.legal"])
// ]); // ]);
Catcher( Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
// await SentryFlutter.init( // await SentryFlutter.init(
// (options) { // (options) {
@ -79,15 +77,6 @@ Future<void> main() async {
runApp(Gecko(endPointGVA, _store)); runApp(Gecko(endPointGVA, _store));
} }
} catch (e, stack) {
print(e);
if (kReleaseMode) {
await Sentry.captureException(
e,
stackTrace: stack,
);
}
}
} }
class Gecko extends StatelessWidget { class Gecko extends StatelessWidget {
@ -107,7 +96,17 @@ class Gecko extends StatelessWidget {
link: _httpLink, link: _httpLink,
), ),
); );
try {
DubpRust.setup(); DubpRust.setup();
} catch (e, stack) {
print(e);
if (kReleaseMode) {
Sentry.captureException(
e,
stackTrace: stack,
);
}
}
return MultiProvider( return MultiProvider(
providers: [ providers: [

View File

@ -1,8 +1,10 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/models/home.dart';
import 'package:graphql_flutter/graphql_flutter.dart'; import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:qrscan/qrscan.dart' as scanner; import 'package:qrscan/qrscan.dart' as scanner;
import 'dart:math'; import 'dart:math';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -22,7 +24,7 @@ class HistoryProvider with ChangeNotifier {
bool isHistoryScreen = false; bool isHistoryScreen = false;
String historySwitchButtun = "Voir l'historique"; String historySwitchButtun = "Voir l'historique";
Future scan() async { Future scan(context) async {
await Permission.camera.request(); await Permission.camera.request();
String barcode; String barcode;
try { try {
@ -33,14 +35,16 @@ class HistoryProvider with ChangeNotifier {
} }
if (barcode != null) { if (barcode != null) {
this.outputPubkey.text = barcode; this.outputPubkey.text = barcode;
isPubkey(barcode); isPubkey(context, barcode);
} else { } else {
return 'false'; return 'false';
} }
return barcode; return barcode;
} }
String isPubkey(pubkey) { String isPubkey(context, pubkey) {
HomeProvider _homeProvider =
Provider.of<HomeProvider>(context, listen: false);
final RegExp regExp = new RegExp( final RegExp regExp = new RegExp(
r'^[a-zA-Z0-9]+$', r'^[a-zA-Z0-9]+$',
caseSensitive: false, caseSensitive: false,
@ -59,6 +63,7 @@ class HistoryProvider with ChangeNotifier {
isHistoryScreen = false; isHistoryScreen = false;
historySwitchButtun = "Voir l'historique"; historySwitchButtun = "Voir l'historique";
_homeProvider.handleSearchEnd();
notifyListeners(); notifyListeners();
return pubkey; return pubkey;

View File

@ -43,7 +43,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
child: FloatingActionButton( child: FloatingActionButton(
heroTag: "buttonScan", heroTag: "buttonScan",
onPressed: () async { onPressed: () async {
await _historyProvider.scan(); await _historyProvider.scan(context);
}, },
child: Container( child: Container(
height: 40.0, height: 40.0,
@ -346,7 +346,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
isThreeLine: false, isThreeLine: false,
onTap: () { onTap: () {
// this._outputPubkey.text = repository[2]; // this._outputPubkey.text = repository[2];
_historyProvider.isPubkey(repository[2]); _historyProvider.isPubkey(context, repository[2]);
})), })),
if (result.isLoading) if (result.isLoading)
Row( Row(

View File

@ -88,7 +88,7 @@ class HomeScreen extends StatelessWidget {
onChanged: (text) { onChanged: (text) {
print("Clé tappé: $text"); print("Clé tappé: $text");
final String searchResult = final String searchResult =
_historyProvider.isPubkey(text); _historyProvider.isPubkey(context, text);
if (searchResult != '') { if (searchResult != '') {
_homeProvider.currentIndex = 0; _homeProvider.currentIndex = 0;
} }
@ -123,13 +123,18 @@ class HomeScreen extends StatelessWidget {
currentIndex: _homeProvider.currentIndex, currentIndex: _homeProvider.currentIndex,
items: [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.format_list_bulleted), icon: Padding(
label: 'Accueil', padding: EdgeInsets.symmetric(horizontal: 86),
child: Image.asset('assets/blockchain.png')),
activeIcon: Padding(
padding: EdgeInsets.symmetric(horizontal: 86),
child: Image.asset('assets/blockchain.png')),
label: 'Explorateur',
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: new Icon(Icons.lock), icon: Icon(Icons.lock),
label: 'Mes portefeuilles', label: 'Mes portefeuilles',
) ),
], ],
), ),
); );

View File

@ -5,7 +5,7 @@ description: A new Flutter project.
# 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.1+8 version: 0.0.1+10
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"
@ -61,3 +61,4 @@ flutter:
- assets/OpenSans-Regular.ttf - assets/OpenSans-Regular.ttf
- assets/icon_user.png - assets/icon_user.png
- assets/qrcode-scan.png - assets/qrcode-scan.png
- assets/blockchain.png

View File

@ -10,7 +10,7 @@ ori_app="app.apk"
echo "Nom du build final: ${APPNAME}-${VERSION}+${BUILD}.apk" echo "Nom du build final: ${APPNAME}-${VERSION}+${BUILD}.apk"
## To compile Rust binding ## To build Rust dependancies
# cargo br # cargo br
echo "To compile Rust binding, exec: cargo br" echo "To compile Rust binding, exec: cargo br"
@ -20,6 +20,7 @@ if [[ $1 == "bundle" ]]; then
flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
else else
# flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD # flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
# flutter build apk --release --split-per-abi --build-name $VERSION --build-number $BUILD
flutter build apk --release --build-name $VERSION --build-number $BUILD flutter build apk --release --build-name $VERSION --build-number $BUILD
fi fi