Catch DubpRust.setup errors on startup; Change Home tab to Explorer tab with icon
This commit is contained in:
parent
bde1028c70
commit
4373e95cbf
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
113
lib/main.dart
113
lib/main.dart
|
@ -24,69 +24,58 @@ import 'package:catcher/catcher.dart';
|
|||
final bool enableSentry = true;
|
||||
|
||||
Future<void> main() async {
|
||||
try {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// var downloadsDirectory = DownloadsPathProvider.downloadsDirectory;
|
||||
// File logFile = File(downloadsDirectory.toString() + '/gecko.log');
|
||||
// var downloadsDirectory = DownloadsPathProvider.downloadsDirectory;
|
||||
// File logFile = File(downloadsDirectory.toString() + '/gecko.log');
|
||||
|
||||
// await FlutterLogs.initLogs(
|
||||
// logLevelsEnabled: [
|
||||
// LogLevel.INFO,
|
||||
// LogLevel.WARNING,
|
||||
// LogLevel.ERROR,
|
||||
// LogLevel.SEVERE
|
||||
// ],
|
||||
// timeStampFormat: TimeStampFormat.TIME_FORMAT_READABLE,
|
||||
// directoryStructure: DirectoryStructure.FOR_EVENT,
|
||||
// logTypesEnabled: ["Locations", "APIs"],
|
||||
// logFileExtension: LogFileExtension.LOG,
|
||||
// logsWriteDirectoryName: downloadsDirectory.toString(),
|
||||
// logsExportDirectoryName: downloadsDirectory.toString());
|
||||
// await FlutterLogs.initLogs(
|
||||
// logLevelsEnabled: [
|
||||
// LogLevel.INFO,
|
||||
// LogLevel.WARNING,
|
||||
// LogLevel.ERROR,
|
||||
// LogLevel.SEVERE
|
||||
// ],
|
||||
// timeStampFormat: TimeStampFormat.TIME_FORMAT_READABLE,
|
||||
// directoryStructure: DirectoryStructure.FOR_EVENT,
|
||||
// logTypesEnabled: ["Locations", "APIs"],
|
||||
// logFileExtension: LogFileExtension.LOG,
|
||||
// logsWriteDirectoryName: downloadsDirectory.toString(),
|
||||
// logsExportDirectoryName: downloadsDirectory.toString());
|
||||
|
||||
HomeProvider _homeProvider = HomeProvider();
|
||||
await _homeProvider.getAppPath();
|
||||
await _homeProvider.createDefaultAvatar();
|
||||
appVersion = await _homeProvider.getAppVersion();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
final HiveStore _store =
|
||||
await HiveStore.open(path: '${appPath.path}/gqlCache');
|
||||
HomeProvider _homeProvider = HomeProvider();
|
||||
await _homeProvider.getAppPath();
|
||||
await _homeProvider.createDefaultAvatar();
|
||||
appVersion = await _homeProvider.getAppVersion();
|
||||
prefs = await SharedPreferences.getInstance();
|
||||
final HiveStore _store =
|
||||
await HiveStore.open(path: '${appPath.path}/gqlCache');
|
||||
|
||||
// Get a valid GVA endpoint
|
||||
endPointGVA = await _homeProvider.getValidEndpoint();
|
||||
// Get a valid GVA endpoint
|
||||
endPointGVA = await _homeProvider.getValidEndpoint();
|
||||
|
||||
if (kReleaseMode && enableSentry) {
|
||||
CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
||||
SentryHandler(SentryClient(SentryOptions(
|
||||
dsn:
|
||||
"https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110")))
|
||||
]);
|
||||
// CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [
|
||||
// EmailManualHandler(["poka@p2p.legal"])
|
||||
// ]);
|
||||
Catcher(
|
||||
rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
|
||||
if (kReleaseMode && enableSentry) {
|
||||
CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
|
||||
SentryHandler(SentryClient(SentryOptions(
|
||||
dsn:
|
||||
"https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110")))
|
||||
]);
|
||||
// CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [
|
||||
// EmailManualHandler(["poka@p2p.legal"])
|
||||
// ]);
|
||||
Catcher(rootWidget: Gecko(endPointGVA, _store), debugConfig: debugOptions);
|
||||
|
||||
// await SentryFlutter.init(
|
||||
// (options) {
|
||||
// options.dsn =
|
||||
// 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||
// },
|
||||
// appRunner: () => runApp(Gecko(endPointGVA, _store)),
|
||||
// );
|
||||
} else {
|
||||
print('Debug mode enabled: No sentry alerte');
|
||||
// await SentryFlutter.init(
|
||||
// (options) {
|
||||
// options.dsn =
|
||||
// 'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||
// },
|
||||
// appRunner: () => runApp(Gecko(endPointGVA, _store)),
|
||||
// );
|
||||
} else {
|
||||
print('Debug mode enabled: No sentry alerte');
|
||||
|
||||
runApp(Gecko(endPointGVA, _store));
|
||||
}
|
||||
} catch (e, stack) {
|
||||
print(e);
|
||||
if (kReleaseMode) {
|
||||
await Sentry.captureException(
|
||||
e,
|
||||
stackTrace: stack,
|
||||
);
|
||||
}
|
||||
runApp(Gecko(endPointGVA, _store));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +96,17 @@ class Gecko extends StatelessWidget {
|
|||
link: _httpLink,
|
||||
),
|
||||
);
|
||||
DubpRust.setup();
|
||||
try {
|
||||
DubpRust.setup();
|
||||
} catch (e, stack) {
|
||||
print(e);
|
||||
if (kReleaseMode) {
|
||||
Sentry.captureException(
|
||||
e,
|
||||
stackTrace: stack,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/models/home.dart';
|
||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:qrscan/qrscan.dart' as scanner;
|
||||
import 'dart:math';
|
||||
import 'package:intl/intl.dart';
|
||||
|
@ -22,7 +24,7 @@ class HistoryProvider with ChangeNotifier {
|
|||
bool isHistoryScreen = false;
|
||||
String historySwitchButtun = "Voir l'historique";
|
||||
|
||||
Future scan() async {
|
||||
Future scan(context) async {
|
||||
await Permission.camera.request();
|
||||
String barcode;
|
||||
try {
|
||||
|
@ -33,14 +35,16 @@ class HistoryProvider with ChangeNotifier {
|
|||
}
|
||||
if (barcode != null) {
|
||||
this.outputPubkey.text = barcode;
|
||||
isPubkey(barcode);
|
||||
isPubkey(context, barcode);
|
||||
} else {
|
||||
return 'false';
|
||||
}
|
||||
return barcode;
|
||||
}
|
||||
|
||||
String isPubkey(pubkey) {
|
||||
String isPubkey(context, pubkey) {
|
||||
HomeProvider _homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
final RegExp regExp = new RegExp(
|
||||
r'^[a-zA-Z0-9]+$',
|
||||
caseSensitive: false,
|
||||
|
@ -59,6 +63,7 @@ class HistoryProvider with ChangeNotifier {
|
|||
|
||||
isHistoryScreen = false;
|
||||
historySwitchButtun = "Voir l'historique";
|
||||
_homeProvider.handleSearchEnd();
|
||||
notifyListeners();
|
||||
|
||||
return pubkey;
|
||||
|
|
|
@ -43,7 +43,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
child: FloatingActionButton(
|
||||
heroTag: "buttonScan",
|
||||
onPressed: () async {
|
||||
await _historyProvider.scan();
|
||||
await _historyProvider.scan(context);
|
||||
},
|
||||
child: Container(
|
||||
height: 40.0,
|
||||
|
@ -346,7 +346,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
isThreeLine: false,
|
||||
onTap: () {
|
||||
// this._outputPubkey.text = repository[2];
|
||||
_historyProvider.isPubkey(repository[2]);
|
||||
_historyProvider.isPubkey(context, repository[2]);
|
||||
})),
|
||||
if (result.isLoading)
|
||||
Row(
|
||||
|
|
|
@ -88,7 +88,7 @@ class HomeScreen extends StatelessWidget {
|
|||
onChanged: (text) {
|
||||
print("Clé tappé: $text");
|
||||
final String searchResult =
|
||||
_historyProvider.isPubkey(text);
|
||||
_historyProvider.isPubkey(context, text);
|
||||
if (searchResult != '') {
|
||||
_homeProvider.currentIndex = 0;
|
||||
}
|
||||
|
@ -123,13 +123,18 @@ class HomeScreen extends StatelessWidget {
|
|||
currentIndex: _homeProvider.currentIndex,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: new Icon(Icons.format_list_bulleted),
|
||||
label: 'Accueil',
|
||||
icon: Padding(
|
||||
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(
|
||||
icon: new Icon(Icons.lock),
|
||||
icon: Icon(Icons.lock),
|
||||
label: 'Mes portefeuilles',
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
|||
# 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.1+8
|
||||
version: 0.0.1+10
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
|
@ -61,3 +61,4 @@ flutter:
|
|||
- assets/OpenSans-Regular.ttf
|
||||
- assets/icon_user.png
|
||||
- assets/qrcode-scan.png
|
||||
- assets/blockchain.png
|
||||
|
|
|
@ -10,7 +10,7 @@ ori_app="app.apk"
|
|||
|
||||
echo "Nom du build final: ${APPNAME}-${VERSION}+${BUILD}.apk"
|
||||
|
||||
## To compile Rust binding
|
||||
## To build Rust dependancies
|
||||
# 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
|
||||
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 --build-name $VERSION --build-number $BUILD
|
||||
flutter build apk --release --build-name $VERSION --build-number $BUILD
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue