From 5dc22be9fbf673ddc0bd623ed544e5679deae382 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Wed, 28 Oct 2020 18:13:04 +0100 Subject: [PATCH] fix: Sentry and small null fix --- lib/components/user_bottom_sheet.dart | 2 +- lib/main.dart | 2 ++ lib/utils/sentry_controller.dart | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/components/user_bottom_sheet.dart b/lib/components/user_bottom_sheet.dart index 22095eff..4757f3f4 100644 --- a/lib/components/user_bottom_sheet.dart +++ b/lib/components/user_bottom_sheet.dart @@ -173,7 +173,7 @@ class UserBottomSheet extends StatelessWidget { subtitle: Text(presence.getLocalizedLastActiveAgo(context)), trailing: Icon(Icons.circle, - color: presence.presence.currentlyActive + color: presence.presence.currentlyActive ?? false ? Colors.green : Colors.grey), ), diff --git a/lib/main.dart b/lib/main.dart index 8f7d274e..bba5897c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,6 +18,8 @@ import 'views/chat_list.dart'; void main() { SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: Colors.transparent)); + FlutterError.onError = (FlutterErrorDetails details) => + Zone.current.handleUncaughtError(details.exception, details.stack); runZonedGuarded( () => runApp(App()), SentryController.captureException, diff --git a/lib/utils/sentry_controller.dart b/lib/utils/sentry_controller.dart index e4c3ed73..8cebc6c1 100644 --- a/lib/utils/sentry_controller.dart +++ b/lib/utils/sentry_controller.dart @@ -2,6 +2,7 @@ import 'package:bot_toast/bot_toast.dart'; import 'package:fluffychat/components/dialogs/simple_dialogs.dart'; import 'package:fluffychat/config/app_config.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:sentry/sentry.dart'; @@ -31,8 +32,7 @@ abstract class SentryController { static void captureException(error, stackTrace) async { debugPrint(error.toString()); debugPrint(stackTrace.toString()); - final storage = Store(); - if (await storage.getItem('sentry') == 'true') { + if (!kDebugMode && await getSentryStatus()) { await sentry.captureException( exception: error, stackTrace: stackTrace,