feat: add sentry.

dev
DebuggerX 3 years ago
parent b01b2ed194
commit f760e7239c

@ -13,6 +13,7 @@ import 'package:dde_gesture_manager/utils/helper.dart';
import 'package:dde_gesture_manager/utils/init.dart'; import 'package:dde_gesture_manager/utils/init.dart';
import 'package:dde_gesture_manager/utils/simple_throttle.dart'; import 'package:dde_gesture_manager/utils/simple_throttle.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'pages/home.dart'; import 'pages/home.dart';
@ -21,13 +22,21 @@ Future<void> main() async {
EasyLocalization.logger.enableLevels = []; EasyLocalization.logger.enableLevels = [];
await EasyLocalization.ensureInitialized(); await EasyLocalization.ensureInitialized();
await initConfigs(); await initConfigs();
runApp(EasyLocalization( await SentryFlutter.init(
(options) {
options.dsn = 'https://febbfdeac6874a01b5fee56b2ba9515c@o644838.ingest.sentry.io/6216990';
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
// We recommend adjusting this value in production.
options.tracesSampleRate = 1.0;
},
appRunner: () => runApp(EasyLocalization(
supportedLocales: supportedLocales, supportedLocales: supportedLocales,
fallbackLocale: zh_CN, fallbackLocale: zh_CN,
path: 'resources/langs', path: 'resources/langs',
assetLoader: CodegenLoader(), assetLoader: CodegenLoader(),
child: MyApp(), child: MyApp(),
)); )),
);
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {

@ -40,6 +40,7 @@ class _MarketWidgetState extends State<MarketWidget> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (context.read<ConfigsProvider>().accessToken.notNull)
Api.userLikes().then((value) { Api.userLikes().then((value) {
if (mounted && value != null) if (mounted && value != null)
setState(() { setState(() {

@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <flutter_platform_alert/flutter_platform_alert_plugin.h> #include <flutter_platform_alert/flutter_platform_alert_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h> #include <window_manager/window_manager_plugin.h>
@ -14,6 +15,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_platform_alert_registrar = g_autoptr(FlPluginRegistrar) flutter_platform_alert_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterPlatformAlertPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterPlatformAlertPlugin");
flutter_platform_alert_plugin_register_with_registrar(flutter_platform_alert_registrar); flutter_platform_alert_plugin_register_with_registrar(flutter_platform_alert_registrar);
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
flutter_platform_alert flutter_platform_alert
sentry_flutter
url_launcher_linux url_launcher_linux
window_manager window_manager
) )

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 1.0.1+1
environment: environment:
sdk: ">=2.15.0 <3.0.0" sdk: ">=2.15.0 <3.0.0"
@ -43,6 +43,7 @@ dependencies:
flutter_login: ^3.1.0 flutter_login: ^3.1.0
auto_size_text: ^3.0.0 auto_size_text: ^3.0.0
numeral: ^1.2.5 numeral: ^1.2.5
sentry_flutter: ^6.3.0
markdown_editor_ot: markdown_editor_ot:
path: 3rd_party/markdown_editor_ot path: 3rd_party/markdown_editor_ot
cherry_toast: cherry_toast:

Loading…
Cancel
Save