mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Prevent multiple UI errors from showing multiple alerts [skip ci]
This commit is contained in:
+10
-2
@@ -50,6 +50,7 @@ import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
final rootKey = GlobalKey<RootState>();
|
||||
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
bool hasError = false;
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
@@ -206,11 +207,16 @@ void _sendExceptionFile() async {
|
||||
}
|
||||
|
||||
void _onError(FlutterErrorDetails errorDetails) {
|
||||
if (hasError) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasError = true;
|
||||
_saveException(errorDetails.exception.toString(), errorDetails.stack);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(timeStamp) {
|
||||
showPopUp<void>(
|
||||
(timeStamp) async {
|
||||
await showPopUp<void>(
|
||||
context: navigatorKey.currentContext!,
|
||||
builder: (context) {
|
||||
return AlertWithTwoActions(
|
||||
@@ -229,6 +235,8 @@ void _onError(FlutterErrorDetails errorDetails) {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
hasError = false;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user