fix: Sentry
This commit is contained in:
parent
4e2f489a52
commit
b903ea9071
|
@ -7,6 +7,7 @@ import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
|||
import 'package:fluffychat/utils/firebase_controller.dart';
|
||||
import 'package:fluffychat/utils/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
@ -17,7 +18,6 @@ import 'package:fluffychat/config/app_config.dart';
|
|||
import 'package:dbus/dbus.dart';
|
||||
import 'package:desktop_notifications/desktop_notifications.dart';*/
|
||||
|
||||
import '../main.dart';
|
||||
import '../utils/app_route.dart';
|
||||
import '../utils/beautify_string_extension.dart';
|
||||
import '../utils/famedlysdk_store.dart';
|
||||
|
@ -98,7 +98,7 @@ class MatrixState extends State<Matrix> {
|
|||
}
|
||||
} catch (e, s) {
|
||||
client.onLoginStateChanged.sink.addError(e, s);
|
||||
captureException(e, s);
|
||||
SentryController.captureException(e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,4 +6,6 @@ abstract class AppConfig {
|
|||
'https://gitlab.com/ChristianPauly/fluffychat-flutter';
|
||||
static const String supportUrl =
|
||||
'https://gitlab.com/ChristianPauly/fluffychat-flutter/issues';
|
||||
static const String sentryDsn =
|
||||
'https://8591d0d863b646feb4f3dda7e5dcab38@o256755.ingest.sentry.io/5243143';
|
||||
}
|
||||
|
|
|
@ -3,39 +3,24 @@ import 'dart:io';
|
|||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/sentry_controller.dart';
|
||||
import 'package:fluffychat/views/homeserver_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
import 'package:universal_html/prefer_universal/html.dart' as html;
|
||||
|
||||
import 'components/matrix.dart';
|
||||
import 'components/theme_switcher.dart';
|
||||
import 'utils/famedlysdk_store.dart';
|
||||
import 'views/chat_list.dart';
|
||||
|
||||
final sentry = SentryClient(dsn: '8591d0d863b646feb4f3dda7e5dcab38');
|
||||
|
||||
void captureException(error, stackTrace) async {
|
||||
debugPrint(error.toString());
|
||||
debugPrint(stackTrace.toString());
|
||||
final storage = Store();
|
||||
if (await storage.getItem('sentry') == 'true') {
|
||||
await sentry.captureException(
|
||||
exception: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
|
||||
runZonedGuarded(
|
||||
() => runApp(App()),
|
||||
captureException,
|
||||
SentryController.captureException,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
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_gen/gen_l10n/l10n.dart';
|
||||
import 'package:sentry/sentry.dart';
|
||||
|
||||
import 'famedlysdk_store.dart';
|
||||
|
||||
|
@ -23,4 +25,18 @@ abstract class SentryController {
|
|||
final storage = Store();
|
||||
return await storage.getItem('sentry') == 'true';
|
||||
}
|
||||
|
||||
static final sentry = SentryClient(dsn: AppConfig.sentryDsn);
|
||||
|
||||
static void captureException(error, stackTrace) async {
|
||||
debugPrint(error.toString());
|
||||
debugPrint(stackTrace.toString());
|
||||
final storage = Store();
|
||||
if (await storage.getItem('sentry') == 'true') {
|
||||
await sentry.captureException(
|
||||
exception: error,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue