diff --git a/app/lib/main.dart b/app/lib/main.dart index 93e1f5d..3f7fad5 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -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/simple_throttle.dart'; import 'package:flutter/material.dart'; +import 'package:sentry_flutter/sentry_flutter.dart'; import 'pages/home.dart'; @@ -21,13 +22,21 @@ Future main() async { EasyLocalization.logger.enableLevels = []; await EasyLocalization.ensureInitialized(); await initConfigs(); - runApp(EasyLocalization( - supportedLocales: supportedLocales, - fallbackLocale: zh_CN, - path: 'resources/langs', - assetLoader: CodegenLoader(), - child: MyApp(), - )); + 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, + fallbackLocale: zh_CN, + path: 'resources/langs', + assetLoader: CodegenLoader(), + child: MyApp(), + )), + ); } class MyApp extends StatelessWidget { diff --git a/app/lib/widgets/market.dart b/app/lib/widgets/market.dart index d717881..0a240b2 100644 --- a/app/lib/widgets/market.dart +++ b/app/lib/widgets/market.dart @@ -40,12 +40,13 @@ class _MarketWidgetState extends State { @override void initState() { super.initState(); - Api.userLikes().then((value) { - if (mounted && value != null) - setState(() { - _likedSchemes = value; - }); - }); + if (context.read().accessToken.notNull) + Api.userLikes().then((value) { + if (mounted && value != null) + setState(() { + _likedSchemes = value; + }); + }); Api.marketSchemes(type: _type, page: _currentPage).then((value) { if (mounted && value != null) setState(() { diff --git a/app/linux/flutter/generated_plugin_registrant.cc b/app/linux/flutter/generated_plugin_registrant.cc index 0d852ba..3ce02b2 100644 --- a/app/linux/flutter/generated_plugin_registrant.cc +++ b/app/linux/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include @@ -14,6 +15,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) flutter_platform_alert_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterPlatformAlertPlugin"); 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 = fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); diff --git a/app/linux/flutter/generated_plugins.cmake b/app/linux/flutter/generated_plugins.cmake index 9945fd3..71dd38f 100644 --- a/app/linux/flutter/generated_plugins.cmake +++ b/app/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_platform_alert + sentry_flutter url_launcher_linux window_manager ) diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 25d71d4..f1a074b 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -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. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 1.0.1+1 environment: sdk: ">=2.15.0 <3.0.0" @@ -43,6 +43,7 @@ dependencies: flutter_login: ^3.1.0 auto_size_text: ^3.0.0 numeral: ^1.2.5 + sentry_flutter: ^6.3.0 markdown_editor_ot: path: 3rd_party/markdown_editor_ot cherry_toast: