增加sentry监控

This commit is contained in:
胡天 2023-07-26 17:17:27 +08:00
parent 743046afe2
commit ef4937ad6d
5 changed files with 43 additions and 22 deletions

View File

@ -12,12 +12,13 @@ class Global {
static Future init() async {
//
WidgetsFlutterBinding.ensureInitialized();
//
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// UI appBar会覆盖这个设置
// setSystemUi();
// easyLoading
// easyLoading
Loading();
await Get.putAsync<StorageService>(() => StorageService().init());

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -11,10 +10,20 @@ import 'package:news_getx/theme/app_theme.dart';
import 'package:news_getx/translations/app_translations.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
await Global.init();
runApp(const MyApp());
await SentryFlutter.init(
(options) {
options.dsn = "https://acac4fdb2abc486a9f7c64558f27d85e@o4505594886356992.ingest.sentry.io/4505594892124160";
if (ConfigService.to.isRelease) {
options.tracesSampleRate = 1.0;
}
},
appRunner: () => runApp(const MyApp()),
);
}
class MyApp extends StatelessWidget {
@ -28,7 +37,6 @@ class MyApp extends StatelessWidget {
// true column就不会随着软键盘而变化
// useInheritedMediaQuery: true,
builder: (BuildContext context, Widget? child) {
var app = GetMaterialApp(
title: 'News',
debugShowCheckedModeBanner: false,
@ -41,8 +49,7 @@ class MyApp extends StatelessWidget {
systemNavigationBarDividerColor: Colors.transparent,
systemNavigationBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.dark,
)
),
)),
),
unknownRoute: AppPages.notFoundRoute,
initialRoute: AppPages.Initial,
@ -70,10 +77,12 @@ class MyApp extends StatelessWidget {
footerTriggerDistance: 150,
child: Obx(() {
// todo
return ConfigService.to.isGrayFilter.isTrue ? ColorFiltered(
return ConfigService.to.isGrayFilter.isTrue
? ColorFiltered(
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.color),
child: app,
) : app;
)
: app;
}),
);
},

View File

@ -144,6 +144,9 @@ class AppUpdateUtil {
barrierDismissible: false,
);
await downloadController.download(fileUrl, fullPath);
//
downloadController.dispose();
}
//
await InstallPlugin.installApk(fullPath);

View File

@ -558,13 +558,21 @@ packages:
source: hosted
version: "0.27.7"
sentry:
dependency: "direct main"
dependency: transitive
description:
name: sentry
sha256: "377edcc3d7910745849b1621dcec7d34fc27b6c03e9e9009499dc2968ce19cd7"
sha256: "8f4f1d3ef3ca1801aa3138392bbf0851b39eff703008111765b265f76c8f0190"
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.1.0"
version: "7.8.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
sha256: bbc1048558cf8ae65c1e27b1249357298cfca50e5843ad0367387f5c873b8e42
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.8.0"
share:
dependency: "direct main"
description:

View File

@ -88,8 +88,8 @@ dependencies:
# permission 权限
permission_handler: ^10.4.3
# 错误收集
sentry: ^5.0.0
# sentry错误收集
sentry_flutter: ^7.8.0
# webView
webview_flutter: ^4.2.2