增加sentry监控
This commit is contained in:
parent
743046afe2
commit
ef4937ad6d
|
@ -12,12 +12,13 @@ class Global {
|
||||||
static Future init() async {
|
static Future init() async {
|
||||||
// 运行初始
|
// 运行初始
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
// 设备方向
|
||||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
|
||||||
// 调整系统UI 因为appBar会覆盖这个设置 所以换了个地方设置
|
// 调整系统UI 因为appBar会覆盖这个设置 所以换了个地方设置
|
||||||
// setSystemUi();
|
// setSystemUi();
|
||||||
|
|
||||||
// 初始换easyLoading
|
// 初始化easyLoading
|
||||||
Loading();
|
Loading();
|
||||||
|
|
||||||
await Get.putAsync<StorageService>(() => StorageService().init());
|
await Get.putAsync<StorageService>(() => StorageService().init());
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.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:news_getx/translations/app_translations.dart';
|
||||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
await Global.init();
|
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 {
|
class MyApp extends StatelessWidget {
|
||||||
|
@ -28,21 +37,19 @@ class MyApp extends StatelessWidget {
|
||||||
// 如果不把这歌参数设为true 那么column就不会随着软键盘而变化
|
// 如果不把这歌参数设为true 那么column就不会随着软键盘而变化
|
||||||
// useInheritedMediaQuery: true,
|
// useInheritedMediaQuery: true,
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
|
|
||||||
var app = GetMaterialApp(
|
var app = GetMaterialApp(
|
||||||
title: 'News',
|
title: 'News',
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: AppTheme.light.copyWith(
|
theme: AppTheme.light.copyWith(
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
systemOverlayStyle: SystemUiOverlayStyle(
|
systemOverlayStyle: SystemUiOverlayStyle(
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
statusBarBrightness: Brightness.light,
|
statusBarBrightness: Brightness.light,
|
||||||
statusBarIconBrightness: Brightness.dark,
|
statusBarIconBrightness: Brightness.dark,
|
||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
systemNavigationBarColor: Colors.white,
|
systemNavigationBarColor: Colors.white,
|
||||||
systemNavigationBarIconBrightness: Brightness.dark,
|
systemNavigationBarIconBrightness: Brightness.dark,
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
unknownRoute: AppPages.notFoundRoute,
|
unknownRoute: AppPages.notFoundRoute,
|
||||||
initialRoute: AppPages.Initial,
|
initialRoute: AppPages.Initial,
|
||||||
|
@ -70,10 +77,12 @@ class MyApp extends StatelessWidget {
|
||||||
footerTriggerDistance: 150,
|
footerTriggerDistance: 150,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
// todo 有没有更好的解决方案
|
// todo 有没有更好的解决方案
|
||||||
return ConfigService.to.isGrayFilter.isTrue ? ColorFiltered(
|
return ConfigService.to.isGrayFilter.isTrue
|
||||||
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.color),
|
? ColorFiltered(
|
||||||
child: app,
|
colorFilter: ColorFilter.mode(Colors.grey, BlendMode.color),
|
||||||
) : app;
|
child: app,
|
||||||
|
)
|
||||||
|
: app;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -144,6 +144,9 @@ class AppUpdateUtil {
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
);
|
);
|
||||||
await downloadController.download(fileUrl, fullPath);
|
await downloadController.download(fileUrl, fullPath);
|
||||||
|
|
||||||
|
// 释放
|
||||||
|
downloadController.dispose();
|
||||||
}
|
}
|
||||||
// 安装
|
// 安装
|
||||||
await InstallPlugin.installApk(fullPath);
|
await InstallPlugin.installApk(fullPath);
|
||||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -558,13 +558,21 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.27.7"
|
version: "0.27.7"
|
||||||
sentry:
|
sentry:
|
||||||
dependency: "direct main"
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sentry
|
name: sentry
|
||||||
sha256: "377edcc3d7910745849b1621dcec7d34fc27b6c03e9e9009499dc2968ce19cd7"
|
sha256: "8f4f1d3ef3ca1801aa3138392bbf0851b39eff703008111765b265f76c8f0190"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
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:
|
share:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -88,8 +88,8 @@ dependencies:
|
||||||
# permission 权限
|
# permission 权限
|
||||||
permission_handler: ^10.4.3
|
permission_handler: ^10.4.3
|
||||||
|
|
||||||
# 错误收集
|
# sentry错误收集
|
||||||
sentry: ^5.0.0
|
sentry_flutter: ^7.8.0
|
||||||
|
|
||||||
# webView
|
# webView
|
||||||
webview_flutter: ^4.2.2
|
webview_flutter: ^4.2.2
|
||||||
|
|
Loading…
Reference in New Issue